diff --git a/main b/main index ace6eed..9222e51 100644 --- a/main +++ b/main @@ -105,25 +105,40 @@ async def add_cors_headers(response): return response # Main page +@app.route("/index.html") +async def mainrdir(): + return redirect("/", code=302) @app.route("/") async def main(): return await render_template("main.html") # Web app +@app.route("/app/index.html") +async def apprdir(): + return redirect("/app", code=302) @app.route("/app") async def webapp(): return await render_template("app.html") # Login and signup +@app.route("/signup/index.html") +async def signuprdir(): + return redirect("/signup", code=302) @app.route("/signup") async def signup(): return await render_template("signup.html") +@app.route("/login/index.html") +async def loginrdir(): + return redirect("/login", code=302) @app.route("/login") async def login(): return await render_template("login.html") # Privacy policy +@app.route("/privacy/index.html") +async def privacyrdir(): + return redirect("/privacy", code=302) @app.route("/privacy") async def privacy(): return await render_template("privacy.html") @@ -508,7 +523,10 @@ def listusers(secretkey): else: return redirect("/") -@app.route("/api/logout") +@app.route("/logout/index.html") +async def logoutrdir(): + return redirect("/logout", code=302) +@app.route("/logout") async def apilogout(): return await render_template("logout.html") diff --git a/static/css/style.css b/static/css/style.css index 967baab..1eb19c1 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -1,4 +1,4 @@ -@import url("/static/fonts/inter.css"); +@import url("../fonts/inter.css"); :root { --invertdm: 0%; @@ -170,7 +170,7 @@ body { filter: invert(var(--invertdm)); padding-left: 17.5px; padding-right: 17.5px; - background-image: url("/static/svg/delete.svg"); + background-image: url("../static/svg/delete.svg"); background-position: center; background-repeat: no-repeat; background-size: 55%; diff --git a/static/js/login.js b/static/js/login.js index 399a067..e20da4c 100644 --- a/static/js/login.js +++ b/static/js/login.js @@ -1,10 +1,10 @@ if (localStorage.getItem("DONOTSHARE-secretkey") !== null) { - window.location.replace("/app") + window.location.replace("../app/index.html") document.body.innerHTML = "Redirecting..." throw new Error(); } if (localStorage.getItem("DONOTSHARE-password") !== null) { - window.location.replace("/app") + window.location.replace("../app/index.html") document.body.innerHTML = "Redirecting..." throw new Error(); } @@ -109,7 +109,7 @@ signupButton.addEventListener("click", (event) => { return key }; - fetch("/api/login", { + fetch("https://notes.hectabit.org/api/login", { method: "POST", body: JSON.stringify({ username: username, @@ -118,7 +118,7 @@ signupButton.addEventListener("click", (event) => { newpass: "null" }), headers: { - "Content-type": "application/json; charset=UTF-8" + "Content-Type": "application/json; charset=UTF-8" } }) .then((response) => response) @@ -129,11 +129,11 @@ signupButton.addEventListener("click", (event) => { localStorage.setItem("DONOTSHARE-secretkey", responseData["key"]) localStorage.setItem("DONOTSHARE-password", await hashwasm.sha512(password)) - window.location.href = "/app" + window.location.href = "../app/index.html" } else if (response.status == 401) { console.log("Trying oldhash") - fetch("/api/login", { + fetch("https://notes.hectabit.org/api/login", { method: "POST", body: JSON.stringify({ username: username, @@ -142,7 +142,7 @@ signupButton.addEventListener("click", (event) => { newpass: await hashpass(password) }), headers: { - "Content-type": "application/json; charset=UTF-8" + "Content-Type": "application/json; charset=UTF-8" } }) .then((response) => response) @@ -153,7 +153,7 @@ signupButton.addEventListener("click", (event) => { localStorage.setItem("DONOTSHARE-secretkey", responseData["key"]) localStorage.setItem("DONOTSHARE-password", await hashwasm.sha512(password)) - window.location.href = "/app" + window.location.href = "../app/index.html" } else if (response.status == 401) { statusBox.innerText = "Wrong username or password..." diff --git a/static/js/main.js b/static/js/main.js index f0e828c..11d5b18 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1,10 +1,10 @@ if (localStorage.getItem("DONOTSHARE-secretkey") === null) { - window.location.replace("/login") + window.location.replace("../login/index.html") document.body.innerHTML = "Redirecting..." throw new Error(); } if (localStorage.getItem("DONOTSHARE-password") === null) { - window.location.replace("/login") + window.location.replace("../login/index.html") document.body.innerHTML = "Redirecting..." throw new Error(); } @@ -197,13 +197,13 @@ textMinusBox.addEventListener("click", (event) => { function updateUserInfo() { - fetch("/api/userinfo", { + fetch("https://notes.hectabit.org/api/userinfo", { method: "POST", body: JSON.stringify({ secretKey: secretkey }), headers: { - "Content-type": "application/json; charset=UTF-8" + "Content-Type": "application/json; charset=UTF-8" } }) .then((response) => response) @@ -214,7 +214,7 @@ function updateUserInfo() { closeErrorButton.classList.add("hidden") usernameBox.innerText = "" setTimeout(function () { - window.location.replace("/api/logout") + window.location.replace("../logout/index.html") }, 2500); } else { let responseData = await response.json() @@ -236,7 +236,7 @@ usernameBox.addEventListener("click", (event) => { updateUserInfo() }); logOutButton.addEventListener("click", (event) => { - window.location.replace("/api/logout") + window.location.replace("/logout/index.html") }); exitThing.addEventListener("click", (event) => { optionsDiv.classList.add("hidden") @@ -244,19 +244,19 @@ exitThing.addEventListener("click", (event) => { }); deleteMyAccountButton.addEventListener("click", (event) => { if (confirm("Are you REALLY sure that you want to delete your account? There's no going back!") == true) { - fetch("/api/deleteaccount", { + fetch("https://notes.hectabit.org/api/deleteaccount", { method: "POST", body: JSON.stringify({ secretKey: secretkey }), headers: { - "Content-type": "application/json; charset=UTF-8" + "Content-Type": "application/json; charset=UTF-8" } }) .then((response) => response) .then((response) => { if (response.status == 200) { - window.location.href = "/api/logout" + window.location.href = "https://notes.hectabit.org/api/logout" } else { displayError("Failed to delete account (HTTP error code " + response.status + ")") } @@ -267,13 +267,13 @@ sessionManagerButton.addEventListener("click", (event) => { optionsDiv.classList.add("hidden") sessionManagerDiv.classList.remove("hidden") - fetch("/api/sessions/list", { + fetch("https://notes.hectabit.org/api/sessions/list", { method: "POST", body: JSON.stringify({ secretKey: secretkey }), headers: { - "Content-type": "application/json; charset=UTF-8" + "Content-Type": "application/json; charset=UTF-8" } }) .then((response) => response) @@ -307,20 +307,20 @@ sessionManagerButton.addEventListener("click", (event) => { } sessionRemoveButton.addEventListener("click", (event) => { - fetch("/api/sessions/remove", { + fetch("https://notes.hectabit.org/api/sessions/remove", { method: "POST", body: JSON.stringify({ secretKey: secretkey, sessionId: responseData[i]["id"] }), headers: { - "Content-type": "application/json; charset=UTF-8" + "Content-Type": "application/json; charset=UTF-8" } }) .then((response) => response) .then((response) => { if (responseData[i]["thisSession"] == true) { - window.location.replace("/api/logout") + window.location.replace("https://notes.hectabit.org/api/logout") } }); sessionElement.remove() @@ -358,14 +358,14 @@ function selectNote(nameithink) { let thingArray = Array.from(document.querySelectorAll(".noteButton")).find(el => el.id == nameithink); thingArray.classList.add("selected") - fetch("/api/readnote", { + fetch("https://notes.hectabit.org/api/readnote", { method: "POST", body: JSON.stringify({ secretKey: secretkey, noteId: nameithink, }), headers: { - "Content-type": "application/json; charset=UTF-8" + "Content-Type": "application/json; charset=UTF-8" } }) .catch((error) => { @@ -396,7 +396,7 @@ function selectNote(nameithink) { let encryptedText = CryptoJS.AES.encrypt(noteBox.value, password).toString(); if (selectedNote == nameithink) { - fetch("/api/editnote", { + fetch("https://notes.hectabit.org/api/editnote", { method: "POST", body: JSON.stringify({ secretKey: secretkey, @@ -404,7 +404,7 @@ function selectNote(nameithink) { content: encryptedText, }), headers: { - "Content-type": "application/json; charset=UTF-8" + "Content-Type": "application/json; charset=UTF-8" } }) .then((response) => response) @@ -425,13 +425,13 @@ function selectNote(nameithink) { } function updateNotes() { - fetch("/api/listnotes", { + fetch("https://notes.hectabit.org/api/listnotes", { method: "POST", body: JSON.stringify({ secretKey: secretkey }), headers: { - "Content-type": "application/json; charset=UTF-8" + "Content-Type": "application/json; charset=UTF-8" } }) .then((response) => response) @@ -459,14 +459,14 @@ function updateNotes() { noteButton.addEventListener("click", (event) => { if (event.ctrlKey) { - fetch("/api/removenote", { + fetch("https://notes.hectabit.org/api/removenote", { method: "POST", body: JSON.stringify({ secretKey: secretkey, noteId: responseData[i]["id"] }), headers: { - "Content-type": "application/json; charset=UTF-8" + "Content-Type": "application/json; charset=UTF-8" } }) .then((response) => response) @@ -499,14 +499,14 @@ newNote.addEventListener("click", (event) => { } let encryptedName = CryptoJS.AES.encrypt(noteName, password).toString(); - fetch("/api/newnote", { + fetch("https://notes.hectabit.org/api/newnote", { method: "POST", body: JSON.stringify({ secretKey: secretkey, noteName: encryptedName, }), headers: { - "Content-type": "application/json; charset=UTF-8" + "Content-Type": "application/json; charset=UTF-8" } }) .catch((error) => { @@ -535,13 +535,13 @@ function downloadObjectAsJson(exportObj, exportName) { function exportNotes() { let noteExport = [] - fetch("/api/exportnotes", { + fetch("https://notes.hectabit.org/api/exportnotes", { method: "POST", body: JSON.stringify({ secretKey: secretkey }), headers: { - "Content-type": "application/json; charset=UTF-8" + "Content-Type": "application/json; charset=UTF-8" } }) .then((response) => response) @@ -594,14 +594,14 @@ removeBox.addEventListener("click", (event) => { if (selectedNote == 0) { displayError("You need to select a note first!") } else { - fetch("/api/removenote", { + fetch("https://notes.hectabit.org/api/removenote", { method: "POST", body: JSON.stringify({ secretKey: secretkey, noteId: selectedNote }), headers: { - "Content-type": "application/json; charset=UTF-8" + "Content-Type": "application/json; charset=UTF-8" } }) .then((response) => response) diff --git a/static/js/signup.js b/static/js/signup.js index dd20dc7..9452651 100644 --- a/static/js/signup.js +++ b/static/js/signup.js @@ -1,10 +1,10 @@ if (localStorage.getItem("DONOTSHARE-secretkey") !== null) { - window.location.replace("/app") + window.location.replace("../app/index.html") document.body.innerHTML = "Redirecting..." throw new Error(); } if (localStorage.getItem("DONOTSHARE-password") !== null) { - window.location.replace("/app") + window.location.replace("../app/index.html") document.body.innerHTML = "Redirecting..." throw new Error(); } @@ -61,14 +61,14 @@ signupButton.addEventListener("click", (event) => { }; - fetch("/api/signup", { + fetch("https://notes.hectabit.org/api/signup", { method: "POST", body: JSON.stringify({ username: username, password: await hashpass(password) }), headers: { - "Content-type": "application/json; charset=UTF-8" + "Content-Type": "application/json; charset=UTF-8" } }) .then((response) => response) @@ -81,7 +81,7 @@ signupButton.addEventListener("click", (event) => { localStorage.setItem("DONOTSHARE-secretkey", responseData["key"]) localStorage.setItem("DONOTSHARE-password", await hashwasm.sha512(password)) - window.location.href = "/app" + window.location.href = "../app/index.html" } else if (response.status == 409) { statusBox.innerText = "Username already taken!" diff --git a/templates/app.html b/templates/app.html index 03caaac..27e5ac0 100644 --- a/templates/app.html +++ b/templates/app.html @@ -6,8 +6,8 @@ - - + + @@ -28,7 +28,7 @@
+ src="../static/svg/add.svg">New note
@@ -46,10 +46,10 @@

Account managment

- - - - + + + +
- + diff --git a/templates/logout.html b/templates/logout.html index c1671f4..80edaf8 100644 --- a/templates/logout.html +++ b/templates/logout.html @@ -11,5 +11,5 @@ Logging out.. localStorage.removeItem("DONOTSHARE-secretkey") localStorage.removeItem("DONOTSHARE-password") localStorage.removeItem("CACHE-username") - window.location.replace("/") + window.location.replace("../index.html") diff --git a/templates/main.html b/templates/main.html index 7131e99..1a33583 100644 --- a/templates/main.html +++ b/templates/main.html @@ -6,7 +6,7 @@ - + @@ -17,12 +17,12 @@

Burgernotes

A simple note-taking service!


- Open in your browser + Open in your browser - Download for iOS + Download for iOS - +
@@ -37,7 +37,7 @@ diff --git a/templates/privacy.html b/templates/privacy.html index cca9b4f..61e1220 100644 --- a/templates/privacy.html +++ b/templates/privacy.html @@ -6,7 +6,7 @@ - + diff --git a/templates/signup.html b/templates/signup.html index d6b4df8..589e635 100644 --- a/templates/signup.html +++ b/templates/signup.html @@ -6,8 +6,8 @@ - - + + @@ -20,8 +20,8 @@

Please note that it's impossible to reset your password, do not forget it!

-

Already have an account? If so, Login instead!

+

Already have an account? If so, Login instead!

- - + +