From d6b64a679d195c0b89765fddeef0bf1883bb69d3 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sat, 22 Aug 2020 17:06:30 +0800 Subject: [PATCH 001/338] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs=20TF]:=20?= =?UTF-8?q?=E4=BE=A7=E6=A0=8F=E5=A2=9E=E5=8A=A0=E6=96=B0=E7=9A=84=E8=B4=A1?= =?UTF-8?q?=E7=8C=AE=E8=80=85=20@id77?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/chavy.boxjs.html | 40 ++++++++++++++++++--------------- box/chavy.boxjs.js | 6 ++--- box/release/box.release.tf.json | 14 ++++++++++++ 3 files changed, 39 insertions(+), 21 deletions(-) diff --git a/box/chavy.boxjs.html b/box/chavy.boxjs.html index 1c0884bd3..b9fc160d7 100644 --- a/box/chavy.boxjs.html +++ b/box/chavy.boxjs.html @@ -164,19 +164,19 @@ - - - - {{box.syscfgs.chavy.id}} - {{box.syscfgs.chavy.repo}} - - - - - - {{box.syscfgs.senku.id}} - {{box.syscfgs.senku.repo}} - + + + + + + + + + + + + + @@ -186,8 +186,8 @@ @@ -1248,6 +1248,7 @@

v{{ver.versio subview: null, bfsubview: null, // 数据类 + collaborators: [], contributors: [], isSaveUserCfgs: false, // 界面类 @@ -1831,7 +1832,7 @@

v{{ver.versio let bgimg = '' if (this.box.usercfgs.bgimg === '跟随系统') { const hasdark = this.bgimgs.find((bgimg) => bgimg.name == '暗黑' || bgimg.name == 'dark') - const haslight = this.bgimgs.find((bgimg) => bgimg.name == '明亮' || bgimg.name == 'light') + const haslight = this.bgimgs.find((bgimg) => bgimg.name == '明亮' || bgimg.name == 'light') const darkbgimg = hasdark ? hasdark.url : `` const lightbgimg = haslight ? haslight.url : `` this.isDarkMode ? (bgimg = darkbgimg) : (bgimg = lightbgimg) @@ -2247,9 +2248,12 @@

v{{ver.versio axios.get(url).then((resp) => { if (!resp) return resp.data.forEach((contributor) => { - if ([29748519, 39037656].includes(contributor.id)) return const { login: id, login, html_url: repo, avatar_url: icon } = contributor - this.ui.contributors.push({ id, login, repo, icon }) + if ([29748519, 39037656, 9592236].includes(contributor.id)) { + this.ui.collaborators.push({ id, login, repo, icon }) + } else { + this.ui.contributors.push({ id, login, repo, icon }) + } }) }) }, diff --git a/box/chavy.boxjs.js b/box/chavy.boxjs.js index 8be9cf186..bccea511c 100644 --- a/box/chavy.boxjs.js +++ b/box/chavy.boxjs.js @@ -3,7 +3,7 @@ const $ = new Env('BoxJs') // 为 eval 准备的上下文环境 const $eval_env = {} -$.version = '0.7.53' +$.version = '0.7.54' $.versionType = 'beta' /** @@ -278,10 +278,10 @@ function getSystemCfgs() { ], chavy: { id: 'ChavyLeung', icon: 'https://avatars3.githubusercontent.com/u/29748519', repo: 'https://github.com/chavyleung/scripts' }, senku: { id: 'GideonSenku', icon: 'https://avatars1.githubusercontent.com/u/39037656', repo: 'https://github.com/GideonSenku' }, + id77: { id: 'id77', icon: 'https://avatars0.githubusercontent.com/u/9592236', repo: 'https://github.com/id77' }, orz3: { id: 'Orz-3', icon: 'https://raw.githubusercontent.com/Orz-3/task/master/Orz-3.png', repo: 'https://github.com/Orz-3/' }, boxjs: { id: 'BoxJs', show: false, icon: 'https://raw.githubusercontent.com/Orz-3/task/master/box.png', icons: ['https://raw.githubusercontent.com/Orz-3/mini/master/box.png', 'https://raw.githubusercontent.com/Orz-3/task/master/box.png'], repo: 'https://github.com/chavyleung/scripts' }, - defaultIcons: ['https://raw.githubusercontent.com/Orz-3/mini/master/appstore.png', 'https://raw.githubusercontent.com/Orz-3/task/master/appstore.png'], - scontributors: [] + defaultIcons: ['https://raw.githubusercontent.com/Orz-3/mini/master/appstore.png', 'https://raw.githubusercontent.com/Orz-3/task/master/appstore.png'] } } diff --git a/box/release/box.release.tf.json b/box/release/box.release.tf.json index b9fe15a9a..0d1e192f3 100644 --- a/box/release/box.release.tf.json +++ b/box/release/box.release.tf.json @@ -1,5 +1,19 @@ { "releases": [ + { + "version": "0.7.54", + "tags": ["beta"], + "author": "@GideonSenku", + "icon": "https://avatars3.githubusercontent.com/u/29748519", + "repo": "https://github.com/chavyleung", + "msg": "更新[BoxJs TF]: 侧栏增加新的贡献者 @id77", + "notes": [ + { + "name": "贡献者", + "descs": ["新的贡献者 @id77"] + } + ] + }, { "version": "0.7.53", "tags": ["beta"], From 2ca8d40a93c93ea03c9d7b49d735a536039bf597 Mon Sep 17 00:00:00 2001 From: Chavy Date: Sat, 22 Aug 2020 19:22:40 +0800 Subject: [PATCH 002/338] =?UTF-8?q?=E6=9B=B4=E6=96=B0[BoxJs=20TF]:=20?= =?UTF-8?q?=E9=A1=B6=E6=A0=8F=E5=92=8C=E5=BA=95=E6=A0=8F=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=B7=9F=E9=9A=8F=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- box/chavy.boxjs.html | 94 +++++++++++++++++++++++++++------ box/chavy.boxjs.js | 2 +- box/release/box.release.tf.json | 14 ++++- 3 files changed, 92 insertions(+), 18 deletions(-) diff --git a/box/chavy.boxjs.html b/box/chavy.boxjs.html index b9fc160d7..f02d5db1e 100644 --- a/box/chavy.boxjs.html +++ b/box/chavy.boxjs.html @@ -93,7 +93,13 @@
- + - + - + mdi-delete-circle-outline diff --git a/box/chavy.boxjs.js b/box/chavy.boxjs.js index 8356a0448..1bd55591b 100644 --- a/box/chavy.boxjs.js +++ b/box/chavy.boxjs.js @@ -3,7 +3,7 @@ const $ = new Env('BoxJs') // 为 eval 准备的上下文环境 const $eval_env = {} -$.version = '0.19.23' +$.version = '0.19.24' $.versionType = 'beta' // 发出的请求需要需要 Surge、QuanX 的 rewrite diff --git a/box/release/box.release.json b/box/release/box.release.json index c7779b9a0..ebe96956e 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,17 @@ { "releases": [ + { + "version": "0.19.24", + "tags": ["beta"], + "author": "@id77", + "msg": "feat(boxjs): isEditFavApp 只在主页才显示", + "notes": [ + { + "name": "优化", + "descs": ["悬浮按钮的收藏编辑功能只在主页才显示"] + } + ] + }, { "version": "0.19.23", "tags": ["beta"], diff --git a/box/release/box.release.tf.json b/box/release/box.release.tf.json index 7fe43bc51..dbbf6410b 100644 --- a/box/release/box.release.tf.json +++ b/box/release/box.release.tf.json @@ -1,5 +1,17 @@ { "releases": [ + { + "version": "0.19.24", + "tags": ["beta"], + "author": "@id77", + "msg": "feat(boxjs): isEditFavApp 只在主页才显示", + "notes": [ + { + "name": "优化", + "descs": ["悬浮按钮的收藏编辑功能只在主页才显示"] + } + ] + }, { "version": "0.19.23", "tags": ["beta"], From c14f160dae0257a9ab62d4b55898885dbb5c123a Mon Sep 17 00:00:00 2001 From: id77 <9592236+id77@users.noreply.github.com> Date: Sat, 26 Apr 2025 17:19:32 +0800 Subject: [PATCH 336/338] =?UTF-8?q?feat(boxjs):=20=E4=BC=9A=E8=AF=9D?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E4=BB=85=E4=BD=BF=E7=94=A8=E5=92=8C=E5=85=B3?= =?UTF-8?q?=E8=81=94=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 仅使用会话数据,应用设置修改保存不更新原会话;关联使用会话数据,应用设置修改保存会更新原会话 --- box/chavy.boxjs.html | 66 ++++++++++++++++++++++++++------- box/chavy.boxjs.js | 2 +- box/release/box.release.json | 12 ++++++ box/release/box.release.tf.json | 12 ++++++ 4 files changed, 77 insertions(+), 15 deletions(-) diff --git a/box/chavy.boxjs.html b/box/chavy.boxjs.html index c6561ebe4..106c40bc5 100644 --- a/box/chavy.boxjs.html +++ b/box/chavy.boxjs.html @@ -1249,7 +1249,8 @@

{{curapp.name}}

{{dayjs(session.createTime).format('YYYY-MM-DD HH:mm:ss')}} - {{ $t('base.dialog.apply') }} + {{ $t('base.dialog.use') }} + {{ $t('base.dialog.link') }} @@ -1467,7 +1468,9 @@

v{{ver.versio save: 'Save', view: 'View', close: 'Close', - ok: 'OK' + ok: 'OK', + use: 'Use', + link: 'Link' }, sort: { up: 'Up', @@ -1630,7 +1633,9 @@

v{{ver.versio apply: '应用', save: '保存', close: '关闭', - ok: '好' + ok: '好', + use: '使用', + link: '关联' }, sort: { up: '上移', @@ -2840,20 +2845,53 @@

v{{ver.versio }, // 使用应用会话 useAppSession(sessionId) { - const sessions = this.box.sessions - const session = sessions.find((session) => session.id === sessionId) - this.box.curSessions[session.appId] = sessionId + const sessions = JSON.parse(JSON.stringify(this.box.sessions)); + const session = sessions.find( + (session) => session.id === sessionId + ); + + const datas = session.datas; + delete this.box.curSessions[session.appId]; + const key = 'chavy_boxjs_cur_sessions'; + const val = JSON.stringify({}); + datas.push({ key, val }); + + if (session) { + axios + .post(`/api/save?appid=${this.curapp.id}`, datas) + .then((resp) => { + if (this.curapp.id === 'BoxSetting') { + this.isSaveUserCfgs = false; + } else { + delete resp.data.usercfgs; + } + Object.assign(this.box, resp.data); + + if (this.curapp.id === 'BoxSetting') { + this.setHttpBackend(); + } + }); + } + }, + // 关联应用会话 + linkAppSession(sessionId) { + const sessions = JSON.parse(JSON.stringify(this.box.sessions)); + const session = sessions.find( + (session) => session.id === sessionId + ); - const key = 'chavy_boxjs_cur_sessions' - const val = JSON.stringify(this.box.curSessions) - const curSessions = [{ key, val }] - const datas = [...session.datas, ...curSessions] + const datas = session.datas; + // 记录当前应用正在使用的会话ID + this.box.curSessions[session.appId] = sessionId; + const key = 'chavy_boxjs_cur_sessions'; + const val = JSON.stringify(this.box.curSessions); + datas.push({ key, val }); - this.clearAppDatas() + // 发送单个合并请求,避免竞争条件 axios.post('/api/save', datas).then((resp) => { - delete resp.data.usercfgs - Object.assign(this.box, resp.data) - }) + delete resp.data.usercfgs; + Object.assign(this.box, resp.data); + }); }, // 复制应用数据为对象数据 copyData(curdata) { diff --git a/box/chavy.boxjs.js b/box/chavy.boxjs.js index 1bd55591b..44f9d6a08 100644 --- a/box/chavy.boxjs.js +++ b/box/chavy.boxjs.js @@ -3,7 +3,7 @@ const $ = new Env('BoxJs') // 为 eval 准备的上下文环境 const $eval_env = {} -$.version = '0.19.24' +$.version = '0.19.25' $.versionType = 'beta' // 发出的请求需要需要 Surge、QuanX 的 rewrite diff --git a/box/release/box.release.json b/box/release/box.release.json index ebe96956e..89156f133 100644 --- a/box/release/box.release.json +++ b/box/release/box.release.json @@ -1,5 +1,17 @@ { "releases": [ + { + "version": "0.19.25", + "tags": ["beta"], + "author": "@id77", + "msg": "feat(boxjs): 会话支持仅使用和关联使用", + "notes": [ + { + "name": "优化", + "descs": ["仅使用会话数据,应用设置修改保存不更新原会话;关联使用会话数据,应用设置修改保存会更新原会话"] + } + ] + }, { "version": "0.19.24", "tags": ["beta"], diff --git a/box/release/box.release.tf.json b/box/release/box.release.tf.json index dbbf6410b..6b8dbdf3a 100644 --- a/box/release/box.release.tf.json +++ b/box/release/box.release.tf.json @@ -1,5 +1,17 @@ { "releases": [ + { + "version": "0.19.25", + "tags": ["beta"], + "author": "@id77", + "msg": "feat(boxjs): 会话支持仅使用和关联使用", + "notes": [ + { + "name": "优化", + "descs": ["仅使用会话数据,应用设置修改保存不更新原会话;关联使用会话数据,应用设置修改保存会更新原会话"] + } + ] + }, { "version": "0.19.24", "tags": ["beta"], From 0cf9879a278b4e16dd57e13ecc8aa877f566cb83 Mon Sep 17 00:00:00 2001 From: MartinsKing <42362589+ClydeTime@users.noreply.github.com> Date: Wed, 7 May 2025 17:19:13 +0800 Subject: [PATCH 337/338] Fix: msg notification call exception (#511) --- Env.js | 25 ++++++++++++------------- Env.min.js | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Env.js b/Env.js index e3432a00b..d2ed4cbfd 100644 --- a/Env.js +++ b/Env.js @@ -676,19 +676,20 @@ function Env(name, opts) { Object.assign(options, { action: 'clipboard', text: copy }) } - if ($media) { - let mediaUrl = undefined + // 图片通知 + let mediaUrl = rawopts.mediaUrl || rawopts['media-url'] || $media + if (mediaUrl) { let media = undefined let mime = undefined // http 开头的网络地址 - if ($media.startsWith('http')) { - mediaUrl = $media + if (mediaUrl.startsWith('http')) { + //不做任何操作 } // 带标识的 Base64 字符串 // data:image/png;base64,iVBORw0KGgo... - else if ($media.startsWith('data:')) { - const [data] = $media.split(';') - const [, base64str] = $media.split(',') + else if (mediaUrl.startsWith('data:')) { + const [data] = mediaUrl.split(';') + const [, base64str] = mediaUrl.split(',') media = base64str mime = data.replace('data:', '') } @@ -711,8 +712,8 @@ function Env(name, opts) { } return null } - media = $media - mime = getMimeFromBase64($media) + media = mediaUrl + mime = getMimeFromBase64(mediaUrl) } Object.assign(options, { @@ -735,8 +736,7 @@ function Env(name, opts) { rawopts.openUrl || rawopts.url || rawopts['open-url'] || $open if (openUrl) Object.assign(options, { openUrl }) - let mediaUrl = rawopts.mediaUrl || rawopts['media-url'] - if ($media?.startsWith('http')) mediaUrl = $media + let mediaUrl = rawopts.mediaUrl || rawopts['media-url'] || $media if (mediaUrl) Object.assign(options, { mediaUrl }) console.log(JSON.stringify(options)) @@ -749,8 +749,7 @@ function Env(name, opts) { rawopts['open-url'] || rawopts.url || rawopts.openUrl || $open if (openUrl) Object.assign(options, { 'open-url': openUrl }) - let mediaUrl = rawopts['media-url'] || rawopts.mediaUrl - if ($media?.startsWith('http')) mediaUrl = $media + let mediaUrl = rawopts.mediaUrl || rawopts['media-url'] || $media if (mediaUrl) Object.assign(options, { 'media-url': mediaUrl }) let copy = diff --git a/Env.min.js b/Env.min.js index b64b5e469..0d0bc12f4 100644 --- a/Env.min.js +++ b/Env.min.js @@ -1 +1 @@ -function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;"POST"===e&&(s=this.post);const i=new Promise(((e,i)=>{s.call(this,t,((t,s,o)=>{t?i(t):e(s)}))}));return t.timeout?((t,e=1e3)=>Promise.race([t,new Promise(((t,s)=>{setTimeout((()=>{s(new Error("请求超时"))}),e)}))]))(i,t.timeout):i}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.logLevels={debug:0,info:1,warn:2,error:3},this.logLevelPrefixs={debug:"[DEBUG] ",info:"[INFO] ",warn:"[WARN] ",error:"[ERROR] "},this.logLevel="info",this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.encoding="utf-8",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}getEnv(){return"undefined"!=typeof $environment&&$environment["surge-version"]?"Surge":"undefined"!=typeof $environment&&$environment["stash-version"]?"Stash":"undefined"!=typeof module&&module.exports?"Node.js":"undefined"!=typeof $task?"Quantumult X":"undefined"!=typeof $loon?"Loon":"undefined"!=typeof $rocket?"Shadowrocket":void 0}isNode(){return"Node.js"===this.getEnv()}isQuanX(){return"Quantumult X"===this.getEnv()}isSurge(){return"Surge"===this.getEnv()}isLoon(){return"Loon"===this.getEnv()}isShadowrocket(){return"Shadowrocket"===this.getEnv()}isStash(){return"Stash"===this.getEnv()}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null,...s){try{return JSON.stringify(t,...s)}catch{return e}}getjson(t,e){let s=e;if(this.getdata(t))try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise((e=>{this.get({url:t},((t,s,i)=>e(i)))}))}runScript(t,e){return new Promise((s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let o=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");o=o?1*o:20,o=e&&e.timeout?e.timeout:o;const[r,a]=i.split("@"),n={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":r,Accept:"*/*"},policy:"DIRECT",timeout:o};this.post(n,((t,e,i)=>s(i)))})).catch((t=>this.logErr(t)))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),o=JSON.stringify(this.data);s?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(e,o):this.fs.writeFileSync(t,o)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return s;return o}lodash_set(t,e,s){return Object(t)!==t||(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce(((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{}),t)[e[e.length-1]]=s),t}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),o=s?this.getval(s):"";if(o)try{const t=JSON.parse(o);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(e),r=this.getval(i),a=i?"null"===r?null:r||"{}":"{}";try{const e=JSON.parse(a);this.lodash_set(e,o,t),s=this.setval(JSON.stringify(e),i)}catch(e){const r={};this.lodash_set(r,o,t),s=this.setval(JSON.stringify(r),i)}}else s=this.setval(t,e);return s}getval(t){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.read(t);case"Quantumult X":return $prefs.valueForKey(t);case"Node.js":return this.data=this.loaddata(),this.data[t];default:return this.data&&this.data[t]||null}}setval(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.write(t,e);case"Quantumult X":return $prefs.setValueForKey(t,e);case"Node.js":return this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0;default:return this.data&&this.data[e]||null}}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.cookie&&void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar)))}get(t,e=(()=>{})){switch(t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"],delete t.headers["content-type"],delete t.headers["content-length"]),t.params&&(t.url+="?"+this.queryStr(t.params)),void 0===t.followRedirect||t.followRedirect||((this.isSurge()||this.isLoon())&&(t["auto-redirect"]=!1),this.isQuanX()&&(t.opts?t.opts.redirection=!1:t.opts={redirection:!1})),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,((t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,i)}));break;case"Quantumult X":this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then((t=>{const{statusCode:s,statusCode:i,headers:o,body:r,bodyBytes:a}=t;e(null,{status:s,statusCode:i,headers:o,body:r,bodyBytes:a},r,a)}),(t=>e(t&&t.error||"UndefinedError")));break;case"Node.js":let s=require("iconv-lite");this.initGotEnv(t),this.got(t).on("redirect",((t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}})).then((t=>{const{statusCode:i,statusCode:o,headers:r,rawBody:a}=t,n=s.decode(a,this.encoding);e(null,{status:i,statusCode:o,headers:r,rawBody:a,body:n},n)}),(t=>{const{message:i,response:o}=t;e(i,o,o&&s.decode(o.rawBody,this.encoding))}));break}}post(t,e=(()=>{})){const s=t.method?t.method.toLocaleLowerCase():"post";switch(t.body&&t.headers&&!t.headers["Content-Type"]&&!t.headers["content-type"]&&(t.headers["content-type"]="application/x-www-form-urlencoded"),t.headers&&(delete t.headers["Content-Length"],delete t.headers["content-length"]),void 0===t.followRedirect||t.followRedirect||((this.isSurge()||this.isLoon())&&(t["auto-redirect"]=!1),this.isQuanX()&&(t.opts?t.opts.redirection=!1:t.opts={redirection:!1})),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient[s](t,((t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),e(t,s,i)}));break;case"Quantumult X":t.method=s,this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then((t=>{const{statusCode:s,statusCode:i,headers:o,body:r,bodyBytes:a}=t;e(null,{status:s,statusCode:i,headers:o,body:r,bodyBytes:a},r,a)}),(t=>e(t&&t.error||"UndefinedError")));break;case"Node.js":let i=require("iconv-lite");this.initGotEnv(t);const{url:o,...r}=t;this.got[s](o,r).then((t=>{const{statusCode:s,statusCode:o,headers:r,rawBody:a}=t,n=i.decode(a,this.encoding);e(null,{status:s,statusCode:o,headers:r,rawBody:a,body:n},n)}),(t=>{const{message:s,response:o}=t;e(s,o,o&&i.decode(o.rawBody,this.encoding))}));break}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}queryStr(t){let e="";for(const s in t){let i=t[s];null!=i&&""!==i&&("object"==typeof i&&(i=JSON.stringify(i)),e+=`${s}=${i}&`)}return e=e.substring(0,e.length-1),e}msg(e=t,s="",i="",o={}){const r=t=>{const{$open:e,$copy:s,$media:i,$mediaMime:o}=t;switch(typeof t){case void 0:return t;case"string":switch(this.getEnv()){case"Surge":case"Stash":default:return{url:t};case"Loon":case"Shadowrocket":return t;case"Quantumult X":return{"open-url":t};case"Node.js":return}case"object":switch(this.getEnv()){case"Surge":case"Stash":case"Shadowrocket":default:{const r={};let a=t.openUrl||t.url||t["open-url"]||e;a&&Object.assign(r,{action:"open-url",url:a});let n=t["update-pasteboard"]||t.updatePasteboard||s;if(n&&Object.assign(r,{action:"clipboard",text:n}),i){let t,e,s;if(i.startsWith("http"))t=i;else if(i.startsWith("data:")){const[t]=i.split(";"),[,o]=i.split(",");e=o,s=t.replace("data:","")}else{e=i,s=(t=>{const e={JVBERi0:"application/pdf",R0lGODdh:"image/gif",R0lGODlh:"image/gif",iVBORw0KGgo:"image/png","/9j/":"image/jpg"};for(var s in e)if(0===t.indexOf(s))return e[s];return null})(i)}Object.assign(r,{"media-url":t,"media-base64":e,"media-base64-mime":o??s})}return Object.assign(r,{"auto-dismiss":t["auto-dismiss"],sound:t.sound}),r}case"Loon":{const s={};let o=t.openUrl||t.url||t["open-url"]||e;o&&Object.assign(s,{openUrl:o});let r=t.mediaUrl||t["media-url"];return i?.startsWith("http")&&(r=i),r&&Object.assign(s,{mediaUrl:r}),console.log(JSON.stringify(s)),s}case"Quantumult X":{const o={};let r=t["open-url"]||t.url||t.openUrl||e;r&&Object.assign(o,{"open-url":r});let a=t["media-url"]||t.mediaUrl;i?.startsWith("http")&&(a=i),a&&Object.assign(o,{"media-url":a});let n=t["update-pasteboard"]||t.updatePasteboard||s;return n&&Object.assign(o,{"update-pasteboard":n}),console.log(JSON.stringify(o)),o}case"Node.js":return}default:return}};if(!this.isMute)switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:$notification.post(e,s,i,r(o));break;case"Quantumult X":$notify(e,s,i,r(o));break;case"Node.js":break}if(!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}debug(...t){this.logLevels[this.logLevel]<=this.logLevels.debug&&(t.length>0&&(this.logs=[...this.logs,...t]),console.log(`${this.logLevelPrefixs.debug}${t.map((t=>t??String(t))).join(this.logSeparator)}`))}info(...t){this.logLevels[this.logLevel]<=this.logLevels.info&&(t.length>0&&(this.logs=[...this.logs,...t]),console.log(`${this.logLevelPrefixs.info}${t.map((t=>t??String(t))).join(this.logSeparator)}`))}warn(...t){this.logLevels[this.logLevel]<=this.logLevels.warn&&(t.length>0&&(this.logs=[...this.logs,...t]),console.log(`${this.logLevelPrefixs.warn}${t.map((t=>t??String(t))).join(this.logSeparator)}`))}error(...t){this.logLevels[this.logLevel]<=this.logLevels.error&&(t.length>0&&(this.logs=[...this.logs,...t]),console.log(`${this.logLevelPrefixs.error}${t.map((t=>t??String(t))).join(this.logSeparator)}`))}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.map((t=>t??String(t))).join(this.logSeparator))}logErr(t,e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:this.log("",`❗️${this.name}, 错误!`,e,t);break;case"Node.js":this.log("",`❗️${this.name}, 错误!`,e,void 0!==t.message?t.message:t,t.stack);break}}wait(t){return new Promise((e=>setTimeout(e,t)))}done(t={}){const e=((new Date).getTime()-this.startTime)/1e3;switch(this.log("",`🔔${this.name}, 结束! 🕛 ${e} 秒`),this.log(),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:$done(t);break;case"Node.js":process.exit(1)}}}(t,e)} \ No newline at end of file +function Env(e,t){class s{constructor(e){this.env=e}send(e,t="GET"){e="string"==typeof e?{url:e}:e;let s=this.get;"POST"===t&&(s=this.post);const i=new Promise(((t,i)=>{s.call(this,e,((e,s,o)=>{e?i(e):t(s)}))}));return e.timeout?((e,t=1e3)=>Promise.race([e,new Promise(((e,s)=>{setTimeout((()=>{s(new Error("请求超时"))}),t)}))]))(i,e.timeout):i}get(e){return this.send.call(this.env,e)}post(e){return this.send.call(this.env,e,"POST")}}return new class{constructor(e,t){this.logLevels={debug:0,info:1,warn:2,error:3},this.logLevelPrefixs={debug:"[DEBUG] ",info:"[INFO] ",warn:"[WARN] ",error:"[ERROR] "},this.logLevel="info",this.name=e,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.encoding="utf-8",this.startTime=(new Date).getTime(),Object.assign(this,t),this.log("",`🔔${this.name}, 开始!`)}getEnv(){return"undefined"!=typeof $environment&&$environment["surge-version"]?"Surge":"undefined"!=typeof $environment&&$environment["stash-version"]?"Stash":"undefined"!=typeof module&&module.exports?"Node.js":"undefined"!=typeof $task?"Quantumult X":"undefined"!=typeof $loon?"Loon":"undefined"!=typeof $rocket?"Shadowrocket":void 0}isNode(){return"Node.js"===this.getEnv()}isQuanX(){return"Quantumult X"===this.getEnv()}isSurge(){return"Surge"===this.getEnv()}isLoon(){return"Loon"===this.getEnv()}isShadowrocket(){return"Shadowrocket"===this.getEnv()}isStash(){return"Stash"===this.getEnv()}toObj(e,t=null){try{return JSON.parse(e)}catch{return t}}toStr(e,t=null,...s){try{return JSON.stringify(e,...s)}catch{return t}}getjson(e,t){let s=t;if(this.getdata(e))try{s=JSON.parse(this.getdata(e))}catch{}return s}setjson(e,t){try{return this.setdata(JSON.stringify(e),t)}catch{return!1}}getScript(e){return new Promise((t=>{this.get({url:e},((e,s,i)=>t(i)))}))}runScript(e,t){return new Promise((s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let o=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");o=o?1*o:20,o=t&&t.timeout?t.timeout:o;const[r,a]=i.split("@"),n={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:e,mock_type:"cron",timeout:o},headers:{"X-Key":r,Accept:"*/*"},policy:"DIRECT",timeout:o};this.post(n,((e,t,i)=>s(i)))})).catch((e=>this.logErr(e)))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const e=this.path.resolve(this.dataFile),t=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(e),i=!s&&this.fs.existsSync(t);if(!s&&!i)return{};{const i=s?e:t;try{return JSON.parse(this.fs.readFileSync(i))}catch(e){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const e=this.path.resolve(this.dataFile),t=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(e),i=!s&&this.fs.existsSync(t),o=JSON.stringify(this.data);s?this.fs.writeFileSync(e,o):i?this.fs.writeFileSync(t,o):this.fs.writeFileSync(e,o)}}lodash_get(e,t,s){const i=t.replace(/\[(\d+)\]/g,".$1").split(".");let o=e;for(const e of i)if(o=Object(o)[e],void 0===o)return s;return o}lodash_set(e,t,s){return Object(e)!==e||(Array.isArray(t)||(t=t.toString().match(/[^.[\]]+/g)||[]),t.slice(0,-1).reduce(((e,s,i)=>Object(e[s])===e[s]?e[s]:e[s]=Math.abs(t[i+1])>>0==+t[i+1]?[]:{}),e)[t[t.length-1]]=s),e}getdata(e){let t=this.getval(e);if(/^@/.test(e)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(e),o=s?this.getval(s):"";if(o)try{const e=JSON.parse(o);t=e?this.lodash_get(e,i,""):t}catch(e){t=""}}return t}setdata(e,t){let s=!1;if(/^@/.test(t)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(t),r=this.getval(i),a=i?"null"===r?null:r||"{}":"{}";try{const t=JSON.parse(a);this.lodash_set(t,o,e),s=this.setval(JSON.stringify(t),i)}catch(t){const r={};this.lodash_set(r,o,e),s=this.setval(JSON.stringify(r),i)}}else s=this.setval(e,t);return s}getval(e){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.read(e);case"Quantumult X":return $prefs.valueForKey(e);case"Node.js":return this.data=this.loaddata(),this.data[e];default:return this.data&&this.data[e]||null}}setval(e,t){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":return $persistentStore.write(e,t);case"Quantumult X":return $prefs.setValueForKey(e,t);case"Node.js":return this.data=this.loaddata(),this.data[t]=e,this.writedata(),!0;default:return this.data&&this.data[t]||null}}initGotEnv(e){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,e&&(e.headers=e.headers?e.headers:{},e&&(e.headers=e.headers?e.headers:{},void 0===e.headers.cookie&&void 0===e.headers.Cookie&&void 0===e.cookieJar&&(e.cookieJar=this.ckjar)))}get(e,t=(()=>{})){switch(e.headers&&(delete e.headers["Content-Type"],delete e.headers["Content-Length"],delete e.headers["content-type"],delete e.headers["content-length"]),e.params&&(e.url+="?"+this.queryStr(e.params)),void 0===e.followRedirect||e.followRedirect||((this.isSurge()||this.isLoon())&&(e["auto-redirect"]=!1),this.isQuanX()&&(e.opts?e.opts.redirection=!1:e.opts={redirection:!1})),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(e.headers=e.headers||{},Object.assign(e.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(e,((e,s,i)=>{!e&&s&&(s.body=i,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),t(e,s,i)}));break;case"Quantumult X":this.isNeedRewrite&&(e.opts=e.opts||{},Object.assign(e.opts,{hints:!1})),$task.fetch(e).then((e=>{const{statusCode:s,statusCode:i,headers:o,body:r,bodyBytes:a}=e;t(null,{status:s,statusCode:i,headers:o,body:r,bodyBytes:a},r,a)}),(e=>t(e&&e.error||"UndefinedError")));break;case"Node.js":let s=require("iconv-lite");this.initGotEnv(e),this.got(e).on("redirect",((e,t)=>{try{if(e.headers["set-cookie"]){const s=e.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),t.cookieJar=this.ckjar}}catch(e){this.logErr(e)}})).then((e=>{const{statusCode:i,statusCode:o,headers:r,rawBody:a}=e,n=s.decode(a,this.encoding);t(null,{status:i,statusCode:o,headers:r,rawBody:a,body:n},n)}),(e=>{const{message:i,response:o}=e;t(i,o,o&&s.decode(o.rawBody,this.encoding))}));break}}post(e,t=(()=>{})){const s=e.method?e.method.toLocaleLowerCase():"post";switch(e.body&&e.headers&&!e.headers["Content-Type"]&&!e.headers["content-type"]&&(e.headers["content-type"]="application/x-www-form-urlencoded"),e.headers&&(delete e.headers["Content-Length"],delete e.headers["content-length"]),void 0===e.followRedirect||e.followRedirect||((this.isSurge()||this.isLoon())&&(e["auto-redirect"]=!1),this.isQuanX()&&(e.opts?e.opts.redirection=!1:e.opts={redirection:!1})),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:this.isSurge()&&this.isNeedRewrite&&(e.headers=e.headers||{},Object.assign(e.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient[s](e,((e,s,i)=>{!e&&s&&(s.body=i,s.statusCode=s.status?s.status:s.statusCode,s.status=s.statusCode),t(e,s,i)}));break;case"Quantumult X":e.method=s,this.isNeedRewrite&&(e.opts=e.opts||{},Object.assign(e.opts,{hints:!1})),$task.fetch(e).then((e=>{const{statusCode:s,statusCode:i,headers:o,body:r,bodyBytes:a}=e;t(null,{status:s,statusCode:i,headers:o,body:r,bodyBytes:a},r,a)}),(e=>t(e&&e.error||"UndefinedError")));break;case"Node.js":let i=require("iconv-lite");this.initGotEnv(e);const{url:o,...r}=e;this.got[s](o,r).then((e=>{const{statusCode:s,statusCode:o,headers:r,rawBody:a}=e,n=i.decode(a,this.encoding);t(null,{status:s,statusCode:o,headers:r,rawBody:a,body:n},n)}),(e=>{const{message:s,response:o}=e;t(s,o,o&&i.decode(o.rawBody,this.encoding))}));break}}time(e,t=null){const s=t?new Date(t):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let t in i)new RegExp("("+t+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?i[t]:("00"+i[t]).substr((""+i[t]).length)));return e}queryStr(e){let t="";for(const s in e){let i=e[s];null!=i&&""!==i&&("object"==typeof i&&(i=JSON.stringify(i)),t+=`${s}=${i}&`)}return t=t.substring(0,t.length-1),t}msg(t=e,s="",i="",o={}){const r=e=>{const{$open:t,$copy:s,$media:i,$mediaMime:o}=e;switch(typeof e){case void 0:return e;case"string":switch(this.getEnv()){case"Surge":case"Stash":default:return{url:e};case"Loon":case"Shadowrocket":return e;case"Quantumult X":return{"open-url":e};case"Node.js":return}case"object":switch(this.getEnv()){case"Surge":case"Stash":case"Shadowrocket":default:{const r={};let a=e.openUrl||e.url||e["open-url"]||t;a&&Object.assign(r,{action:"open-url",url:a});let n=e["update-pasteboard"]||e.updatePasteboard||s;n&&Object.assign(r,{action:"clipboard",text:n});let h=e.mediaUrl||e["media-url"]||i;if(h){let e,t;if(h.startsWith("http"));else if(h.startsWith("data:")){const[s]=h.split(";"),[,i]=h.split(",");e=i,t=s.replace("data:","")}else{e=h,t=(e=>{const t={JVBERi0:"application/pdf",R0lGODdh:"image/gif",R0lGODlh:"image/gif",iVBORw0KGgo:"image/png","/9j/":"image/jpg"};for(var s in t)if(0===e.indexOf(s))return t[s];return null})(h)}Object.assign(r,{"media-url":h,"media-base64":e,"media-base64-mime":o??t})}return Object.assign(r,{"auto-dismiss":e["auto-dismiss"],sound:e.sound}),r}case"Loon":{const s={};let o=e.openUrl||e.url||e["open-url"]||t;o&&Object.assign(s,{openUrl:o});let r=e.mediaUrl||e["media-url"]||i;return r&&Object.assign(s,{mediaUrl:r}),console.log(JSON.stringify(s)),s}case"Quantumult X":{const o={};let r=e["open-url"]||e.url||e.openUrl||t;r&&Object.assign(o,{"open-url":r});let a=e.mediaUrl||e["media-url"]||i;a&&Object.assign(o,{"media-url":a});let n=e["update-pasteboard"]||e.updatePasteboard||s;return n&&Object.assign(o,{"update-pasteboard":n}),console.log(JSON.stringify(o)),o}case"Node.js":return}default:return}};if(!this.isMute)switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":default:$notification.post(t,s,i,r(o));break;case"Quantumult X":$notify(t,s,i,r(o));break;case"Node.js":break}if(!this.isMuteLog){let e=["","==============📣系统通知📣=============="];e.push(t),s&&e.push(s),i&&e.push(i),console.log(e.join("\n")),this.logs=this.logs.concat(e)}}debug(...e){this.logLevels[this.logLevel]<=this.logLevels.debug&&(e.length>0&&(this.logs=[...this.logs,...e]),console.log(`${this.logLevelPrefixs.debug}${e.map((e=>e??String(e))).join(this.logSeparator)}`))}info(...e){this.logLevels[this.logLevel]<=this.logLevels.info&&(e.length>0&&(this.logs=[...this.logs,...e]),console.log(`${this.logLevelPrefixs.info}${e.map((e=>e??String(e))).join(this.logSeparator)}`))}warn(...e){this.logLevels[this.logLevel]<=this.logLevels.warn&&(e.length>0&&(this.logs=[...this.logs,...e]),console.log(`${this.logLevelPrefixs.warn}${e.map((e=>e??String(e))).join(this.logSeparator)}`))}error(...e){this.logLevels[this.logLevel]<=this.logLevels.error&&(e.length>0&&(this.logs=[...this.logs,...e]),console.log(`${this.logLevelPrefixs.error}${e.map((e=>e??String(e))).join(this.logSeparator)}`))}log(...e){e.length>0&&(this.logs=[...this.logs,...e]),console.log(e.map((e=>e??String(e))).join(this.logSeparator))}logErr(e,t){switch(this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:this.log("",`❗️${this.name}, 错误!`,t,e);break;case"Node.js":this.log("",`❗️${this.name}, 错误!`,t,void 0!==e.message?e.message:e,e.stack);break}}wait(e){return new Promise((t=>setTimeout(t,e)))}done(e={}){const t=((new Date).getTime()-this.startTime)/1e3;switch(this.log("",`🔔${this.name}, 结束! 🕛 ${t} 秒`),this.log(),this.getEnv()){case"Surge":case"Loon":case"Stash":case"Shadowrocket":case"Quantumult X":default:$done(e);break;case"Node.js":process.exit(1)}}}(e,t)} \ No newline at end of file From eecdc39a407df13734d5ef276d5917f107393e91 Mon Sep 17 00:00:00 2001 From: GideonSenku Date: Tue, 11 Nov 2025 13:36:27 +0800 Subject: [PATCH 338/338] fix: citybox api host --- citybox/citybox.cookie.js | 6 +++--- citybox/citybox.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/citybox/citybox.cookie.js b/citybox/citybox.cookie.js index 1800835e8..4c66d42c7 100644 --- a/citybox/citybox.cookie.js +++ b/citybox/citybox.cookie.js @@ -3,15 +3,15 @@ * hostname = api.icitybox.cn * * # Surge - * Rewrite: citybox = type=http-request,pattern=^https:\/\/api\.icitybox\.cn\/index.php\/api\/user\/get_user_info,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/citybox/citybox.cookie.js,debug=true + * Rewrite: citybox = type=http-request,pattern=^https:\/\/api\.icitybox\/api\/user\/get_user_info,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/citybox/citybox.cookie.js,debug=true * Tasks: citybox-签到 = type=cron,cronexp=10 0 * * *,script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/citybox/citybox.js,wake-system=true * * # QuanX - * ^https:\/\/api\.icitybox\.cn\/index.php\/api\/user\/get_user_info url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/citybox/citybox.cookie.js + * ^https:\/\/api\.icitybox\/api\/user\/get_user_info url script-request-header https://raw.githubusercontent.com/chavyleung/scripts/master/citybox/citybox.cookie.js * 10 0 * * * https://raw.githubusercontent.com/chavyleung/scripts/master/citybox/citybox.js, tag=citybox-签到 * * # Loon - * http-request ^https:\/\/api\.icitybox\.cn\/index.php\/api\/user\/get_user_infoscript-path=https://raw.githubusercontent.com/chavyleung/scripts/master/citybox/citybox.cookie.js, tag=citybox + * http-request ^https:\/\/api\.icitybox\/api\/user\/get_user_infoscript-path=https://raw.githubusercontent.com/chavyleung/scripts/master/citybox/citybox.cookie.js, tag=citybox * cron "10 0 * * *" script-path=https://raw.githubusercontent.com/chavyleung/scripts/master/citybox/citybox.js * * # 获取方式:进入签到页面获取,进入citybox小程序即可 diff --git a/citybox/citybox.js b/citybox/citybox.js index f5f0707d7..1461bd71e 100644 --- a/citybox/citybox.js +++ b/citybox/citybox.js @@ -1,5 +1,5 @@ const $ = new Env('魔盒') -const hostApi = 'https://api.icitybox.cn/index.php/api' +const hostApi = 'https://api.icitybox.cn/api' const drawRes = [] !(async () => {