From 60f843b6d22031f19925698ab94af7098ef2cb6a Mon Sep 17 00:00:00 2001 From: Modo Date: Wed, 25 Oct 2023 23:43:05 +0530 Subject: [PATCH] i hate rebase --- .gitignore | 6 +----- backend/rest_api.py | 19 +++++++----------- frontend/html/dashboard.html | 8 +++++++- frontend/html/index.html | 11 ++++++++--- frontend/html/register.html | 6 ++++++ frontend/scripts/dashboard.js | 18 ++++++++++-------- frontend/scripts/index.js | 2 -- frontend/scripts/register.js | 3 ++- package-lock.json | 36 +---------------------------------- package.json | 10 ++-------- 10 files changed, 44 insertions(+), 75 deletions(-) diff --git a/.gitignore b/.gitignore index ac68707..08775f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,4 @@ *__pycache__* /node_modules -<<<<<<< HEAD - -======= /devfolder -.vscode ->>>>>>> 0d9e690db10b6dfbef3d9aa4316e52d1e8cb8f6a +.vscode \ No newline at end of file diff --git a/backend/rest_api.py b/backend/rest_api.py index 1ac13aa..165b2c9 100644 --- a/backend/rest_api.py +++ b/backend/rest_api.py @@ -18,18 +18,6 @@ def handle_first_launched(): folder_path = path.join(folder_path, "Unnamed_Password_Manager") if not path.exists(folder_path): mkdir(folder_path) - - -@app.route('/favicon.ico') -def favicon() -> Response: - favicon_path: str = path.join(app.root_path, '../frontend/static', 'favicon.ico') - return send_file(favicon_path, mimetype='image/vnd.microsoft.icon') - - -@app.route("/index.html") -def handle_index() -> Response: - index_path: str = path.join(app.root_path, "../frontend/html", "index.html") - return send_file(index_path, mimetype="text/html") @app.get("/") @@ -466,3 +454,10 @@ class QueryHandler: ) return Response(status=200) +import os +from os import path + +@app.route('/favicon.ico') +def favicon(): + favicon_path = os.path.join(app.root_path, 'static', 'favicon.ico') + return send_file(favicon_path, mimetype='image/vnd.microsoft.icon') \ No newline at end of file diff --git a/frontend/html/dashboard.html b/frontend/html/dashboard.html index 8cc9d7d..131fba4 100644 --- a/frontend/html/dashboard.html +++ b/frontend/html/dashboard.html @@ -3,6 +3,13 @@ + DashBoard @@ -165,4 +172,3 @@ - diff --git a/frontend/html/index.html b/frontend/html/index.html index 77ff60f..b87f3cb 100644 --- a/frontend/html/index.html +++ b/frontend/html/index.html @@ -3,6 +3,14 @@ + + Login @@ -24,9 +32,6 @@
-
- Forgot Password -
Register
diff --git a/frontend/html/register.html b/frontend/html/register.html index f743d65..3eb1b23 100644 --- a/frontend/html/register.html +++ b/frontend/html/register.html @@ -3,6 +3,12 @@ + diff --git a/frontend/scripts/dashboard.js b/frontend/scripts/dashboard.js index d4e2e34..78bbe6a 100644 --- a/frontend/scripts/dashboard.js +++ b/frontend/scripts/dashboard.js @@ -14,9 +14,11 @@ //-----------------------------------------------------------------------------------------(Getting Data) +const PORT = 5000; + async function getData() { try { - let response = await fetch('/get_data', { + let response = await fetch(`http://127.0.0.1:${PORT}/get_data`, { method: 'POST', headers: { 'Content-Type': 'application/json' @@ -223,7 +225,7 @@ const errorlabel = document.querySelector('.fieldcontainer label') async function sendData(formData){ try { - const response = await fetch('/add_entry', { + const response = await fetch(`http://127.0.0.1:${PORT}/add_entry`, { method: "POST", body: formData }); @@ -401,7 +403,7 @@ async function deleteEntry() { const formData = new FormData() formData.append("entry_name", localStorage.getItem("editVal")) try { - const response = await fetch('/delete_entry', { + const response = await fetch(`http://127.0.0.1:${PORT}/delete_entry`, { method: "POST", body: formData }); @@ -479,7 +481,7 @@ async function sendPass(password) { const formData = new FormData() formData.append("password", password) try { - const response = await fetch('/change_password', { + const response = await fetch(`http://127.0.0.1:${PORT}/change_password`, { method: "POST", body: formData }); @@ -599,7 +601,7 @@ async function addNewField(sitename, field, value) { formData.append("field_value", value) try { - const response = await fetch('/add_field', { + const response = await fetch(`http://127.0.0.1:${PORT}/add_field`, { method: "POST", body: formData }); @@ -628,7 +630,7 @@ async function editFieldValue(sitename, field, value) { formData.append("field_value", value) try { - const response = await fetch('/edit_field_value', { + const response = await fetch(`http://127.0.0.1:${PORT}/edit_field_value`, { method: "POST", body: formData }); @@ -655,7 +657,7 @@ async function changeEntryName(entryname, sitename) { formData.append("new_entry_name", sitename) try { - const response = await fetch('/edit_entry_name', { + const response = await fetch(`http://127.0.0.1:${PORT}/edit_entry_name`, { method: "POST", body: formData }); @@ -795,7 +797,7 @@ function closePopup() { async function logOut() { try{ - await fetch("/logout", { + await fetch(`http://127.0.0.1:${PORT}/logout`, { method:'POST', headers: { 'Content-Type': 'application/json', diff --git a/frontend/scripts/index.js b/frontend/scripts/index.js index 91a5c68..c7118d3 100644 --- a/frontend/scripts/index.js +++ b/frontend/scripts/index.js @@ -118,5 +118,3 @@ window.onload = async function() { // console.error('Login Failed:', data.error) // } // } - - diff --git a/frontend/scripts/register.js b/frontend/scripts/register.js index 33bf13c..ab1985a 100644 --- a/frontend/scripts/register.js +++ b/frontend/scripts/register.js @@ -1,3 +1,4 @@ + const errlabel = document.getElementById('errlabel') function validateRegister() { @@ -74,4 +75,4 @@ async function Login(username,password){ } catch (error) { console.error('Error:', error.message); } -} +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index db2528d..cfd739d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,3 @@ -<<<<<<< HEAD -======= { "name": "unnamed-password-manager", "version": "1.0.0", @@ -9,39 +7,7 @@ "": { "name": "unnamed-password-manager", "version": "1.0.0", - "license": "ISC", - "dependencies": { - "cors": "^2.8.5" - } - }, - "node_modules/cors": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", - "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", - "dependencies": { - "object-assign": "^4", - "vary": "^1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", - "engines": { - "node": ">= 0.8" - } + "license": "ISC" } } } ->>>>>>> b1b896f (Add api request changes) diff --git a/package.json b/package.json index 51fdd6f..e6d1c07 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,12 @@ -<<<<<<< HEAD -======= { "name": "unnamed-password-manager", "version": "1.0.0", "description": "Hi", "main": "index.js", "scripts": { - "start": "nodemon devfolder/app.js" + "start": "" }, "keywords": [], "author": "", - "license": "ISC", - "dependencies": { - "cors": "^2.8.5" - } + "license": "ISC" } ->>>>>>> b1b896f (Add api request changes)