Skip to content

Commit 9a93aeb

Browse files
committed
refactor: ✨ 直接使用 proxy-utils.esm.mjs
1 parent 9a74435 commit 9a93aeb

46 files changed

Lines changed: 2383 additions & 15779 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Sync & Deploy Worker
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 0 * * *'
7+
push:
8+
branches:
9+
- master
10+
11+
permissions: write-all
12+
13+
jobs:
14+
sync:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
updated: ${{ steps.check.outputs.updated }}
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v6
21+
- name: Check for updates
22+
id: check
23+
run: |
24+
REMOTE=$(curl -s https://api.github.com/repos/sub-store-org/Sub-Store/tags | jq -r '.[0].name' | sed 's/^v//')
25+
LOCAL=$(node -p "require('./package.json').version")
26+
echo "Remote: $REMOTE Local: $LOCAL"
27+
if [ "$REMOTE" = "$LOCAL" ]; then
28+
echo "updated=false" >> "$GITHUB_OUTPUT"
29+
else
30+
node -e "const p=require('./package.json');p.version='$REMOTE';require('fs').writeFileSync('package.json',JSON.stringify(p,null,'\t')+'\n')"
31+
echo "updated=true" >> "$GITHUB_OUTPUT"
32+
fi
33+
- name: Commit and push
34+
if: steps.check.outputs.updated == 'true'
35+
run: |
36+
git config user.name "github-actions[bot]"
37+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
38+
git add package.json
39+
VERSION=$(node -p "require('./package.json').version")
40+
git commit -m "chore: bump proxy-utils to v${VERSION}"
41+
git push
42+
43+
worker:
44+
needs: sync
45+
if: needs.sync.outputs.updated == 'true'
46+
runs-on: ubuntu-latest
47+
env:
48+
SECRET: ${{ secrets.SECRET }}
49+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
50+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v6
54+
- name: Set up Node.js
55+
uses: actions/setup-node@v6
56+
with:
57+
node-version: "25"
58+
- name: Install pnpm
59+
uses: pnpm/action-setup@v4
60+
with:
61+
version: 10
62+
cache: true
63+
- name: Install dependencies
64+
run: pnpm install
65+
- name: Download proxy-utils
66+
run: curl -fsSL https://github.com/sub-store-org/Sub-Store/releases/latest/download/proxy-utils.esm.mjs -o src/proxy-utils.esm.mjs
67+
- name: Deploy
68+
run: |
69+
echo "SECRET=$SECRET" > .env.local
70+
pnpm run worker:deploy
71+
pnpm run worker:secret
Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish Docker Hub
1+
name: Deploy Docker
22

33
on:
44
workflow_dispatch:
@@ -7,31 +7,18 @@ on:
77
- master
88

99
permissions:
10-
contents: write
10+
contents: read
1111
packages: write
12-
12+
1313
jobs:
14-
build:
14+
docker:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v6
19-
- name: Set up Node.js
20-
uses: actions/setup-node@v6
21-
with:
22-
node-version: "25"
23-
- name: Install pnpm
24-
uses: pnpm/action-setup@v4
25-
with:
26-
version: 10
27-
cache: true
28-
- name: Build Node Bundle
29-
run: |
30-
pnpm install
31-
pnpm run build
32-
- name: Generate Date Tag
33-
id: date
34-
run: echo "DATE_TAG=$(date +'%y%m%d')" >> $GITHUB_OUTPUT
19+
- name: Get version
20+
id: version
21+
run: echo "VERSION=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT"
3522
- name: Docker meta
3623
id: meta
3724
uses: docker/metadata-action@v5
@@ -41,7 +28,7 @@ jobs:
4128
${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}
4229
tags: |
4330
type=raw,value=latest
44-
type=raw,value=${{ steps.date.outputs.DATE_TAG }}
31+
type=raw,value=${{ steps.version.outputs.VERSION }}
4532
- name: Set up QEMU
4633
uses: docker/setup-qemu-action@v3
4734
- name: Set up Docker Buildx

.github/workflows/worker.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,5 @@ out
130130
*.sln
131131
*.sw?
132132

133-
# Dist files
134-
**/dist
135-
.build/
136-
src/core/proxy-utils/parsers/peggy/generated/
133+
# Downloaded at build/runtime
134+
src/proxy-utils.esm.mjs

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ ENV HOST=0.0.0.0 \
1212
EXPOSE $PORT
1313

1414
WORKDIR /app
15-
COPY dist/minisubconvert.js /app/minisubconvert.js
15+
COPY src/node.js /app/node.js
16+
ADD https://github.com/sub-store-org/Sub-Store/releases/latest/download/proxy-utils.esm.mjs /app/proxy-utils.esm.mjs
1617

1718
USER node
1819

19-
CMD ["node", "minisubconvert.js"]
20+
CMD ["node", "node.js"]

dist/minisubconvert.js

Lines changed: 1793 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint.config.cjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ module.exports = [
66
ignores: [
77
"dist/**",
88
"node_modules/**",
9-
".wrangler/**",
10-
"src/core/proxy-utils/parsers/peggy/*.js"
9+
".wrangler/**"
1110
]
1211
},
1312
js.configs.recommended,

jsconfig.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

package.json

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,20 @@
33
"version": "1.0.0",
44
"description": "Subscription Convertion From Sub-Store",
55
"scripts": {
6-
"sync": "node scripts/sync.js",
7-
"build": "node scripts/build.js",
8-
"build:parsers": "node scripts/build.js --parsers-only",
9-
"node:dev": "nodemon -w src -w scripts -w package.json -w jsconfig.json --ext js,json --exec \"pnpm run build && node dist/minisubconvert.js\"",
10-
"worker:dev": "pnpm run build:parsers && wrangler dev .build/src/worker.js --config wrangler.jsonc --tsconfig .build/jsconfig.json --ip 0.0.0.0",
11-
"worker:deploy": "pnpm run build:parsers && wrangler deploy .build/src/worker.js --config wrangler.jsonc --tsconfig .build/jsconfig.json",
12-
"worker:secret": "wrangler secret bulk .env.local",
13-
"lint": "eslint \"{src,scripts}/**/*.js\" --ignore-pattern \"src/core/proxy-utils/**\""
6+
"node:dev": "nodemon -w src --ext js,mjs --exec \"node src/node.js\"",
7+
"worker:dev": "wrangler dev",
8+
"worker:deploy": "wrangler deploy",
9+
"worker:secret": "wrangler secret bulk .env.local",
10+
"lint": "eslint \"src/**/*.js\""
1411
},
1512
"author": "bestrui",
1613
"license": "GPL-3.0",
17-
"dependencies": {
18-
"ip-address": "^10.1.0",
19-
"js-base64": "^3.7.8",
20-
"json5": "^2.2.3",
21-
"jsrsasign": "^11.1.0",
22-
"lodash": "^4.17.23",
23-
"yaml": "^2.8.2"
24-
},
14+
"dependencies": {},
2515
"devDependencies": {
2616
"@eslint/js": "^10.0.1",
27-
"@types/node": "^25.3.5",
28-
"esbuild": "^0.27.3",
2917
"eslint": "^10.0.2",
3018
"globals": "^17.4.0",
31-
"jszip": "^3.10.1",
3219
"nodemon": "^3.1.11",
33-
"peggy": "^2.0.1",
34-
"typescript": "^5.9.3",
3520
"wrangler": "^4.71.0"
3621
}
37-
}
22+
}

0 commit comments

Comments
 (0)