Compare commits

...

2 Commits

3 changed files with 67 additions and 29 deletions

View File

@ -31,8 +31,10 @@
</div>
<div id="notesBar" class="notesBar">
<button id="newNote" class="newNote"><img id="newNoteImage" draggable="false" alt=""
src="/static/svg/add.svg">New note</button>
<button id="newNote" class="newNote">
<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">
<button class="loadingStuff" id="loadingStuff"></button>
</div>
@ -42,17 +44,17 @@
<div id="optionsDiv" class="optionsDiv hidden">
<button class="exit" id="exitThing">X</button>
<h3 class="w300">Your account</h3>
<p id="usernameThing"></p>
<p id="usernameThing">Cannot connect to the server</p>
<div class="section"></div>
<p>Storage</p>
<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>
<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="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>
</div>
<div id="sessionManagerDiv" class="optionsDiv hidden">

View File

@ -339,19 +339,21 @@ body {
.notesBar .newNote {
height: 41px;
line-height: 41px;
width: 100%;
text-align: left;
background-color: rgba(0, 0, 0, 0);
border: none;
font-size: 16px;
margin-bottom: 5px;
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 {
height: 32px;
padding-right: 5px;
transform: translateY(30%);
}
.noteBox {
@ -518,8 +520,7 @@ iframe#markdown {
.optionsDiv .section {
width: 100%;
height: 1px;
background-color: var(--border-color);
border-top: var(--border-color) solid 1px;
margin-top: 2px;
margin-bottom: 10px;
}
@ -530,21 +531,19 @@ iframe#markdown {
}
.sessionDiv div {
position: relative;
background-color: var(--session-color);
border-radius: 8px;
margin-bottom: 5px;
padding: 10px;
height: 35px;
padding-bottom: 0px;
display: flex;
overflow-y: scroll;
}
.sessionDiv div p {
display: inline;
transform: translateY(-20px);
overflow-wrap: anywhere;
margin-left: 10px;
margin: 10px;
margin-top: 0px;
}
.sessionDiv div button {
@ -561,8 +560,9 @@ iframe#markdown {
.sessionDiv img {
display: inline;
filter: none;
height: 100%;
height: 35px;
position: static;
margin-right: 5px;
}
/* Sign up/log in div */
@ -630,6 +630,12 @@ iframe#markdown {
display: none !important;
}
.vcenter {
display: flex;
flex-direction: column;
justify-content: center;
}
.w100 {
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() {
while(true) {
await fetch(remote + "/api/waitforedit", {
@ -244,16 +280,11 @@ function updateUserInfo() {
headers: {
"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) => {
async function doStuff() {
if (response.status === 500) {
displayError("Something went wrong! Signing you out..")
displayError("Something went wrong! Signing you out...")
closeErrorButton.classList.add("hidden")
usernameBox.innerText = ""
setTimeout(function () {
@ -392,8 +423,6 @@ exitSessionsThing.addEventListener("click", () => {
sessionManagerDiv.classList.add("hidden")
});
updateUserInfo()
function updateWordCount() {
let wordCount = noteBox.value.split(" ").length
if (wordCount === 1) {
@ -730,7 +759,8 @@ document.addEventListener("DOMContentLoaded", function() {
});
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()