perf: Add switch for cron-sync-artifacts

This commit is contained in:
Peng-YM
2022-07-12 18:56:18 +08:00
parent 3d58534dfe
commit 813f2b839d
8 changed files with 45 additions and 47 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.11.1",
"version": "2.11.2",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {
+17 -9
View File
@@ -1,16 +1,24 @@
import { syncToGist, produceArtifact } from '@/restful/artifacts';
import { version } from '../../package.json';
import { ARTIFACTS_KEY } from '@/constants';
import { SETTINGS_KEY, ARTIFACTS_KEY } from '@/constants';
import $ from '@/core/app';
console.log(
`
!(async function () {
const settings = $.read(SETTINGS_KEY);
if (settings.enableCronSyncArtifacts === true) {
await doSync();
}
})().finally(() => $.done());
async function doSync() {
console.log(
`
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
Sub-Store -- v${version}
Sub-Store Sync -- v${version}
┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅
`,
);
!(async function () {
);
$.info('开始同步所有远程配置...');
const allArtifacts = $.read(ARTIFACTS_KEY);
const files = {};
@@ -46,9 +54,9 @@ console.log(
}
$.write(allArtifacts, ARTIFACTS_KEY);
$.notify('🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』', '全部订阅同步成功!');
$.notify('🌍 Sub-Store', '全部订阅同步成功!');
} catch (err) {
$.notify('🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』', '同步订阅失败', `原因:${err}`);
$.notify('🌍 Sub-Store', '同步订阅失败', `原因:${err}`);
$.error(`无法同步订阅配置到 Gist,原因:${err}`);
}
})().finally(() => $.done());
}
+2 -2
View File
@@ -307,7 +307,7 @@ async function produceArtifact({ type, name, platform }) {
for (const proxy of proxies) {
if (exist[proxy.name]) {
$.notify(
'🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』',
'🌍 Sub-Store',
'⚠️ 订阅包含重复节点!',
'请仔细检测配置!',
{
@@ -388,7 +388,7 @@ async function produceArtifact({ type, name, platform }) {
for (const proxy of proxies) {
if (exist[proxy.name]) {
$.notify(
'🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』',
'🌍 Sub-Store',
'⚠️ 订阅包含重复节点!',
'请仔细检测配置!',
{
+4 -4
View File
@@ -48,7 +48,7 @@ async function downloadSubscription(req, res) {
}
} catch (err) {
$.notify(
`🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』 下载订阅失败`,
`🌍 Sub-Store 下载订阅失败`,
`❌ 无法下载订阅:${name}`,
`🤔 原因:${JSON.stringify(err)}`,
);
@@ -63,7 +63,7 @@ async function downloadSubscription(req, res) {
);
}
} else {
$.notify(`🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』 下载订阅失败`, `❌ 未找到订阅:${name}`);
$.notify(`🌍 Sub-Store 下载订阅失败`, `❌ 未找到订阅:${name}`);
failed(
res,
new ResourceNotFoundError(
@@ -117,7 +117,7 @@ async function downloadCollection(req, res) {
}
} catch (err) {
$.notify(
`🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』 下载组合订阅失败`,
`🌍 Sub-Store 下载组合订阅失败`,
`❌ 下载组合订阅错误:${name}`,
`🤔 原因:${err}`,
);
@@ -132,7 +132,7 @@ async function downloadCollection(req, res) {
}
} else {
$.notify(
`🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』 下载组合订阅失败`,
`🌍 Sub-Store 下载组合订阅失败`,
`❌ 未找到组合订阅:${name}`,
);
failed(
+3 -3
View File
File diff suppressed because one or more lines are too long
+12 -22
View File
@@ -1,32 +1,22 @@
# Sub-Store 配置指南
Sub-Store 依赖于代理 App 的 MITM、重写以及 JavaScript 脚本等功能,**在开始使用前请确保 MITM 证书已经正确配置并信任,MITM、重写、脚本等开关处于开启状态**。
## 脚本配置:
## 一、脚本配置:
### 1. **Loon**
### 1. Loon
安装使用[插件](https://raw.githubusercontent.com/Peng-YM/Sub-Store/master/config/Loon.plugin)即可。
### 2. **Surge**
### 2. Surge
安装使用[模块](https://raw.githubusercontent.com/Peng-YM/Sub-Store/master/config/Surge.sgmodule)即可。
### 3. **Quantumult X**
(1) 订阅[重写](https://raw.githubusercontent.com/Peng-YM/Sub-Store/master/config/QX.snippet)
### 3. QX
订阅[重写](https://raw.githubusercontent.com/Peng-YM/Sub-Store/master/config/QX.snippet)即可
(2) 编辑配置文件,在 [task_local] 一节下添加:
```
0 0 1 1 * https://raw.githubusercontent.com/sub-store-org/Sub-Store/master/backend/dist/cron-sync-artifacts.min.js, tag=Sub-Store Sync, enabled=true
```
### 4. Stash
安装使用[ Stash 覆写](https://raw.githubusercontent.com/Peng-YM/Sub-Store/master/config/Stash.stoverride)即可。
### 4. **Stash**
安装使用[ Stash 覆写](https://raw.githubusercontent.com/Peng-YM/Sub-Store/master/config/Stash.stoverride)
### 5. **Shadowrocket**
### 5. Shadowrocket
安装使用[模块](https://raw.githubusercontent.com/Peng-YM/Sub-Store/master/config/Surge.sgmodule)即可。
## 二、使用 Sub-Store
(1) 使用 Safari 打开这个 https://sub.store 如网页正常打开并且未弹出任何错误提示,说明 Sub-Store 已经配置成功
(2) 把 Sub-Store 添加到主屏幕,即可获得类似于 APP 的使用体验。
(3) 更详细的使用指南请参考[文档](https://www.notion.so/Sub-Store-6259586994d34c11a4ced5c406264b46)。
## 使用 Sub-Store
1. 使用 Safari 打开这个 https://sub.store 如网页正常打开并且未弹出任何错误提示,说明 Sub-Store 已经配置成功。
2. 可以把 Sub-Store 添加到主屏幕,即可获得类似于 APP 的使用体验
3. 更详细的使用指南请参考[文档](https://www.notion.so/Sub-Store-6259586994d34c11a4ced5c406264b46)。