Compare commits
No commits in common. "2c106e4dbb580cfda9c1ebc7bcfca9a3e882e177" and "0c0f265667e6a899989e40f706744b467e7472ae" have entirely different histories.
2c106e4dbb
...
0c0f265667
5 changed files with 19 additions and 66 deletions
|
@ -1,7 +1,7 @@
|
||||||
# Burgernotes API docs
|
# Burgernotes API docs
|
||||||
Use the Burgernotes API to automate tasks, build your own client, and more!
|
Use the Burgernotes API to automate tasks, build your own client, and more!
|
||||||
|
|
||||||
Headers should be: "Content-type: application/json; charset=UTF-8" for all POSTs
|
Content-type should be "application/json" for all POSTs
|
||||||
|
|
||||||
## Authentication
|
## Authentication
|
||||||
|
|
||||||
|
|
9
main
9
main
|
@ -97,29 +97,25 @@ def check_username_taken(username):
|
||||||
return post["id"]
|
return post["id"]
|
||||||
|
|
||||||
# Main page
|
# Main page
|
||||||
@app.route("/index.html")
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
async def main():
|
async def main():
|
||||||
return await render_template("main.html")
|
return await render_template("main.html")
|
||||||
|
|
||||||
# Web app
|
# Web app
|
||||||
@app.route("/app/index.html")
|
|
||||||
@app.route("/app")
|
@app.route("/app")
|
||||||
async def webapp():
|
async def webapp():
|
||||||
return await render_template("app.html")
|
return await render_template("app.html")
|
||||||
|
|
||||||
# Login and signup
|
# Login and signup
|
||||||
@app.route("/signup/index.html")
|
|
||||||
@app.route("/signup")
|
@app.route("/signup")
|
||||||
async def signup():
|
async def signup():
|
||||||
return await render_template("signup.html")
|
return await render_template("signup.html")
|
||||||
|
|
||||||
@app.route("/login/index.html")
|
@app.route("/login")
|
||||||
async def login():
|
async def login():
|
||||||
return await render_template("login.html")
|
return await render_template("login.html")
|
||||||
|
|
||||||
# Privacy policy
|
# Privacy policy
|
||||||
@app.route("/privacy/index.html")
|
|
||||||
@app.route("/privacy")
|
@app.route("/privacy")
|
||||||
async def privacy():
|
async def privacy():
|
||||||
return await render_template("privacy.html")
|
return await render_template("privacy.html")
|
||||||
|
@ -504,8 +500,7 @@ def listusers(secretkey):
|
||||||
else:
|
else:
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
@app.route("/logout/index.html")
|
@app.route("/api/logout")
|
||||||
@app.route("/logout")
|
|
||||||
async def apilogout():
|
async def apilogout():
|
||||||
return await render_template("logout.html")
|
return await render_template("logout.html")
|
||||||
|
|
||||||
|
|
|
@ -116,10 +116,7 @@ signupButton.addEventListener("click", (event) => {
|
||||||
password: await hashpass(password),
|
password: await hashpass(password),
|
||||||
passwordchange: "no",
|
passwordchange: "no",
|
||||||
newpass: "null"
|
newpass: "null"
|
||||||
}),
|
})
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then((response) => response)
|
.then((response) => response)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -140,10 +137,7 @@ signupButton.addEventListener("click", (event) => {
|
||||||
password: await hashpassold(password),
|
password: await hashpassold(password),
|
||||||
passwordchange: "yes",
|
passwordchange: "yes",
|
||||||
newpass: await hashpass(password)
|
newpass: await hashpass(password)
|
||||||
}),
|
})
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then((response) => response)
|
.then((response) => response)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|
|
@ -201,10 +201,7 @@ function updateUserInfo() {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
secretKey: secretkey
|
secretKey: secretkey
|
||||||
}),
|
})
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then((response) => response)
|
.then((response) => response)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -214,7 +211,7 @@ function updateUserInfo() {
|
||||||
closeErrorButton.classList.add("hidden")
|
closeErrorButton.classList.add("hidden")
|
||||||
usernameBox.innerText = ""
|
usernameBox.innerText = ""
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
window.location.replace("../logout/index.html")
|
window.location.replace("https://notes.hectabit.org/api/logout")
|
||||||
}, 2500);
|
}, 2500);
|
||||||
} else {
|
} else {
|
||||||
let responseData = await response.json()
|
let responseData = await response.json()
|
||||||
|
@ -236,7 +233,7 @@ usernameBox.addEventListener("click", (event) => {
|
||||||
updateUserInfo()
|
updateUserInfo()
|
||||||
});
|
});
|
||||||
logOutButton.addEventListener("click", (event) => {
|
logOutButton.addEventListener("click", (event) => {
|
||||||
window.location.replace("/logout/index.html")
|
window.location.replace("https://notes.hectabit.org/api/logout")
|
||||||
});
|
});
|
||||||
exitThing.addEventListener("click", (event) => {
|
exitThing.addEventListener("click", (event) => {
|
||||||
optionsDiv.classList.add("hidden")
|
optionsDiv.classList.add("hidden")
|
||||||
|
@ -248,10 +245,7 @@ deleteMyAccountButton.addEventListener("click", (event) => {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
secretKey: secretkey
|
secretKey: secretkey
|
||||||
}),
|
})
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then((response) => response)
|
.then((response) => response)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -271,10 +265,7 @@ sessionManagerButton.addEventListener("click", (event) => {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
secretKey: secretkey
|
secretKey: secretkey
|
||||||
}),
|
})
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then((response) => response)
|
.then((response) => response)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -312,10 +303,7 @@ sessionManagerButton.addEventListener("click", (event) => {
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
secretKey: secretkey,
|
secretKey: secretkey,
|
||||||
sessionId: responseData[i]["id"]
|
sessionId: responseData[i]["id"]
|
||||||
}),
|
})
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then((response) => response)
|
.then((response) => response)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -363,10 +351,7 @@ function selectNote(nameithink) {
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
secretKey: secretkey,
|
secretKey: secretkey,
|
||||||
noteId: nameithink,
|
noteId: nameithink,
|
||||||
}),
|
})
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
noteBox.readOnly = true
|
noteBox.readOnly = true
|
||||||
|
@ -402,10 +387,7 @@ function selectNote(nameithink) {
|
||||||
secretKey: secretkey,
|
secretKey: secretkey,
|
||||||
noteId: nameithink,
|
noteId: nameithink,
|
||||||
content: encryptedText,
|
content: encryptedText,
|
||||||
}),
|
})
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then((response) => response)
|
.then((response) => response)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -429,10 +411,7 @@ function updateNotes() {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
secretKey: secretkey
|
secretKey: secretkey
|
||||||
}),
|
})
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then((response) => response)
|
.then((response) => response)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -464,10 +443,7 @@ function updateNotes() {
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
secretKey: secretkey,
|
secretKey: secretkey,
|
||||||
noteId: responseData[i]["id"]
|
noteId: responseData[i]["id"]
|
||||||
}),
|
})
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then((response) => response)
|
.then((response) => response)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -504,10 +480,7 @@ newNote.addEventListener("click", (event) => {
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
secretKey: secretkey,
|
secretKey: secretkey,
|
||||||
noteName: encryptedName,
|
noteName: encryptedName,
|
||||||
}),
|
})
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
displayError("Failed to create new note, please try again later...")
|
displayError("Failed to create new note, please try again later...")
|
||||||
|
@ -539,10 +512,7 @@ function exportNotes() {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
secretKey: secretkey
|
secretKey: secretkey
|
||||||
}),
|
})
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then((response) => response)
|
.then((response) => response)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -599,10 +569,7 @@ removeBox.addEventListener("click", (event) => {
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
secretKey: secretkey,
|
secretKey: secretkey,
|
||||||
noteId: selectedNote
|
noteId: selectedNote
|
||||||
}),
|
})
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then((response) => response)
|
.then((response) => response)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|
|
@ -66,10 +66,7 @@ signupButton.addEventListener("click", (event) => {
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
username: username,
|
username: username,
|
||||||
password: await hashpass(password)
|
password: await hashpass(password)
|
||||||
}),
|
})
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json; charset=UTF-8"
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.then((response) => response)
|
.then((response) => response)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue