Validate application/json on server side

This commit is contained in:
Yukino Song
2025-05-28 18:01:48 +08:00
parent f3d2078b11
commit a3e0318794
3 changed files with 124 additions and 72 deletions

View File

@@ -637,9 +637,13 @@
launchApp(app) {
if (confirm(this.$t('apps.launch_warning'))) {
this.actionDisabled = true;
fetch("./api/apps/launch?uuid=" + app.uuid, {
fetch("./api/apps/launch", {
credentials: 'include',
headers: {
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify({ uuid: app.uuid })
})
.then(r => r.json())
.then(r => {
@@ -682,9 +686,13 @@
);
if (resp) {
this.actionDisabled = true;
fetch("./api/apps/delete?uuid=" + app.uuid, {
fetch("./api/apps/delete", {
credentials: 'include',
method: 'POST'
headers: {
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify({ uuid: app.uuid })
}).then((r) => r.json())
.then((r) => {
if (!r.status) {

View File

@@ -421,8 +421,13 @@
requestOTP() {
if (this.editingHost) return;
fetch(`./api/otp?passphrase=${this.passphrase}${this.deviceName && `&deviceName=${this.deviceName}` || ''}`, {
credentials: 'include'
fetch("./api/otp", {
credentials: 'include',
headers: {
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify({ passphrase: this.passphrase, deviceName: this.deviceName })
})
.then(resp => resp.json())
.then(resp => {