From 632e4572750e425eb0a3c8e9882efb6319fae489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=AB=E8=B0=B7=E5=89=91=E4=BB=99?= Date: Mon, 20 May 2024 02:14:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=88=B0sanbon=E9=98=9F?= =?UTF-8?q?=E4=BC=8D=E4=B8=8A=E4=BC=A0API=20v2=EF=BC=8C=E5=B9=B6=E4=B8=94?= =?UTF-8?q?=E5=AE=83=E5=8A=A0=E5=85=A5=E4=BA=86=E5=9F=9F=E9=99=90=E5=88=B6?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script.js | 18 +++++++++++------- service-worker.js | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/script.js b/script.js index 6c3a5116..cc4cca45 100644 --- a/script.js +++ b/script.js @@ -1409,7 +1409,7 @@ const scriptLines = [`(()=>{ const _m = { num: m.id, level: m.level, - superAwoken: m.sawoken, + superAwoken: m.sawoken ?? 0, latentAwokens: m.latent.concat(), awokenCount: m.awoken, hpPlus: m.plus[0], @@ -1455,12 +1455,13 @@ Formation.prototype.getSanbonQrObj = function() //sanbon目前只支持单人队伍 const [members,assists,badge] = this.teams[0]; const obj = { - title: this.title, - content: this.detail, - mons: assists.map(m=>m.id).concat(members.map(m=>m.id)), + region: sanbonTranslateRegion(currentDataSource.code), + title: this.title ?? "", + content: this.detail ?? "", + //mons: assists.map(m=>m.id).concat(members.map(m=>m.id)), data: { badge: (badge || 1) & 0x7f, - members: {}, + members: {}, //等待下面处理 }, }; for (let i = 0; i < members.length; i++) { @@ -1468,7 +1469,7 @@ Formation.prototype.getSanbonQrObj = function() const _m = { num: m.id, level: m.level, - superAwoken: m.sawoken, + superAwoken: m.sawoken ?? 0, latentAwokens: m.latent.concat(), awokenCount: m.awoken, hpPlus: m.plus[0], @@ -3358,14 +3359,17 @@ function initialize() { let postBody = JSON.stringify(obj); const options = { method: "POST", - url: `https://sanbon.me/api/${sanbonTranslateRegion(currentDataSource.code)}/upload-team`, + url: `https://sanbon.me/api/upload-team-v2`, data: postBody, headers: { + "Origin": "https://sanbon.me", + "Referer": `https://sanbon.me/${sanbonTranslateRegion(currentDataSource.code)}/team-builder/upload`, "Content-Type": "application/json", //如果只有ascii字符可以用postBody.length "Content-Length": new Blob([postBody], {type: "application/json"}).size, } }; + console.log(options); const response = await btnExternalSupport.asyncGM_xmlhttpRequest(options); if (response.status === 401) { alert(localTranslating.link_read_message.paddb_unauthorized); diff --git a/service-worker.js b/service-worker.js index bd43652f..9a858619 100644 --- a/service-worker.js +++ b/service-worker.js @@ -26263,7 +26263,7 @@ const cachesMap = new Map([ ], [ "script.js", - "8d7a86d95fabbf5de1883c3188449241" + "858116500c62bbd4eae0658cacde160c" ], [ "solo.html",