Made client version 2.0-serverside compliant and fix some various CSS issues
This commit is contained in:
parent
45132b693c
commit
89884a690c
|
@ -139,10 +139,7 @@ h6 {
|
||||||
h7 {
|
h7 {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
margin-top: 0.67em;
|
margin: 0.67em 0;
|
||||||
margin-bottom: 0.67em;
|
|
||||||
margin-left: 0;
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
@ -235,7 +232,6 @@ body {
|
||||||
line-height: 41px;
|
line-height: 41px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
cursor: pointer;
|
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
background-color: rgba(0, 0, 0, 0);
|
background-color: rgba(0, 0, 0, 0);
|
||||||
border-radius: 99px;
|
border-radius: 99px;
|
||||||
|
@ -260,7 +256,6 @@ body {
|
||||||
line-height: 41px;
|
line-height: 41px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
cursor: pointer;
|
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
background-color: rgba(0, 0, 0, 0);
|
background-color: rgba(0, 0, 0, 0);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
@ -300,8 +295,7 @@ body {
|
||||||
min-height: 35px;
|
min-height: 35px;
|
||||||
line-height: 0;
|
line-height: 0;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
margin: 5px;
|
margin: 5px 5px 0;
|
||||||
margin-bottom: 0;
|
|
||||||
background-color: var(--bar);
|
background-color: var(--bar);
|
||||||
color: var(--unselected-note-button-text-color);
|
color: var(--unselected-note-button-text-color);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
|
@ -400,8 +394,7 @@ body {
|
||||||
|
|
||||||
.noteBox.mobile {
|
.noteBox.mobile {
|
||||||
flex-direction: column-reverse;
|
flex-direction: column-reverse;
|
||||||
margin: 0;
|
margin: 15px 0 0;
|
||||||
margin-top: 15px;
|
|
||||||
height: calc(100% - 50px);
|
height: calc(100% - 50px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,9 +489,7 @@ iframe#markdown {
|
||||||
|
|
||||||
.optionsDiv .mfacheckbox {
|
.optionsDiv .mfacheckbox {
|
||||||
display: inline;
|
display: inline;
|
||||||
margin: 0;
|
margin: 0 0 12px 5px;
|
||||||
margin-left: 5px;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
height: 17px;
|
height: 17px;
|
||||||
width: 17px;
|
width: 17px;
|
||||||
|
@ -569,7 +560,7 @@ iframe#markdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
.optionsDiv .fontManipulator button {
|
.optionsDiv .fontManipulator button {
|
||||||
width: 43.5px;
|
width: 44px;
|
||||||
background-color: var(--nonimporant-theme-color);
|
background-color: var(--nonimporant-theme-color);
|
||||||
color: var(--nonimportant-text-color);
|
color: var(--nonimportant-text-color);
|
||||||
transition: 0.125s;
|
transition: 0.125s;
|
||||||
|
@ -598,16 +589,14 @@ iframe#markdown {
|
||||||
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 10px 0;
|
||||||
padding-bottom: 0;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sessionDiv div p {
|
.sessionDiv div p {
|
||||||
display: inline;
|
display: inline;
|
||||||
overflow-wrap: anywhere;
|
overflow-wrap: anywhere;
|
||||||
margin: 10px;
|
margin: 0 10px 10px;
|
||||||
margin-top: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sessionDiv div button {
|
.sessionDiv div button {
|
||||||
|
@ -660,8 +649,6 @@ iframe#markdown {
|
||||||
border-color: var(--border-color);
|
border-color: var(--border-color);
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
|
|
||||||
outline: 0.125s
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.inoutdiv input:focus {
|
.inoutdiv input:focus {
|
||||||
|
@ -672,10 +659,8 @@ iframe#markdown {
|
||||||
.inoutdiv button {
|
.inoutdiv button {
|
||||||
background-color: var(--theme-color);
|
background-color: var(--theme-color);
|
||||||
color: white;
|
color: white;
|
||||||
padding: 10px;
|
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
padding-left: 20px;
|
padding: 10px 20px;
|
||||||
padding-right: 20px;
|
|
||||||
|
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 25px;
|
border-radius: 25px;
|
||||||
|
@ -866,7 +851,7 @@ iframe#markdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
.downloadDiv p {
|
.downloadDiv p {
|
||||||
margin: 0px;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.downloadDiv a {
|
.downloadDiv a {
|
||||||
|
@ -874,9 +859,7 @@ iframe#markdown {
|
||||||
}
|
}
|
||||||
|
|
||||||
.mainDiv a {
|
.mainDiv a {
|
||||||
padding: 15px;
|
padding: 15px 20px;
|
||||||
padding-left: 20px;
|
|
||||||
padding-right: 20px;
|
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
color: white;
|
color: white;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
@ -906,15 +889,11 @@ iframe#markdown {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
margin-left: 12vh;
|
margin-left: 12vh;
|
||||||
margin-right: 12vh;
|
margin-right: 12vh;
|
||||||
padding-left: 10px;
|
|
||||||
padding-right: 10px;
|
|
||||||
|
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
|
|
||||||
padding-top: 15px;
|
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
padding-bottom: 30px;
|
padding: 15px 10px 30px;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -944,8 +923,7 @@ iframe#markdown {
|
||||||
background-color: #f8f8f8;
|
background-color: #f8f8f8;
|
||||||
}
|
}
|
||||||
.mainDiv .feature h1 {
|
.mainDiv .feature h1 {
|
||||||
margin: 0;
|
margin: 10px 0 0;
|
||||||
margin-top: 10px;
|
|
||||||
font-family: "Space Grotesk", sans-serif;
|
font-family: "Space Grotesk", sans-serif;
|
||||||
font-optical-sizing: auto;
|
font-optical-sizing: auto;
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
|
@ -966,8 +944,7 @@ iframe#markdown {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
background-color: var(--bar);
|
background-color: var(--bar);
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
padding: 10px;
|
padding: 3px 10px 10px;
|
||||||
padding-top: 2.5px;
|
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
transition: background-color .2s;
|
transition: background-color .2s;
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0
|
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0
|
||||||
|
|
||||||
if (localStorage.getItem("DONOTSHARE-secretkey") !== null) {
|
if (localStorage.getItem("DONOTSHARE-secretkey") !== null || localStorage.getItem("DONOTSHARE-password") !== null) {
|
||||||
window.location.replace("/app/")
|
|
||||||
document.body.innerHTML = "Redirecting..."
|
|
||||||
throw new Error();
|
|
||||||
}
|
|
||||||
if (localStorage.getItem("DONOTSHARE-password") !== null) {
|
|
||||||
window.location.replace("/app/")
|
window.location.replace("/app/")
|
||||||
document.body.innerHTML = "Redirecting..."
|
document.body.innerHTML = "Redirecting..."
|
||||||
throw new Error();
|
throw new Error();
|
||||||
|
@ -25,6 +20,68 @@ let inputNameBox = document.getElementById("inputNameBox")
|
||||||
let backButton = document.getElementById("backButton")
|
let backButton = document.getElementById("backButton")
|
||||||
let opButton = document.getElementById("opButton")
|
let opButton = document.getElementById("opButton")
|
||||||
|
|
||||||
|
async function loginFetch(username, password) {
|
||||||
|
return await fetch(remote + "/api/login", {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({
|
||||||
|
username: username,
|
||||||
|
password: password,
|
||||||
|
}),
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json; charset=UTF-8",
|
||||||
|
"X-Burgernotes-Version": "200"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function addLegacyPassword(secretKey, password) {
|
||||||
|
return await fetch(remote + "/api/v2/addlegacypassword", {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({
|
||||||
|
secretKey: secretKey,
|
||||||
|
legacyPassword: password,
|
||||||
|
}),
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json; charset=UTF-8",
|
||||||
|
"X-Burgernotes-Version": "200"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function migrateLegacyPassword(secretKey, password) {
|
||||||
|
return await fetch(remote + "/api/changepassword", {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({
|
||||||
|
secretKey: secretKey,
|
||||||
|
newPassword: password,
|
||||||
|
}),
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json; charset=UTF-8",
|
||||||
|
"X-Burgernotes-Version": "200"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function hashpassold(pass) {
|
||||||
|
return await hashwasm.argon2id({
|
||||||
|
password: pass,
|
||||||
|
salt: await hashwasm.sha512(pass),
|
||||||
|
parallelism: 1,
|
||||||
|
iterations: 256,
|
||||||
|
memorySize: 512,
|
||||||
|
hashLength: 32,
|
||||||
|
outputType: "encoded"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function hashpass(pass) {
|
||||||
|
let key = pass
|
||||||
|
for (let i = 0; i < 128; i++) {
|
||||||
|
key = await hashwasm.sha3(key)
|
||||||
|
}
|
||||||
|
return key
|
||||||
|
}
|
||||||
|
|
||||||
usernameBox.classList.remove("hidden")
|
usernameBox.classList.remove("hidden")
|
||||||
inputNameBox.innerText = "Username:"
|
inputNameBox.innerText = "Username:"
|
||||||
|
|
||||||
|
@ -37,7 +94,7 @@ function showInput(inputType) {
|
||||||
backButton.classList.add("hidden")
|
backButton.classList.add("hidden")
|
||||||
opButton.classList.remove("hidden")
|
opButton.classList.remove("hidden")
|
||||||
inputNameBox.innerText = "Username:"
|
inputNameBox.innerText = "Username:"
|
||||||
statusBox.innerText = "Use your Burgernotes account"
|
statusBox.innerText = "Sign in with your Burgernotes account"
|
||||||
currentInputType = 0
|
currentInputType = 0
|
||||||
} else if (inputType === 1) {
|
} else if (inputType === 1) {
|
||||||
usernameBox.classList.add("hidden")
|
usernameBox.classList.add("hidden")
|
||||||
|
@ -108,94 +165,38 @@ signupButton.addEventListener("click", () => {
|
||||||
showElements(true)
|
showElements(true)
|
||||||
statusBox.innerText = "Signing in..."
|
statusBox.innerText = "Signing in..."
|
||||||
|
|
||||||
async function hashpassold(pass) {
|
const login = await loginFetch(username, await hashpass(password))
|
||||||
return await hashwasm.argon2id({
|
const loginData = await login.json()
|
||||||
password: pass,
|
if (login.status === 401) {
|
||||||
salt: await hashwasm.sha512(pass),
|
// Trying hashpassold
|
||||||
parallelism: 1,
|
const loginOld = await loginFetch(username, await hashpassold(password))
|
||||||
iterations: 256,
|
const loginDataOld = await loginOld.json()
|
||||||
memorySize: 512,
|
if (loginOld.status === 401) {
|
||||||
hashLength: 32,
|
statusBox.innerText = "Username or password incorrect!"
|
||||||
outputType: "encoded"
|
showInput(1)
|
||||||
})
|
} else if (loginOld.status === 200) {
|
||||||
}
|
localStorage.setItem("DONOTSHARE-secretkey", loginDataOld["key"])
|
||||||
|
|
||||||
async function hashpass(pass) {
|
|
||||||
let key = pass
|
|
||||||
for (let i = 0; i < 128; i++) {
|
|
||||||
key = await hashwasm.sha3(key)
|
|
||||||
}
|
|
||||||
return key
|
|
||||||
}
|
|
||||||
|
|
||||||
fetch(remote + "/api/login", {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify({
|
|
||||||
username: username,
|
|
||||||
password: await hashpass(password),
|
|
||||||
passwordchange: "no",
|
|
||||||
newpass: "null"
|
|
||||||
}),
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then((response) => response)
|
|
||||||
.then((response) => {
|
|
||||||
async function doStuff() {
|
|
||||||
let responseData = await response.json()
|
|
||||||
if (response.status === 200) {
|
|
||||||
localStorage.setItem("DONOTSHARE-secretkey", responseData["key"])
|
|
||||||
localStorage.setItem("DONOTSHARE-password", await hashwasm.sha512(password))
|
localStorage.setItem("DONOTSHARE-password", await hashwasm.sha512(password))
|
||||||
|
if (loginDataOld["legacyPasswordNeeded"] === true) {
|
||||||
window.location.href = "/app/"
|
await addLegacyPassword(username, await hashpass(await hashpassold(password)))
|
||||||
}
|
}
|
||||||
else if (response.status === 401) {
|
await migrateLegacyPassword(loginDataOld["key"], await hashpass(password))
|
||||||
console.log("Trying oldhash")
|
window.location.replace("/app/")
|
||||||
fetch(remote + "/api/login", {
|
} else {
|
||||||
method: "POST",
|
statusBox.innerText = loginDataOld["error"]
|
||||||
body: JSON.stringify({
|
showInput(1)
|
||||||
username: username,
|
|
||||||
password: await hashpassold(password),
|
|
||||||
passwordchange: "yes",
|
|
||||||
newpass: await hashpass(password)
|
|
||||||
}),
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
}
|
}
|
||||||
})
|
} else if (login.status === 200) {
|
||||||
.then((response) => response)
|
localStorage.setItem("DONOTSHARE-secretkey", loginData["key"])
|
||||||
.then((response) => {
|
|
||||||
async function doStuff2() {
|
|
||||||
let responseData = await response.json()
|
|
||||||
if (response.status === 200) {
|
|
||||||
localStorage.setItem("DONOTSHARE-secretkey", responseData["key"])
|
|
||||||
localStorage.setItem("DONOTSHARE-password", await hashwasm.sha512(password))
|
localStorage.setItem("DONOTSHARE-password", await hashwasm.sha512(password))
|
||||||
|
if (loginData["legacyPasswordNeeded"] === true) {
|
||||||
window.location.href = "/app/"
|
await addLegacyPassword(username, await hashpass(await hashpassold(password)))
|
||||||
}
|
}
|
||||||
else if (response.status === 401) {
|
window.location.replace("/app/")
|
||||||
statusBox.innerText = "Wrong username or password..."
|
} else {
|
||||||
|
statusBox.innerText = loginData["error"]
|
||||||
showInput(1)
|
showInput(1)
|
||||||
showElements(true)
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
statusBox.innerText = "Something went wrong! (error code: " + response.status + ")"
|
|
||||||
showInput(1)
|
|
||||||
showElements(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
doStuff2()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
statusBox.innerText = "Something went wrong! (error code: " + response.status + ")"
|
|
||||||
showInput(1)
|
|
||||||
showElements(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
doStuff()
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
doStuff()
|
doStuff()
|
||||||
}
|
}
|
||||||
|
@ -207,4 +208,4 @@ backButton.addEventListener("click", () => {
|
||||||
|
|
||||||
showInput(0)
|
showInput(0)
|
||||||
|
|
||||||
// @license-end
|
// @license-endc
|
|
@ -1,11 +1,6 @@
|
||||||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0
|
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0
|
||||||
|
|
||||||
if (localStorage.getItem("DONOTSHARE-secretkey") !== null) {
|
if (localStorage.getItem("DONOTSHARE-secretkey") !== null || localStorage.getItem("DONOTSHARE-password") !== null) {
|
||||||
window.location.replace("/app/")
|
|
||||||
document.body.innerHTML = "Redirecting..."
|
|
||||||
throw new Error();
|
|
||||||
}
|
|
||||||
if (localStorage.getItem("DONOTSHARE-password") !== null) {
|
|
||||||
window.location.replace("/app/")
|
window.location.replace("/app/")
|
||||||
document.body.innerHTML = "Redirecting..."
|
document.body.innerHTML = "Redirecting..."
|
||||||
throw new Error();
|
throw new Error();
|
||||||
|
@ -23,6 +18,26 @@ let statusBox = document.getElementById("statusBox")
|
||||||
let signupButton = document.getElementById("signupButton")
|
let signupButton = document.getElementById("signupButton")
|
||||||
let opButton = document.getElementById("opButton")
|
let opButton = document.getElementById("opButton")
|
||||||
|
|
||||||
|
async function hashpassold(pass) {
|
||||||
|
return await hashwasm.argon2id({
|
||||||
|
password: pass,
|
||||||
|
salt: await hashwasm.sha512(pass),
|
||||||
|
parallelism: 1,
|
||||||
|
iterations: 256,
|
||||||
|
memorySize: 512,
|
||||||
|
hashLength: 32,
|
||||||
|
outputType: "encoded"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function hashpass(pass) {
|
||||||
|
let key = pass
|
||||||
|
for (let i = 0; i < 128; i++) {
|
||||||
|
key = await hashwasm.sha3(key)
|
||||||
|
}
|
||||||
|
return key
|
||||||
|
}
|
||||||
|
|
||||||
function showElements(yesorno) {
|
function showElements(yesorno) {
|
||||||
if (!yesorno) {
|
if (!yesorno) {
|
||||||
usernameBox.classList.add("hidden")
|
usernameBox.classList.add("hidden")
|
||||||
|
@ -71,23 +86,16 @@ signupButton.addEventListener("click", () => {
|
||||||
showElements(false)
|
showElements(false)
|
||||||
statusBox.innerText = "Creating account, please hold on..."
|
statusBox.innerText = "Creating account, please hold on..."
|
||||||
|
|
||||||
async function hashpass(pass) {
|
|
||||||
let key = pass
|
|
||||||
for (let i = 0; i < 128; i++) {
|
|
||||||
key = await hashwasm.sha3(key)
|
|
||||||
}
|
|
||||||
return key
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fetch(remote + "/api/signup", {
|
fetch(remote + "/api/signup", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
username: username,
|
username: username,
|
||||||
password: await hashpass(password)
|
password: await hashpass(password),
|
||||||
|
legacyPassword: await hashpass(await hashpassold(password))
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
"Content-Type": "application/json; charset=UTF-8",
|
||||||
|
"X-Burgernotes-Version": "200"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((response) => response)
|
.then((response) => response)
|
||||||
|
|
Reference in New Issue