mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 17:20:35 +08:00
Feat: auto generate AWS S3 domain list
This commit is contained in:
parent
f5771e387d
commit
980cf95c43
1
.github/workflows/main.yml
vendored
1
.github/workflows/main.yml
vendored
@ -31,6 +31,7 @@ jobs:
|
||||
- run: node ./Build/build-reject-domainset.js
|
||||
- run: node ./Build/build-telegram-cidr.js
|
||||
- run: node ./Build/build-index.html.js
|
||||
- run: node Build/build-cdn-conf.js
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
|
||||
24
Build/build-cdn-conf.js
Normal file
24
Build/build-cdn-conf.js
Normal file
@ -0,0 +1,24 @@
|
||||
const { fetch } = require('undici');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
(async () => {
|
||||
const domains = (await (await fetch('https://publicsuffix.org/list/public_suffix_list.dat')).text()).split('\n');
|
||||
|
||||
const awsS3 = domains.filter(line => {
|
||||
if (line) {
|
||||
return line.startsWith('s3') && line.endsWith('.amazonaws.com') && !line.includes('cn-')
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
|
||||
const filePath = path.resolve(__dirname, '../List/non_ip/cdn.conf');
|
||||
const content = (await fs.promises.readFile(filePath, 'utf-8'))
|
||||
.replace(
|
||||
'# --- [AWS S3 Replace Me] ---',
|
||||
awsS3.map(domain => `DOMAIN-SUFFIX,${domain}`).join('\n')
|
||||
);
|
||||
|
||||
await fs.promises.writeFile(filePath, content, 'utf-8');
|
||||
})();
|
||||
@ -271,8 +271,6 @@ images.prismic.io
|
||||
# >> General CDN
|
||||
# CookieLaw
|
||||
.cdn.cookielaw.org
|
||||
# AWS S3
|
||||
.s3.amazonaws.com
|
||||
# Cloudflare
|
||||
static.dash.cloudflare.com
|
||||
# Tumblr
|
||||
|
||||
@ -23,3 +23,5 @@ DOMAIN-SUFFIX,firebaseapp.com
|
||||
DOMAIN-SUFFIX,csb.app
|
||||
# >> Microsoft Azure
|
||||
DOMAIN-SUFFIX,azurestaticapps.net
|
||||
# >> AWS S3
|
||||
# --- [AWS S3 Replace Me] ---
|
||||
|
||||
@ -46,8 +46,8 @@ DOMAIN-SET,https://ruleset.skk.moe/List/domainset/cdn.conf,[Replace with your po
|
||||
RULE-SET,https://ruleset.skk.moe/List/non_ip/cdn.conf,[Replace with your policy]
|
||||
```
|
||||
|
||||
- 人工维护
|
||||
- 包含所有常见静态资源 CDN 域名
|
||||
- 自动生成 + 人工维护
|
||||
- 包含所有常见静态资源 CDN 域名、对象存储域名
|
||||
- 如果你正在使用商业性质的公共代理服务、且你的服务商提供按低倍率结算流量消耗的节点,可使用上述规则组将流量分配给这部分节点
|
||||
|
||||
#### 流媒体
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user