mirror of
https://github.com/bs-community/blessing-skin-manual.git
synced 2024-11-21 00:40:49 +08:00
add CDN status checker
This commit is contained in:
parent
a0771f0e45
commit
1249dd247a
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
node_modules/
|
||||
man/.vuepress/dist
|
||||
yarn.lock
|
||||
.vercel
|
||||
|
5
.prettierrc
Normal file
5
.prettierrc
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "es5"
|
||||
}
|
48
api/cdn.ts
Normal file
48
api/cdn.ts
Normal file
@ -0,0 +1,48 @@
|
||||
import fetch from 'node-fetch'
|
||||
import { NowRequest, NowResponse } from '@vercel/node'
|
||||
|
||||
type Query = { cdn: string; version: string }
|
||||
|
||||
export default async (request: NowRequest, response: NowResponse) => {
|
||||
response.setHeader('Content-Type', 'image/svg+xml')
|
||||
|
||||
const { cdn, version } = request.query as Query
|
||||
const host = cdn.replace(':version', version)
|
||||
|
||||
const res = await fetch(`https://${host}/app/manifest.json`, {
|
||||
headers: {
|
||||
'User-Agent':
|
||||
'Mozilla/5.0 (X11; Linux x86_64; rv:79.0) Gecko/20100101 Firefox/79.0',
|
||||
},
|
||||
})
|
||||
if (res.status >= 300) {
|
||||
const badge = await fetch(
|
||||
`https://img.shields.io/badge/${version}-unavailable-red`
|
||||
)
|
||||
badge.body.pipe(response)
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const manifest: Record<string, unknown> = await res.json()
|
||||
if (
|
||||
typeof manifest['app.js'] === 'string' /** v5 or later */ ||
|
||||
typeof manifest['index.js'] === 'string' /** v4 */
|
||||
) {
|
||||
const badge = await fetch(
|
||||
`https://img.shields.io/badge/${version}-working-brightgreen`
|
||||
)
|
||||
badge.body.pipe(response)
|
||||
} else {
|
||||
const badge = await fetch(
|
||||
`https://img.shields.io/badge/${version}-incorrect-red`
|
||||
)
|
||||
badge.body.pipe(response)
|
||||
}
|
||||
} catch (_) {
|
||||
const badge = await fetch(
|
||||
`https://img.shields.io/badge/${version}-incorrect-red`
|
||||
)
|
||||
badge.body.pipe(response)
|
||||
}
|
||||
}
|
32
man/cdn.md
32
man/cdn.md
@ -26,27 +26,20 @@
|
||||
|
||||
地址:`https://bs-mirror.i-creator.cn/:version/public`
|
||||
|
||||
其中 `:version` 替换成 BS 版本。目前此 CDN 地址适用于以下版本:
|
||||
![](https://blessing-skin-manual.vercel.app/api/cdn?cdn=bs-mirror.i-creator.cn/:version/public&version=5.0.0)
|
||||
![](https://blessing-skin-manual.vercel.app/api/cdn?cdn=bs-mirror.i-creator.cn/:version/public&version=4.4.0)
|
||||
|
||||
- 4.0.4
|
||||
- 4.1.0
|
||||
- 4.1.1
|
||||
- 4.1.2
|
||||
- 4.1.3
|
||||
- 4.1.4
|
||||
- 4.2.0
|
||||
- 4.2.1
|
||||
- 4.3.6
|
||||
- 4.4.0
|
||||
|
||||
替换后的地址应类似于:`https://bs-mirror.i-creator.cn/4.0.4/public`
|
||||
其中 `:version` 替换成 BS 版本。替换后的地址应类似于:`https://bs-mirror.i-creator.cn/4.0.4/public`
|
||||
|
||||
### [bairuo.top](https://blog.bairuo.top)
|
||||
|
||||
地址:`https://bs-mirrors.bairuo.top/:version/public/app`
|
||||
地址:`https://bs-mirrors.bairuo.top/:version/public`
|
||||
|
||||
支持 v4 所有版本。
|
||||
|
||||
![](https://blessing-skin-manual.vercel.app/api/cdn?cdn=bs-mirrors.bairuo.top/:version/public&version=5.0.0)
|
||||
![](https://blessing-skin-manual.vercel.app/api/cdn?cdn=bs-mirrors.bairuo.top/:version/public&version=4.4.0)
|
||||
|
||||
由白渃提供。
|
||||
|
||||
QQ:3337980633,添加时注明 Blessing Skin。
|
||||
@ -59,6 +52,9 @@ CDN 是 CloudFlare 的 Enterprise 套餐,并开启中国网络,全球都有
|
||||
|
||||
地址: https://s1.pangdidi.cn/CDN/blessing-skin-server/:version/public
|
||||
|
||||
![](https://blessing-skin-manual.vercel.app/api/cdn?cdn=s1.pangdidi.cn/CDN/blessing-skin-server/:version/public&version=5.0.0)
|
||||
![](https://blessing-skin-manual.vercel.app/api/cdn?cdn=s1.pangdidi.cn/CDN/blessing-skin-server/:version/public&version=4.4.0)
|
||||
|
||||
请将地址中的 `:version` 替换为皮肤站当前所使用的版本。[点击这里可查看支持的版本](https://s1.pangdidi.cn/CDN/blessing-skin-server/versions.json)。
|
||||
|
||||
如果您在使用本 CDN 的过程中遇到了问题,请联系 QQ 14907471。
|
||||
@ -69,13 +65,19 @@ CDN 是 CloudFlare 的 Enterprise 套餐,并开启中国网络,全球都有
|
||||
|
||||
地址: `https://bs-cdn.yecdn.com/:version/public`
|
||||
|
||||
![](https://blessing-skin-manual.vercel.app/api/cdn?cdn=bs-cdn.yecdn.com/:version/public&version=5.0.0)
|
||||
![](https://blessing-skin-manual.vercel.app/api/cdn?cdn=bs-cdn.yecdn.com/:version/public&version=4.4.0)
|
||||
|
||||
请将地址中的 `:version` 替换为皮肤站当前所使用的版本。[点击查看当前支持的版本](https://bs-cdn.yecdn.com/versions)
|
||||
|
||||
如果您在使用本 CDN 的过程中遇到了问题,欢迎通过 Telegram 联系我: [@ZoharWang](https://t.me/ZoharWang)
|
||||
|
||||
### paperjun.xyz
|
||||
|
||||
资源链接:`https://paperjun.xyz/:version/`
|
||||
资源链接:`https://paperjun.xyz/:version`
|
||||
|
||||
![](https://blessing-skin-manual.vercel.app/api/cdn?cdn=paperjun.xyz/:version&version=5.0.0)
|
||||
![](https://blessing-skin-manual.vercel.app/api/cdn?cdn=paperjun.xyz/:version&version=4.4.0)
|
||||
|
||||
完整的使用方法:https://help.paperjun.xyz/howto:blessingskin-cdn-config.html
|
||||
|
||||
|
@ -10,6 +10,12 @@
|
||||
"build": "vuepress build man"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node-fetch": "^2.5.7",
|
||||
"@vercel/node": "^1.7.4",
|
||||
"typescript": "^3.9.7",
|
||||
"vuepress": "^1.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"node-fetch": "^2.6.0"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user