Change login from http basic auth to cookies

This commit is contained in:
Yukino Song
2024-08-30 06:17:02 +08:00
parent c0e65632f6
commit 652661ea50
11 changed files with 289 additions and 109 deletions

View File

@@ -407,14 +407,18 @@
};
},
created() {
fetch("/api/apps")
fetch("/api/apps", {
credentials: 'include'
})
.then((r) => r.json())
.then((r) => {
console.log(r);
this.apps = r.apps;
});
fetch("/api/config")
fetch("/api/config", {
credentials: 'include'
})
.then(r => r.json())
.then(r => this.platform = r.platform);
},
@@ -473,7 +477,10 @@
"Are you sure to delete " + this.apps[id].name + "?"
);
if (resp) {
fetch("/api/apps/" + id, { method: "DELETE" }).then((r) => {
fetch("/api/apps/" + id, {
credentials: 'include',
method: "DELETE"
}).then((r) => {
if (r.status == 200) document.location.reload();
});
}
@@ -569,6 +576,7 @@
useCover(cover) {
this.coverFinderBusy = true;
fetch("/api/covers/upload", {
credentials: 'include',
method: "POST",
body: JSON.stringify({
key: cover.key,
@@ -584,6 +592,7 @@
save() {
this.editForm["image-path"] = this.editForm["image-path"].toString().replace(/"/g, '');
fetch("/api/apps", {
credentials: 'include',
method: "POST",
body: JSON.stringify(this.editForm),
}).then((r) => {