MCPcopy Create free account
hub / github.com/Script-Hub-Org/Script-Hub / reloaded

Function reloaded

script-hub.beta.js:7–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5$.isRequest = () => typeof $request !== 'undefined'
6const isReloadRequest = () => $.isRequest() && /^https?:\/\/script\.hub\/reload/.test($request.url)
7const reloaded = () => {
8 if ($.isSurge()) {
9 $.done({
10 response: {
11 status: 200,
12 body: `<meta charset="UTF-8" /><h1>✅ Surge 重载完成<h1><a href="surge://">点此打开 Surge</a>`,
13 headers: {
14 'Content-Type': 'text/html;charset=UTF-8',
15 'Access-Control-Allow-Origin': '*',
16 'Access-Control-Allow-Methods': 'POST,GET,OPTIONS,PUT,DELETE',
17 'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept',
18 },
19 },
20 })
21 } else {
22 $.done({
23 response: {
24 status: 200,
25 body: `<meta charset="UTF-8" /><h1>🈚️ 暂时仅支持 Surge<h1>`,
26 headers: {
27 'Content-Type': 'text/html;charset=UTF-8',
28 'Access-Control-Allow-Origin': '*',
29 'Access-Control-Allow-Methods': 'POST,GET,OPTIONS,PUT,DELETE',
30 'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept',
31 },
32 },
33 })
34 }
35}
36
37if (isReloadRequest()) {
38 if ($.isSurge()) {

Callers 1

script-hub.beta.jsFile · 0.70

Calls 2

isSurgeMethod · 0.45
doneMethod · 0.45

Tested by

no test coverage detected