From d32515010d23196aafde87c0af7168c0bbed57b2 Mon Sep 17 00:00:00 2001 From: Tracker-Friendly Date: Mon, 11 Mar 2024 17:39:45 +0000 Subject: [PATCH 1/4] Added OOB E for new versions, links now are desktop compatible, fixed issue where character gets cutoff by one --- static/css/style.css | 3 +-- static/js/login.js | 4 ++-- static/js/main.js | 42 ++++++++++++++++++++++++++++-------------- static/js/signup.js | 2 +- 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/static/css/style.css b/static/css/style.css index 695dcbf..7f65050 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -363,13 +363,12 @@ body { left: 50%; top: 50%; transform: translate(-50%, -50%); - width: 300px; position: fixed; background-color: var(--option-background); padding: 10px; color: var(--text-color); border-radius: 8px; - min-width: 338.5px; + min-width: 300px; z-index: 3; } diff --git a/static/js/login.js b/static/js/login.js index 6820dd0..2b3f499 100644 --- a/static/js/login.js +++ b/static/js/login.js @@ -111,7 +111,7 @@ signupButton.addEventListener("click", (event) => { return key }; - fetch(remote + "/api/login", { + fetch(remote + "https://notes.hectabit.org/api/login", { method: "POST", body: JSON.stringify({ username: username, @@ -135,7 +135,7 @@ signupButton.addEventListener("click", (event) => { } else if (response.status == 401) { console.log("Trying oldhash") - fetch(remote + "/api/login", { + fetch(remote + "https://notes.hectabit.org/api/login", { method: "POST", body: JSON.stringify({ username: username, diff --git a/static/js/main.js b/static/js/main.js index 44795cc..cfa320c 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -199,7 +199,7 @@ textMinusBox.addEventListener("click", (event) => { function updateUserInfo() { - fetch(remote + "/api/userinfo", { + fetch(remote + "https://notes.hectabit.org/api/userinfo", { method: "POST", body: JSON.stringify({ secretKey: secretkey @@ -250,7 +250,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(remote + "/api/deleteaccount", { + fetch(remote + "https://notes.hectabit.org/api/deleteaccount", { method: "POST", body: JSON.stringify({ secretKey: secretkey @@ -273,7 +273,7 @@ sessionManagerButton.addEventListener("click", (event) => { optionsDiv.classList.add("hidden") sessionManagerDiv.classList.remove("hidden") - fetch(remote + "/api/sessions/list", { + fetch(remote + "https://notes.hectabit.org/api/sessions/list", { method: "POST", body: JSON.stringify({ secretKey: secretkey @@ -313,7 +313,7 @@ sessionManagerButton.addEventListener("click", (event) => { } sessionRemoveButton.addEventListener("click", (event) => { - fetch(remote + "/api/sessions/remove", { + fetch(remote + "https://notes.hectabit.org/api/sessions/remove", { method: "POST", body: JSON.stringify({ secretKey: secretkey, @@ -372,7 +372,7 @@ function selectNote(nameithink) { let thingArray = Array.from(document.querySelectorAll(".noteButton")).find(el => el.id == nameithink); thingArray.classList.add("selected") - fetch(remote + "/api/readnote", { + fetch(remote + "https://notes.hectabit.org/api/readnote", { method: "POST", body: JSON.stringify({ secretKey: secretkey, @@ -407,9 +407,9 @@ function selectNote(nameithink) { updateWordCount() clearTimeout(timer); timer = setTimeout(() => { - let encryptedTitle = "empty note" - if (noteBox.value != "") { - let firstTitle = truncateString(noteBox.value.slice(0, noteBox.value.indexOf("\n")), 16) + let encryptedTitle = "New note" + if (noteBox.value.substring(0, noteBox.value.indexOf("\n")) != "") { + let firstTitle = noteBox.value.substring(0, noteBox.value.indexOf("\n")); document.getElementById(nameithink).innerText = firstTitle encryptedTitle = CryptoJS.AES.encrypt(firstTitle, password).toString(); @@ -417,7 +417,7 @@ function selectNote(nameithink) { let encryptedText = CryptoJS.AES.encrypt(noteBox.value, password).toString(); if (selectedNote == nameithink) { - fetch(remote + "/api/editnote", { + fetch(remote + "https://notes.hectabit.org/api/editnote", { method: "POST", body: JSON.stringify({ secretKey: secretkey, @@ -447,7 +447,7 @@ function selectNote(nameithink) { } function updateNotes() { - fetch(remote + "/api/listnotes", { + fetch(remote + "https://notes.hectabit.org/api/listnotes", { method: "POST", body: JSON.stringify({ secretKey: secretkey @@ -480,7 +480,7 @@ function updateNotes() { noteButton.addEventListener("click", (event) => { if (event.ctrlKey) { - fetch(remote + "/api/removenote", { + fetch(remote + "https://notes.hectabit.org/api/removenote", { method: "POST", body: JSON.stringify({ secretKey: secretkey, @@ -512,7 +512,7 @@ updateNotes() newNote.addEventListener("click", (event) => { let noteName = "empty note" let encryptedName = CryptoJS.AES.encrypt(noteName, password).toString(); - fetch(remote + "/api/newnote", { + fetch(remote + "https://notes.hectabit.org/api/newnote", { method: "POST", body: JSON.stringify({ secretKey: secretkey, @@ -546,7 +546,7 @@ function downloadObjectAsJson(exportObj, exportName) { function exportNotes() { let noteExport = [] - fetch(remote + "/api/exportnotes", { + fetch(remote + "https://notes.hectabit.org/api/exportnotes", { method: "POST", body: JSON.stringify({ secretKey: secretkey @@ -595,6 +595,16 @@ function isFirstTimeVisitor() { } } +function firstNewVersion() { + if (document.cookie.indexOf("version=1.1") !== -1) { + return false; + } else { + var expirationDate = new Date(); + expirationDate.setFullYear(expirationDate.getFullYear() + 1); + document.cookie = "version=1.1; expires=" + expirationDate.toUTCString() + "; path=/; SameSite=strict"; + return true; + } +} exportNotesButton.addEventListener("click", (event) => { exportNotesButton.innerText = "Downloading..." @@ -605,7 +615,7 @@ removeBox.addEventListener("click", (event) => { if (selectedNote == 0) { displayError("You need to select a note first!") } else { - fetch(remote + "/api/removenote", { + fetch(remote + "https://notes.hectabit.org/api/removenote", { method: "POST", body: JSON.stringify({ secretKey: secretkey, @@ -628,3 +638,7 @@ removeBox.addEventListener("click", (event) => { if (isFirstTimeVisitor() && /Android|iPhone|iPod/i.test(navigator.userAgent)) { displayError("To use Burgernotes:\n Swipe Right on a note to open it\n Swipe left in the text boxes to return to notes\n Click on a note to highlight it") } + +if (firstNewVersion()) { + displayError("What's new in Burgernotes 1.1?\n\nNote titles are now the first line of a note \(will not break compatibility with older notes\)\nIntroduced improved login screen\nNote titles now scroll correctly") +} diff --git a/static/js/signup.js b/static/js/signup.js index 00b208e..51e1404 100644 --- a/static/js/signup.js +++ b/static/js/signup.js @@ -63,7 +63,7 @@ signupButton.addEventListener("click", (event) => { }; - fetch(remote + "/api/signup", { + fetch(remote + "https://notes.hectabit.org/api/signup", { method: "POST", body: JSON.stringify({ username: username, From 87506796e20be0757aab6a42d9ec2b3b2fdb0b5a Mon Sep 17 00:00:00 2001 From: Tracker-Friendly Date: Mon, 11 Mar 2024 18:30:20 +0000 Subject: [PATCH 2/4] Fixed dark mode background, fixed text in signup screen. --- README.md | 12 ++++++++++++ config.ini | 4 ++-- config.ini.example | 5 +++++ static/css/style.css | 13 +++++++------ static/js/main.js | 2 +- templates/login.html | 13 +++++++------ templates/signup.html | 15 +++++++++++++-- 7 files changed, 47 insertions(+), 17 deletions(-) create mode 100644 config.ini.example diff --git a/README.md b/README.md index 5dd3196..3e1daa0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,18 @@ ## Burgernotes Burgernotes is a simple note-taking app with end-to-end encryption. +### Setup +To set up Burgernotes, simply run these commands: +``` +cp config.ini.example config.ini +python3 init_db +``` + +Edit config.ini to your liking, then to start the server run: +``` +python3 main +``` + ### Links [Go to the Burgernotes website](https://notes.hectabit.org) diff --git a/config.ini b/config.ini index 7af981e..3caa559 100644 --- a/config.ini +++ b/config.ini @@ -1,5 +1,5 @@ [config] HOST = 0.0.0.0 -PORT = 8070 -SECRET_KEY = iadguhaoghioahegOLEHGELHIGOAHLhoewhgoiwh +PORT = 8080 +SECRET_KEY = supersecretkey MAX_STORAGE = 25000000 diff --git a/config.ini.example b/config.ini.example new file mode 100644 index 0000000..3caa559 --- /dev/null +++ b/config.ini.example @@ -0,0 +1,5 @@ +[config] +HOST = 0.0.0.0 +PORT = 8080 +SECRET_KEY = supersecretkey +MAX_STORAGE = 25000000 diff --git a/static/css/style.css b/static/css/style.css index 7f65050..551f465 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -56,7 +56,7 @@ } .newNote img { - filter: invert(100%) + filter: invert(100%); } #errorDiv p { @@ -68,7 +68,7 @@ } .burgerSession img { - filter: invert(100%) !important + filter: invert(100%) !important; } .links a { @@ -85,16 +85,16 @@ .inoutdiv input { color: white; - background-color: #202124; + background-color: var(--editor); } .flathubLogo { - filter: invert(100%) + filter: invert(100%); } .feature { background-color: rgba(0, 0, 0, 0) !important; - color: var(--text-color) + color: var(--text-color); } .mainDiv .yellow { border-color: #e9e98d !important; @@ -402,7 +402,7 @@ body { .optionsDiv input { width: calc(100% - 12px); height: 25px; - background-color: ffffff; + background-color: #ffffff; padding-left: 5px; padding-right: 5px; margin-bottom: 7px; @@ -519,6 +519,7 @@ body { padding: 30px; border-radius: 25px; border: solid 1px var(--border-color); + background-color: var(--bar); } .inoutdiv input { diff --git a/static/js/main.js b/static/js/main.js index cfa320c..4a37f12 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -510,7 +510,7 @@ function updateNotes() { updateNotes() newNote.addEventListener("click", (event) => { - let noteName = "empty note" + let noteName = "New note" let encryptedName = CryptoJS.AES.encrypt(noteName, password).toString(); fetch(remote + "https://notes.hectabit.org/api/newnote", { method: "POST", diff --git a/templates/login.html b/templates/login.html index bdf22ec..64d5322 100644 --- a/templates/login.html +++ b/templates/login.html @@ -15,11 +15,13 @@

Login

- + + -

+ +
+

Don't have an account? If so, Create one here!

Privacy & Terms
@@ -30,11 +32,10 @@ background-color: #d9d9d9; background-image: url("/static/svg/grid.svg"); background-repeat: repeat; - background-size: 312px + background-size: 312px; } .inoutdiv { - background-color: #fff; border-radius: 8px; } - \ No newline at end of file + diff --git a/templates/signup.html b/templates/signup.html index 2d99ebd..922ec60 100644 --- a/templates/signup.html +++ b/templates/signup.html @@ -20,9 +20,20 @@


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

- By signing up, you agree to our Privacy & Terms.

+

By signing up, you agree to our Privacy & Terms.

+

Already have an account? If so, Login instead!


- + From cb4dd2c2ff108c004e6c41111d07b78c0bf05ff9 Mon Sep 17 00:00:00 2001 From: Tracker-Friendly Date: Mon, 11 Mar 2024 18:31:08 +0000 Subject: [PATCH 3/4] Removed config.ini --- config.ini | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 config.ini diff --git a/config.ini b/config.ini deleted file mode 100644 index 3caa559..0000000 --- a/config.ini +++ /dev/null @@ -1,5 +0,0 @@ -[config] -HOST = 0.0.0.0 -PORT = 8080 -SECRET_KEY = supersecretkey -MAX_STORAGE = 25000000 From c4259184fda7301836255d0eeac81db62637f449 Mon Sep 17 00:00:00 2001 From: Tracker-Friendly Date: Mon, 11 Mar 2024 18:31:29 +0000 Subject: [PATCH 4/4] Ignore config.ini.example --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index dc69bec..23bfc0d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ database.db config.ini +config.ini.example