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

View File

@ -1,6 +1,6 @@
{ {
"name": "sub-store", "name": "sub-store",
"version": "2.11.1", "version": "2.11.2",
"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

@ -1,16 +1,24 @@
import { syncToGist, produceArtifact } from '@/restful/artifacts'; import { syncToGist, produceArtifact } from '@/restful/artifacts';
import { version } from '../../package.json'; import { version } from '../../package.json';
import { ARTIFACTS_KEY } from '@/constants'; import { SETTINGS_KEY, ARTIFACTS_KEY } from '@/constants';
import $ from '@/core/app'; import $ from '@/core/app';
!(async function () {
const settings = $.read(SETTINGS_KEY);
if (settings.enableCronSyncArtifacts === true) {
await doSync();
}
})().finally(() => $.done());
async function doSync() {
console.log( console.log(
` `
Sub-Store -- v${version} Sub-Store Sync -- v${version}
`, `,
); );
!(async function () {
$.info('开始同步所有远程配置...'); $.info('开始同步所有远程配置...');
const allArtifacts = $.read(ARTIFACTS_KEY); const allArtifacts = $.read(ARTIFACTS_KEY);
const files = {}; const files = {};
@ -46,9 +54,9 @@ console.log(
} }
$.write(allArtifacts, ARTIFACTS_KEY); $.write(allArtifacts, ARTIFACTS_KEY);
$.notify('🌍 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆', '全部订阅同步成功!'); $.notify('🌍 Sub-Store', '全部订阅同步成功!');
} catch (err) { } catch (err) {
$.notify('🌍 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆', '同步订阅失败', `原因:${err}`); $.notify('🌍 Sub-Store', '同步订阅失败', `原因:${err}`);
$.error(`无法同步订阅配置到 Gist原因${err}`); $.error(`无法同步订阅配置到 Gist原因${err}`);
} }
})().finally(() => $.done()); }

View File

@ -307,7 +307,7 @@ async function produceArtifact({ type, name, platform }) {
for (const proxy of proxies) { for (const proxy of proxies) {
if (exist[proxy.name]) { if (exist[proxy.name]) {
$.notify( $.notify(
'🌍 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆', '🌍 Sub-Store',
'⚠️ 订阅包含重复节点!', '⚠️ 订阅包含重复节点!',
'请仔细检测配置!', '请仔细检测配置!',
{ {
@ -388,7 +388,7 @@ async function produceArtifact({ type, name, platform }) {
for (const proxy of proxies) { for (const proxy of proxies) {
if (exist[proxy.name]) { if (exist[proxy.name]) {
$.notify( $.notify(
'🌍 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆', '🌍 Sub-Store',
'⚠️ 订阅包含重复节点!', '⚠️ 订阅包含重复节点!',
'请仔细检测配置!', '请仔细检测配置!',
{ {

View File

@ -48,7 +48,7 @@ async function downloadSubscription(req, res) {
} }
} catch (err) { } catch (err) {
$.notify( $.notify(
`🌍 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 下载订阅失败`, `🌍 Sub-Store 下载订阅失败`,
`❌ 无法下载订阅:${name}`, `❌ 无法下载订阅:${name}`,
`🤔 原因:${JSON.stringify(err)}`, `🤔 原因:${JSON.stringify(err)}`,
); );
@ -63,7 +63,7 @@ async function downloadSubscription(req, res) {
); );
} }
} else { } else {
$.notify(`🌍 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 下载订阅失败`, `❌ 未找到订阅:${name}`); $.notify(`🌍 Sub-Store 下载订阅失败`, `❌ 未找到订阅:${name}`);
failed( failed(
res, res,
new ResourceNotFoundError( new ResourceNotFoundError(
@ -117,7 +117,7 @@ async function downloadCollection(req, res) {
} }
} catch (err) { } catch (err) {
$.notify( $.notify(
`🌍 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 下载组合订阅失败`, `🌍 Sub-Store 下载组合订阅失败`,
`❌ 下载组合订阅错误:${name}`, `❌ 下载组合订阅错误:${name}`,
`🤔 原因:${err}`, `🤔 原因:${err}`,
); );
@ -132,7 +132,7 @@ async function downloadCollection(req, res) {
} }
} else { } else {
$.notify( $.notify(
`🌍 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 下载组合订阅失败`, `🌍 Sub-Store 下载组合订阅失败`,
`❌ 未找到组合订阅:${name}`, `❌ 未找到组合订阅:${name}`,
); );
failed( failed(

File diff suppressed because one or more lines are too long

View File

@ -1,32 +1,22 @@
# Sub-Store 配置指南 # 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)即可。 安装使用[插件](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)即可。 安装使用[模块](https://raw.githubusercontent.com/Peng-YM/Sub-Store/master/config/Surge.sgmodule)即可。
### 3. **Quantumult X** ### 3. QX
(1) 订阅[重写](https://raw.githubusercontent.com/Peng-YM/Sub-Store/master/config/QX.snippet) 订阅[重写](https://raw.githubusercontent.com/Peng-YM/Sub-Store/master/config/QX.snippet)即可
(2) 编辑配置文件,在 [task_local] 一节下添加: ### 4. Stash
``` 安装使用[ Stash 覆写](https://raw.githubusercontent.com/Peng-YM/Sub-Store/master/config/Stash.stoverride)即可。
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** ### 5. Shadowrocket
安装使用[ Stash 覆写](https://raw.githubusercontent.com/Peng-YM/Sub-Store/master/config/Stash.stoverride)
### 5. **Shadowrocket**
安装使用[模块](https://raw.githubusercontent.com/Peng-YM/Sub-Store/master/config/Surge.sgmodule)即可。 安装使用[模块](https://raw.githubusercontent.com/Peng-YM/Sub-Store/master/config/Surge.sgmodule)即可。
## 二、使用 Sub-Store ## 使用 Sub-Store
1. 使用 Safari 打开这个 https://sub.store 如网页正常打开并且未弹出任何错误提示,说明 Sub-Store 已经配置成功。
(1) 使用 Safari 打开这个 https://sub.store 如网页正常打开并且未弹出任何错误提示,说明 Sub-Store 已经配置成功。 2. 可以把 Sub-Store 添加到主屏幕,即可获得类似于 APP 的使用体验。
3. 更详细的使用指南请参考[文档](https://www.notion.so/Sub-Store-6259586994d34c11a4ced5c406264b46)。
(2) 把 Sub-Store 添加到主屏幕,即可获得类似于 APP 的使用体验。
(3) 更详细的使用指南请参考[文档](https://www.notion.so/Sub-Store-6259586994d34c11a4ced5c406264b46)。