Compare commits

...

2 Commits

3 changed files with 67 additions and 29 deletions

View File

@ -31,8 +31,10 @@
</div> </div>
<div id="notesBar" class="notesBar"> <div id="notesBar" class="notesBar">
<button id="newNote" class="newNote"><img id="newNoteImage" draggable="false" alt="" <button id="newNote" class="newNote">
src="/static/svg/add.svg">New note</button> <div class="vcenter"><img id="newNoteImage" draggable="false" alt="" src="/static/svg/add.svg"></div>
<div class="vcenter">New note</div>
</button>
<div id="notesDiv" class="notesDiv"> <div id="notesDiv" class="notesDiv">
<button class="loadingStuff" id="loadingStuff"></button> <button class="loadingStuff" id="loadingStuff"></button>
</div> </div>
@ -42,17 +44,17 @@
<div id="optionsDiv" class="optionsDiv hidden"> <div id="optionsDiv" class="optionsDiv hidden">
<button class="exit" id="exitThing">X</button> <button class="exit" id="exitThing">X</button>
<h3 class="w300">Your account</h3> <h3 class="w300">Your account</h3>
<p id="usernameThing"></p> <p id="usernameThing">Cannot connect to the server</p>
<div class="section"></div> <div class="section"></div>
<p>Storage</p> <p>Storage</p>
<progress id="storageProgressThing" value="0" max="100"></progress><br> <progress id="storageProgressThing" value="0" max="100"></progress><br>
<p id="storageThing"></p> <p id="storageThing">Cannot connect to the server</p>
<div class="section"></div> <div class="section"></div>
<p>Account managment</p> <p>Account managment</p>
<button id="deleteMyAccountButton"><img src="/static/svg/delete_forever.svg" alt="">Delete my account</button> <button id="deleteMyAccountButton"><img src="/static/svg/delete_forever.svg" alt="">Delete account</button>
<button id="exportNotesButton"><img src="/static/svg/download.svg" alt="">Export notes</button> <button id="exportNotesButton"><img src="/static/svg/download.svg" alt="">Export notes</button>
<button id="importNotesButton"><img src="/static/svg/upload.svg" alt="">Import notes</button> <button id="importNotesButton"><img src="/static/svg/upload.svg" alt="">Import notes</button>
<button id="sessionManagerButton"><img src="/static/svg/list.svg" alt="">Session manager</button> <button id="sessionManagerButton"><img src="/static/svg/list.svg" alt="">View sessions</button>
<button class="lastButton" id="logOutButton"><img src="/static/svg/logout.svg" alt="">Log out</button> <button class="lastButton" id="logOutButton"><img src="/static/svg/logout.svg" alt="">Log out</button>
</div> </div>
<div id="sessionManagerDiv" class="optionsDiv hidden"> <div id="sessionManagerDiv" class="optionsDiv hidden">

View File

@ -339,19 +339,21 @@ body {
.notesBar .newNote { .notesBar .newNote {
height: 41px; height: 41px;
line-height: 41px; line-height: 41px;
width: 100%;
text-align: left; text-align: left;
background-color: rgba(0, 0, 0, 0);
border: none;
font-size: 16px; font-size: 16px;
margin-bottom: 5px;
cursor: pointer; cursor: pointer;
display: flex;
margin-top: 5px;
background: var(--note-button);
border-radius: 8px;
border: var(--border-color) solid 1px;
width: calc(100% - 7px - 7px - 3.5px);
margin-left: 5px;
} }
.notesBar .newNote img { .notesBar .newNote img {
height: 32px; height: 32px;
padding-right: 5px; padding-right: 5px;
transform: translateY(30%);
} }
.noteBox { .noteBox {
@ -518,8 +520,7 @@ iframe#markdown {
.optionsDiv .section { .optionsDiv .section {
width: 100%; width: 100%;
height: 1px; border-top: var(--border-color) solid 1px;
background-color: var(--border-color);
margin-top: 2px; margin-top: 2px;
margin-bottom: 10px; margin-bottom: 10px;
} }
@ -530,21 +531,19 @@ iframe#markdown {
} }
.sessionDiv div { .sessionDiv div {
position: relative;
background-color: var(--session-color); background-color: var(--session-color);
border-radius: 8px; border-radius: 8px;
margin-bottom: 5px; margin-bottom: 5px;
padding: 10px; padding: 10px;
height: 35px; padding-bottom: 0px;
display: flex; display: flex;
overflow-y: scroll;
} }
.sessionDiv div p { .sessionDiv div p {
display: inline; display: inline;
transform: translateY(-20px);
overflow-wrap: anywhere; overflow-wrap: anywhere;
margin-left: 10px; margin: 10px;
margin-top: 0px;
} }
.sessionDiv div button { .sessionDiv div button {
@ -561,8 +560,9 @@ iframe#markdown {
.sessionDiv img { .sessionDiv img {
display: inline; display: inline;
filter: none; filter: none;
height: 100%; height: 35px;
position: static; position: static;
margin-right: 5px;
} }
/* Sign up/log in div */ /* Sign up/log in div */
@ -630,6 +630,12 @@ iframe#markdown {
display: none !important; display: none !important;
} }
.vcenter {
display: flex;
flex-direction: column;
justify-content: center;
}
.w100 { .w100 {
font-weight: 300; font-weight: 300;
} }

View File

@ -184,6 +184,42 @@ function updateFont() {
} }
} }
async function checknetwork() {
fetch(remote + "/api/loggedin", {
method: "POST",
body: JSON.stringify({
secretKey: localStorage.getItem("DONOTSHARE-secretkey"),
}),
headers: {
"Content-Type": "application/json; charset=UTF-8"
}
})
.catch(() => {
noteBox.readOnly = true
noteBox.value = ""
noteBox.placeholder = "You are currently offline."
displayError("Failed to connect to the server.\nPlease check your internet connection.")
})
.then((response) => response)
.then((response) => {
if (response.status == 400) {
displayError("Something went wrong! Signing you out...")
closeErrorButton.classList.add("hidden")
usernameBox.innerText = ""
setTimeout(function () {
window.location.replace("/logout")
}, 2500);
} else if (response.status == 200) {
updateUserInfo()
} else {
noteBox.readOnly = true
noteBox.value = ""
noteBox.placeholder = "You are currently offline."
displayError("Failed to connect to the server.\nPlease check your internet connection.")
}
});
}
async function waitforedit() { async function waitforedit() {
while(true) { while(true) {
await fetch(remote + "/api/waitforedit", { await fetch(remote + "/api/waitforedit", {
@ -244,16 +280,11 @@ function updateUserInfo() {
headers: { headers: {
"Content-Type": "application/json; charset=UTF-8" "Content-Type": "application/json; charset=UTF-8"
} }
})
.catch(() => {
noteBox.readOnly = true
noteBox.value = ""
noteBox.placeholder = "Failed to connect to the server.\nPlease check your internet connection."
}) })
.then((response) => { .then((response) => {
async function doStuff() { async function doStuff() {
if (response.status === 500) { if (response.status === 500) {
displayError("Something went wrong! Signing you out..") displayError("Something went wrong! Signing you out...")
closeErrorButton.classList.add("hidden") closeErrorButton.classList.add("hidden")
usernameBox.innerText = "" usernameBox.innerText = ""
setTimeout(function () { setTimeout(function () {
@ -392,8 +423,6 @@ exitSessionsThing.addEventListener("click", () => {
sessionManagerDiv.classList.add("hidden") sessionManagerDiv.classList.add("hidden")
}); });
updateUserInfo()
function updateWordCount() { function updateWordCount() {
let wordCount = noteBox.value.split(" ").length let wordCount = noteBox.value.split(" ").length
if (wordCount === 1) { if (wordCount === 1) {
@ -730,7 +759,8 @@ document.addEventListener("DOMContentLoaded", function() {
}); });
if (firstNewVersion()) { if (firstNewVersion()) {
displayError("What's new in Burgernotes 1.2-1?\nNotes now support live editing\nFixed various bugs and issues in the client") displayError("What's new in Burgernotes 2.0?\nRestyled client\nAdded changing passwords\nMigrated to OAuth2\nAdded importing notes")
} }
//waitforedit() checknetwork()
waitforedit()