Compare commits

...

3 Commits

Author SHA1 Message Date
QuentinHsu
bac04587b8 🐞 fix(subscriptions): negative usage flow 2022-10-23 13:36:01 +08:00
Jasonzza
06d0c14abc fix: sync artifacts issue (#164) 2022-09-11 23:52:51 +08:00
Peng-YM
029900085c fix: cron-sync-artifacts.js path 2022-09-10 11:47:34 +08:00
5 changed files with 24 additions and 16 deletions

View File

@@ -51,4 +51,4 @@ jobs:
./backend/dist/sub-store-0.min.js ./backend/dist/sub-store-0.min.js
./backend/dist/sub-store-1.min.js ./backend/dist/sub-store-1.min.js
./backend/dist/sub-store-parser.loon.min.js ./backend/dist/sub-store-parser.loon.min.js
./backend/dist/cron-sync-artifacts.js ./backend/dist/cron-sync-artifacts.min.js

View File

@@ -1,6 +1,6 @@
{ {
"name": "sub-store", "name": "sub-store",
"version": "2.13.2", "version": "2.13.5",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js", "main": "src/main.js",
"scripts": { "scripts": {

View File

@@ -51,6 +51,7 @@ async function doSync() {
const body = JSON.parse(resp.body); const body = JSON.parse(resp.body);
for (const artifact of allArtifacts) { for (const artifact of allArtifacts) {
if (artifact.sync) {
artifact.updated = new Date().getTime(); artifact.updated = new Date().getTime();
// extract real url from gist // extract real url from gist
artifact.url = body.files[artifact.name].raw_url.replace( artifact.url = body.files[artifact.name].raw_url.replace(
@@ -58,6 +59,7 @@ async function doSync() {
'/raw/$1', '/raw/$1',
); );
} }
}
$.write(allArtifacts, ARTIFACTS_KEY); $.write(allArtifacts, ARTIFACTS_KEY);
$.notify('🌍 Sub-Store', '全部订阅同步成功!'); $.notify('🌍 Sub-Store', '全部订阅同步成功!');

View File

@@ -66,8 +66,12 @@ async function getFlowInfo(req, res) {
} }
// unit is KB // unit is KB
const upload = Number(flowHeaders.match(/upload=(\d+)/)[1]); const uploadMatch = flowHeaders.match(/upload=(-?)(\d+)/)
const download = Number(flowHeaders.match(/download=(\d+)/)[1]); const upload = Number(uploadMatch[1] + uploadMatch[2]);
const downloadMatch = flowHeaders.match(/download=(-?)(\d+)/)
const download = Number(downloadMatch[1] + downloadMatch[2]);
const total = Number(flowHeaders.match(/total=(\d+)/)[1]); const total = Number(flowHeaders.match(/total=(\d+)/)[1]);
// optional expire timestamp // optional expire timestamp

View File

@@ -201,6 +201,7 @@ async function syncAllArtifacts(_, res) {
const body = JSON.parse(resp.body); const body = JSON.parse(resp.body);
for (const artifact of allArtifacts) { for (const artifact of allArtifacts) {
if (artifact.sync) {
artifact.updated = new Date().getTime(); artifact.updated = new Date().getTime();
// extract real url from gist // extract real url from gist
artifact.url = body.files[artifact.name].raw_url.replace( artifact.url = body.files[artifact.name].raw_url.replace(
@@ -208,6 +209,7 @@ async function syncAllArtifacts(_, res) {
'/raw/$1', '/raw/$1',
); );
} }
}
$.write(allArtifacts, ARTIFACTS_KEY); $.write(allArtifacts, ARTIFACTS_KEY);
$.info('全部订阅同步成功!'); $.info('全部订阅同步成功!');