From 91fc7703df65e6146a651f41ab7191c0687c39a2 Mon Sep 17 00:00:00 2001
From: Tracker-Friendly
Date: Tue, 27 Feb 2024 17:04:31 +0000
Subject: [PATCH 01/12] Made all paths relative
---
static/css/style.css | 2 +-
static/js/login.js | 12 ++++++------
static/js/main.js | 34 +++++++++++++++++-----------------
static/js/signup.js | 8 ++++----
templates/app.html | 16 ++++++++--------
templates/error.html | 2 +-
templates/login.html | 8 ++++----
templates/logout.html | 2 +-
templates/main.html | 8 ++++----
templates/privacy.html | 2 +-
templates/signup.html | 10 +++++-----
11 files changed, 52 insertions(+), 52 deletions(-)
diff --git a/static/css/style.css b/static/css/style.css
index 967baab..5d40e2a 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%;
diff --git a/static/js/login.js b/static/js/login.js
index 399a067..7800374 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,
@@ -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,
@@ -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..b2fed72 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,7 +197,7 @@ textMinusBox.addEventListener("click", (event) => {
function updateUserInfo() {
- fetch("/api/userinfo", {
+ fetch("https://notes.hectabit.org/api/userinfo", {
method: "POST",
body: JSON.stringify({
secretKey: secretkey
@@ -214,7 +214,7 @@ function updateUserInfo() {
closeErrorButton.classList.add("hidden")
usernameBox.innerText = ""
setTimeout(function () {
- window.location.replace("/api/logout")
+ window.location.replace("https://notes.hectabit.org/api/logout")
}, 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("https://notes.hectabit.org/api/logout")
});
exitThing.addEventListener("click", (event) => {
optionsDiv.classList.add("hidden")
@@ -244,7 +244,7 @@ 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
@@ -256,7 +256,7 @@ deleteMyAccountButton.addEventListener("click", (event) => {
.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,7 +267,7 @@ 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
@@ -307,7 +307,7 @@ 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,
@@ -320,7 +320,7 @@ sessionManagerButton.addEventListener("click", (event) => {
.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,7 +358,7 @@ 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,
@@ -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,
@@ -425,7 +425,7 @@ function selectNote(nameithink) {
}
function updateNotes() {
- fetch("/api/listnotes", {
+ fetch("https://notes.hectabit.org/api/listnotes", {
method: "POST",
body: JSON.stringify({
secretKey: secretkey
@@ -459,7 +459,7 @@ 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,
@@ -499,7 +499,7 @@ 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,
@@ -535,7 +535,7 @@ 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
@@ -594,7 +594,7 @@ 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,
diff --git a/static/js/signup.js b/static/js/signup.js
index dd20dc7..4566a67 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,7 +61,7 @@ signupButton.addEventListener("click", (event) => {
};
- fetch("/api/signup", {
+ fetch("https://notes.hectabit.org/api/signup", {
method: "POST",
body: JSON.stringify({
username: username,
@@ -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/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!
-
-
+
+