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