mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-28 17:41:54 +08:00
Feat: auto generate AWS S3 domain list
This commit is contained in:
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-reject-domainset.js
|
||||||
- run: node ./Build/build-telegram-cidr.js
|
- run: node ./Build/build-telegram-cidr.js
|
||||||
- run: node ./Build/build-index.html.js
|
- run: node ./Build/build-index.html.js
|
||||||
|
- run: node Build/build-cdn-conf.js
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
with:
|
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
|
# >> General CDN
|
||||||
# CookieLaw
|
# CookieLaw
|
||||||
.cdn.cookielaw.org
|
.cdn.cookielaw.org
|
||||||
# AWS S3
|
|
||||||
.s3.amazonaws.com
|
|
||||||
# Cloudflare
|
# Cloudflare
|
||||||
static.dash.cloudflare.com
|
static.dash.cloudflare.com
|
||||||
# Tumblr
|
# Tumblr
|
||||||
|
|||||||
@@ -23,3 +23,5 @@ DOMAIN-SUFFIX,firebaseapp.com
|
|||||||
DOMAIN-SUFFIX,csb.app
|
DOMAIN-SUFFIX,csb.app
|
||||||
# >> Microsoft Azure
|
# >> Microsoft Azure
|
||||||
DOMAIN-SUFFIX,azurestaticapps.net
|
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]
|
RULE-SET,https://ruleset.skk.moe/List/non_ip/cdn.conf,[Replace with your policy]
|
||||||
```
|
```
|
||||||
|
|
||||||
- 人工维护
|
- 自动生成 + 人工维护
|
||||||
- 包含所有常见静态资源 CDN 域名
|
- 包含所有常见静态资源 CDN 域名、对象存储域名
|
||||||
- 如果你正在使用商业性质的公共代理服务、且你的服务商提供按低倍率结算流量消耗的节点,可使用上述规则组将流量分配给这部分节点
|
- 如果你正在使用商业性质的公共代理服务、且你的服务商提供按低倍率结算流量消耗的节点,可使用上述规则组将流量分配给这部分节点
|
||||||
|
|
||||||
#### 流媒体
|
#### 流媒体
|
||||||
|
|||||||
Reference in New Issue
Block a user