Added OOB

E for new versions, links now are desktop compatible, fixed issue where character gets cutoff by one
This commit is contained in:
Tracker-Friendly 2024-03-11 17:39:45 +00:00
parent f7920de812
commit d32515010d
4 changed files with 32 additions and 19 deletions

View File

@ -363,13 +363,12 @@ body {
left: 50%; left: 50%;
top: 50%; top: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
width: 300px;
position: fixed; position: fixed;
background-color: var(--option-background); background-color: var(--option-background);
padding: 10px; padding: 10px;
color: var(--text-color); color: var(--text-color);
border-radius: 8px; border-radius: 8px;
min-width: 338.5px; min-width: 300px;
z-index: 3; z-index: 3;
} }

View File

@ -111,7 +111,7 @@ signupButton.addEventListener("click", (event) => {
return key return key
}; };
fetch(remote + "/api/login", { fetch(remote + "https://notes.hectabit.org/api/login", {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
username: username, username: username,
@ -135,7 +135,7 @@ signupButton.addEventListener("click", (event) => {
} }
else if (response.status == 401) { else if (response.status == 401) {
console.log("Trying oldhash") console.log("Trying oldhash")
fetch(remote + "/api/login", { fetch(remote + "https://notes.hectabit.org/api/login", {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
username: username, username: username,

View File

@ -199,7 +199,7 @@ textMinusBox.addEventListener("click", (event) => {
function updateUserInfo() { function updateUserInfo() {
fetch(remote + "/api/userinfo", { fetch(remote + "https://notes.hectabit.org/api/userinfo", {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
secretKey: secretkey secretKey: secretkey
@ -250,7 +250,7 @@ exitThing.addEventListener("click", (event) => {
}); });
deleteMyAccountButton.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) { 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", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
secretKey: secretkey secretKey: secretkey
@ -273,7 +273,7 @@ sessionManagerButton.addEventListener("click", (event) => {
optionsDiv.classList.add("hidden") optionsDiv.classList.add("hidden")
sessionManagerDiv.classList.remove("hidden") sessionManagerDiv.classList.remove("hidden")
fetch(remote + "/api/sessions/list", { fetch(remote + "https://notes.hectabit.org/api/sessions/list", {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
secretKey: secretkey secretKey: secretkey
@ -313,7 +313,7 @@ sessionManagerButton.addEventListener("click", (event) => {
} }
sessionRemoveButton.addEventListener("click", (event) => { sessionRemoveButton.addEventListener("click", (event) => {
fetch(remote + "/api/sessions/remove", { fetch(remote + "https://notes.hectabit.org/api/sessions/remove", {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
secretKey: secretkey, secretKey: secretkey,
@ -372,7 +372,7 @@ function selectNote(nameithink) {
let thingArray = Array.from(document.querySelectorAll(".noteButton")).find(el => el.id == nameithink); let thingArray = Array.from(document.querySelectorAll(".noteButton")).find(el => el.id == nameithink);
thingArray.classList.add("selected") thingArray.classList.add("selected")
fetch(remote + "/api/readnote", { fetch(remote + "https://notes.hectabit.org/api/readnote", {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
secretKey: secretkey, secretKey: secretkey,
@ -407,9 +407,9 @@ function selectNote(nameithink) {
updateWordCount() updateWordCount()
clearTimeout(timer); clearTimeout(timer);
timer = setTimeout(() => { timer = setTimeout(() => {
let encryptedTitle = "empty note" let encryptedTitle = "New note"
if (noteBox.value != "") { if (noteBox.value.substring(0, noteBox.value.indexOf("\n")) != "") {
let firstTitle = truncateString(noteBox.value.slice(0, noteBox.value.indexOf("\n")), 16) let firstTitle = noteBox.value.substring(0, noteBox.value.indexOf("\n"));
document.getElementById(nameithink).innerText = firstTitle document.getElementById(nameithink).innerText = firstTitle
encryptedTitle = CryptoJS.AES.encrypt(firstTitle, password).toString(); encryptedTitle = CryptoJS.AES.encrypt(firstTitle, password).toString();
@ -417,7 +417,7 @@ function selectNote(nameithink) {
let encryptedText = CryptoJS.AES.encrypt(noteBox.value, password).toString(); let encryptedText = CryptoJS.AES.encrypt(noteBox.value, password).toString();
if (selectedNote == nameithink) { if (selectedNote == nameithink) {
fetch(remote + "/api/editnote", { fetch(remote + "https://notes.hectabit.org/api/editnote", {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
secretKey: secretkey, secretKey: secretkey,
@ -447,7 +447,7 @@ function selectNote(nameithink) {
} }
function updateNotes() { function updateNotes() {
fetch(remote + "/api/listnotes", { fetch(remote + "https://notes.hectabit.org/api/listnotes", {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
secretKey: secretkey secretKey: secretkey
@ -480,7 +480,7 @@ function updateNotes() {
noteButton.addEventListener("click", (event) => { noteButton.addEventListener("click", (event) => {
if (event.ctrlKey) { if (event.ctrlKey) {
fetch(remote + "/api/removenote", { fetch(remote + "https://notes.hectabit.org/api/removenote", {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
secretKey: secretkey, secretKey: secretkey,
@ -512,7 +512,7 @@ updateNotes()
newNote.addEventListener("click", (event) => { newNote.addEventListener("click", (event) => {
let noteName = "empty note" let noteName = "empty note"
let encryptedName = CryptoJS.AES.encrypt(noteName, password).toString(); let encryptedName = CryptoJS.AES.encrypt(noteName, password).toString();
fetch(remote + "/api/newnote", { fetch(remote + "https://notes.hectabit.org/api/newnote", {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
secretKey: secretkey, secretKey: secretkey,
@ -546,7 +546,7 @@ function downloadObjectAsJson(exportObj, exportName) {
function exportNotes() { function exportNotes() {
let noteExport = [] let noteExport = []
fetch(remote + "/api/exportnotes", { fetch(remote + "https://notes.hectabit.org/api/exportnotes", {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
secretKey: secretkey 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.addEventListener("click", (event) => {
exportNotesButton.innerText = "Downloading..." exportNotesButton.innerText = "Downloading..."
@ -605,7 +615,7 @@ removeBox.addEventListener("click", (event) => {
if (selectedNote == 0) { if (selectedNote == 0) {
displayError("You need to select a note first!") displayError("You need to select a note first!")
} else { } else {
fetch(remote + "/api/removenote", { fetch(remote + "https://notes.hectabit.org/api/removenote", {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
secretKey: secretkey, secretKey: secretkey,
@ -628,3 +638,7 @@ removeBox.addEventListener("click", (event) => {
if (isFirstTimeVisitor() && /Android|iPhone|iPod/i.test(navigator.userAgent)) { 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") 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")
}

View File

@ -63,7 +63,7 @@ signupButton.addEventListener("click", (event) => {
}; };
fetch(remote + "/api/signup", { fetch(remote + "https://notes.hectabit.org/api/signup", {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
username: username, username: username,