Handle First Launch

This commit is contained in:
Kosh 2023-10-15 13:05:44 +05:30
parent 970278f25f
commit 9aa23ff620
2 changed files with 10 additions and 5 deletions

View File

@ -1,7 +1,3 @@
WARNING:-
This api is not yet capable of handling any exceptions that may arise when opened for the first time
_____________________
Login:-
URL:- /login

View File

@ -1,18 +1,27 @@
from os import path
from os import mkdir, path
from flask import Flask, request, send_file, abort, Response
from werkzeug.datastructures import ImmutableMultiDict
from data_handler import DataHandler
import appdirs
app: Flask = Flask(__name__)
def handle_first_launched():
folder_path: str = appdirs.user_data_dir(appname="Unnamed_Password_Manager")
if not path.exists(folder_path):
mkdir(folder_path)
@app.get("/")
@app.get("/<url_path>")
def handle_get(url_path: str = "index.html") -> Response:
"""
Handle all get requests that are made.
"""
handle_first_launched()
requested_file_path: str = \
path.abspath(path.join(path.curdir, "..", "frontend", url_path))
response: Response = send_file(requested_file_path)