Fixed cronSyncArtifact failed issue

This commit is contained in:
Peng-YM committed 2022-05-18 11:06:40 +08:00
1 parent 5954ff0a58
commit 48d533af83
4 files changed
+120 -149

No files matched your search

+90 -118
View File
@@ -12,6 +12,7 @@
*/
const $ = API("sub-store");
const Base64 = new Base64Code();
const $downloader = new ResourceDownloader();
service();
@@ -143,10 +144,6 @@ function service() {
const {raw} = req.query || "false";
const platform =
req.query.target || getPlatformFromHeaders(req.headers) || "JSON";
const useCache =
typeof cache === "undefined"
? platform === "JSON" || platform === "URI"
: cache;
$.info(`正在下载订阅:${name}`);
@@ -158,7 +155,6 @@ function service() {
type: "subscription",
item: sub,
platform,
useCache,
noProcessor: raw,
});
@@ -307,14 +303,9 @@ function service() {
// collection API
async function downloadCollection(req, res) {
const {name} = req.params;
const {cache} = req.query || "false";
const {raw} = req.query || "false";
const platform =
req.query.target || getPlatformFromHeaders(req.headers) || "JSON";
const useCache =
typeof cache === "undefined"
? platform === "JSON" || platform === "URI"
: cache;
const allCollections = $.read(COLLECTIONS_KEY);
const collection = allCollections[name];
@@ -338,7 +329,6 @@ function service() {
type: "collection",
item: collection,
platform,
useCache,
noProcessor: raw,
});
if (platform === "JSON") {
@@ -558,8 +548,7 @@ function service() {
console.log(JSON.stringify(artifact, null, 2));
try {
const resp = await syncArtifact({
filename: artifact.name,
content: output,
[artifact.name]: {content: output},
});
artifact.updated = new Date().getTime();
const body = JSON.parse(resp.body);
@@ -657,13 +646,12 @@ function service() {
async function cronSyncArtifacts(req, res) {
$.info("开始同步所有远程配置...");
const allArtifacts = $.read(ARTIFACTS_KEY);
let success = [],
failed = [];
const files = {};
await Promise.all(Object.values(allArtifacts).map(async artifact => {
if (artifact.sync) {
$.info(`正在同步云配置:${artifact.name}...`);
try {
try {
await Promise.all(Object.values(allArtifacts).map(async artifact => {
if (artifact.sync) {
$.info(`正在同步云配置:${artifact.name}...`);
let item;
switch (artifact.type) {
case "subscription":
@@ -679,41 +667,36 @@ function service() {
const output = await produceArtifact({
type: artifact.type,
item,
platform: artifact.platform,
useCache: true
platform: artifact.platform
});
const resp = await syncArtifact({
filename: artifact.name,
content: output,
});
artifact.updated = new Date().getTime();
const body = JSON.parse(resp.body);
// extract real url from gist
artifact.url = body.files[artifact.name].raw_url.replace(
/\/raw\/[^\/]*\/(.*)/,
"/raw/$1"
);
$.write(allArtifacts, ARTIFACTS_KEY);
$.info(`✅ 成功同步云配置:${artifact.name}`);
success.push(artifact);
} catch (err) {
$.error(`云配置: ${artifact.name} 同步失败!原因:${err}`);
$.notify(
`🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』 同步订阅失败`,
`❌ 无法同步订阅:${artifact.name}!`,
`🤔 原因:${err}`
);
failed.push(artifact);
files[artifact.name] = {
content: output
};
}
}
}));
}));
res.json({
success,
failed,
});
const resp = await syncArtifact(files);
const body = JSON.parse(resp.body);
for (const artifact of Object.values(allArtifacts)) {
artifact.updated = new Date().getTime();
// extract real url from gist
artifact.url = body.files[artifact.name].raw_url.replace(
/\/raw\/[^\/]*\/(.*)/,
"/raw/$1"
);
}
$.write(allArtifacts, ARTIFACTS_KEY);
$.info("全部订阅同步成功!")
res.status(200).end();
} catch (err) {
res.status(500).json({
error: err
});
$.info(`同步订阅失败,原因:${err}`);
}
}
async function deleteArtifact(req, res) {
@@ -755,8 +738,7 @@ function service() {
});
}
async function syncArtifact({filename, content}) {
await new Promise(r => setTimeout(r, Math.random() * 2000));
async function syncArtifact(files) {
const {gistToken} = $.read(SETTINGS_KEY);
if (!gistToken) {
return Promise.reject("未设置Gist Token!");
@@ -765,7 +747,7 @@ function service() {
token: gistToken,
key: ARTIFACT_REPOSITORY_KEY,
});
return manager.upload({filename, content});
return manager.upload(files);
}
// util API
@@ -827,7 +809,7 @@ function service() {
content = $.read("#sub-store");
if ($.env.isNode) content = JSON.stringify($.cache, null, ` `)
$.info(`上传备份中...`);
await gist.upload({filename: GIST_BACKUP_FILE_NAME, content});
await gist.upload({[GIST_BACKUP_FILE_NAME]: { content }});
break;
case "download":
$.info(`还原备份中...`);
@@ -879,63 +861,15 @@ function service() {
}
}
// get resource, with cache ability to speedup response time
async function getResource(url, useCache = true, userAgent) {
// use QX agent to get flow headers ,if not assign user-agent
let ua = userAgent
if (typeof userAgent == "undefined" || userAgent == null || userAgent.trim().length == 0) {
ua = "Quantumult%20X"
}
const $http = HTTP({
headers: {
"User-Agent": ua,
},
});
let key = `#${MD5(url)}`;
const resource = $.read(key);
$.log("Cached resource: " + resource);
let timeKey = `#TIME-${MD5(url)}`;
const ONE_MINUTE = 60 * 1000;
const outdated = new Date().getTime() - $.read(timeKey) > ONE_MINUTE;
$.log(`Cache time: ${$.read(timeKey)}`);
$.log(`Cache outdated? ${outdated}`);
if (useCache && resource && !outdated) {
$.log(`Use cached for resource: ${url}`);
return resource;
}
let body = "";
try {
const resp = await $http.get(url);
body = resp.body;
} catch (err) {
throw new Error(err);
} finally {
$.write(body, key);
$.write(JSON.stringify(new Date().getTime()), timeKey);
$.log("Writing cache");
}
if (body.replace(/\s/g, "").length === 0) {
throw new Error("订阅内容为空!");
}
return body;
}
async function produceArtifact(
{type, item, platform, useCache, noProcessor} = {
{type, item, platform, noProcessor} = {
platform: "JSON",
useCache: false,
noProcessor: false,
}
) {
if (type === "subscription") {
const sub = item;
const raw = await getResource(sub.url, useCache, sub.ua);
const raw = await $downloader.download(sub.url, sub.ua);
// parse proxies
let proxies = ProxyUtils.parse(raw);
if (!noProcessor) {
@@ -958,14 +892,14 @@ function service() {
const collection = item;
const subs = collection["subscriptions"];
let proxies = [];
for (let i = 0; i < subs.length; i++) {
const sub = allSubs[subs[i]];
$.info(
`正在处理子订阅:${sub.name},进度--${100 * ((i + 1) / subs.length).toFixed(1)
}% `
);
let processed = 0;
await Promise.all(subs.map(async name => {
const sub = allSubs[name];
try {
const raw = await getResource(sub.url, useCache, sub.ua);
$.info(`正在处理子订阅:${sub.name}...`);
const raw = await $downloader.download(sub.url, sub.ua);
// parse proxies
let currentProxies = ProxyUtils.parse(raw);
if (!noProcessor) {
@@ -978,12 +912,17 @@ function service() {
}
// merge
proxies = proxies.concat(currentProxies);
processed++;
$.info(
`✅ 子订阅:${sub.name}加载成功,进度--${100 * (processed / subs.length).toFixed(1)}% `
);
} catch (err) {
processed++;
$.error(
`处理组合订阅中的子订阅: ${sub.name}时出现错误:${err}! 该订阅已被跳过。`
`❌ 处理组合订阅中的子订阅: ${sub.name}时出现错误:${err},该订阅已被跳过!进度--${100 * (processed / subs.length).toFixed(1)}%`
);
}
}
}));
if (!noProcessor) {
// apply own processors
proxies = await ProxyUtils.process(proxies, collection.process || [], platform);
@@ -1011,7 +950,7 @@ function service() {
}% `
);
try {
const {body} = await $.http.get(url);
const {body} = await $downloader.download(url);
const currentRules = RuleUtils.parse(body);
rules = rules.concat(currentRules);
} catch (err) {
@@ -3718,11 +3657,8 @@ function Gist({token, key}) {
});
}
this.upload = async function ({filename, content}) {
this.upload = async function (files) {
const id = await locate();
const files = {
[filename]: {content},
};
if (id === -1) {
// create a new gist for backup
@@ -8305,3 +8241,39 @@ function MD5(string) {
var temp = WordToHex(a) + WordToHex(b) + WordToHex(c) + WordToHex(d);
return temp.toLowerCase();
}
function ResourceDownloader() {
const cache = {};
async function download(url, userAgent = "Quantumult%20X") {
const id = userAgent + url;
if (cache[id]) {
$.log("Cache hit for: " + url);
return cache[id];
}
const $http = HTTP({
headers: {
"User-Agent": userAgent,
},
});
const result = new Promise((resolve, reject) => {
$http.get(url).then(resp => {
const body = resp.body;
if (body.replace(/\s/g, "").length === 0)
reject(new Error("订阅内容为空!"));
else
resolve(body);
});
});
cache[id] = result;
return result;
}
return {
download
}
}
+2 -2
View File
@@ -1,2 +1,2 @@
// UPDATED AT: 2022年 5月14日 星期六 14时37分29秒 CST
const $=API("sub-store"),Base64=new Base64Code;function service(){console.log("\n┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅\n 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 © 𝑷𝒆𝒏𝒈-𝒀𝑴\n┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅\n");const e=express(),t="settings",n="subs",r="collections",s="rules",o="builtin",i="artifacts",a="Auto Generated Sub-Store Backup",c="Sub-Store",l="Sub-Store Artifacts Repository";async function p({filename:e,content:n}){await new Promise(e=>setTimeout(e,2e3*Math.random()));const{gistToken:r}=$.read(t);return r?new Gist({token:r,key:l}).upload({filename:e,content:n}):Promise.reject("未设置Gist Token!")}async function u(e){const{headers:t}=await $.http.get({url:e,headers:{"User-Agent":"Quantumult/1.0.13 (iPhone10,3; iOS 14.0)"}});return t[Object.keys(t).filter(e=>/SUBSCRIPTION-USERINFO/i.test(e))[0]]}function f(e){const t=Object.keys(e);let n="";for(let r of t)if(/USER-AGENT/i.test(r)){n=e[r];break}return-1!==n.indexOf("Quantumult%20X")?"QX":-1!==n.indexOf("Surge")?"Surge":-1!==n.indexOf("Decar")||-1!==n.indexOf("Loon")?"Loon":-1!==n.indexOf("Stash")||-1!==n.indexOf("Shadowrocket")?"Clash":null}async function d(e,t=!0,n){let r=n;void 0!==n&&null!=n&&0!=n.trim().length||(r="Quantumult%20X");const s=HTTP({headers:{"User-Agent":r}});let o=`#${MD5(e)}`;const i=$.read(o);$.log("Cached resource: "+i);let a=`#TIME-${MD5(e)}`;const c=(new Date).getTime()-$.read(a)>6e4;if($.log(`Cache time: ${$.read(a)}`),$.log(`Cache outdated? ${c}`),t&&i&&!c)return $.log(`Use cached for resource: ${e}`),i;let l="";try{l=(await s.get(e)).body}catch(e){throw new Error(e)}finally{$.write(l,o),$.write(JSON.stringify((new Date).getTime()),a),$.log("Writing cache")}if(0===l.replace(/\s/g,"").length)throw new Error("订阅内容为空!");return l}async function h({type:e,item:t,platform:r,useCache:s,noProcessor:o}={platform:"JSON",useCache:!1,noProcessor:!1}){if("subscription"===e){const e=t,n=await d(e.url,s,e.ua);let i=ProxyUtils.parse(n);o||(i=await ProxyUtils.process(i,e.process||[],r));const a={};return i.forEach(e=>{a[e.name]&&$.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』","⚠️ 订阅包含重复节点!","请仔细检测配置!",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"})}),ProxyUtils.produce(i,r)}if("collection"===e){const e=$.read(n),i=t,a=i.subscriptions;let c=[];for(let t=0;t<a.length;t++){const n=e[a[t]];$.info(`正在处理子订阅:${n.name},进度--${100*((t+1)/a.length).toFixed(1)}% `);try{const e=await d(n.url,s,n.ua);let t=ProxyUtils.parse(e);o||(t=await ProxyUtils.process(t,n.process||[],r)),c=c.concat(t)}catch(e){$.error(`处理组合订阅中的子订阅: ${n.name}时出现错误:${e}! 该订阅已被跳过。`)}}if(o||(c=await ProxyUtils.process(c,i.process||[],r)),0===c.length)throw new Error("组合订阅中不含有效节点!");const l={};return c.forEach(e=>{l[e.name]&&$.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』","⚠️ 订阅包含重复节点!","请仔细检测配置!",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"})}),ProxyUtils.produce(c,r)}if("rule"===e){const e=t;let n=[];for(let t=0;t<e.urls.length;t++){const r=e.urls[t];$.info(`正在处理URL:${r},进度--${100*((t+1)/e.urls.length).toFixed(1)}% `);try{const{body:e}=await $.http.get(r),t=RuleUtils.parse(e);n=n.concat(t)}catch(e){$.error(`处理分流订阅中的URL: ${r}时出现错误:${e}! 该订阅已被跳过。`)}}return n=await RuleUtils.process(n,[{type:"Remove Duplicate Filter"}]),RuleUtils.produce(n,r)}}$.read(n)||$.write({},n),$.read(r)||$.write({},r),$.read(t)||$.write({},t),$.read(s)||$.write({},s),$.read(i)||$.write({},i),$.write({rules:getBuiltInRules()},o),e.get("/download/collection/:name",async function(e,t){const{name:s}=e.params,{cache:o}=e.query||"false",{raw:i}=e.query||"false",a=e.query.target||f(e.headers)||"JSON",c=void 0===o?"JSON"===a||"URI"===a:o,l=$.read(r)[s];$.info(`正在下载组合订阅:${s}`);const p=$.read(n),d=l.subscriptions;if(d.length>0){const e=p[d[0]],n=await u(e.url);n&&t.set("subscription-userinfo",n)}if(l)try{const e=await h({type:"collection",item:l,platform:a,useCache:c,noProcessor:i});"JSON"===a?t.set("Content-Type","application/json;charset=utf-8").send(e):t.send(e)}catch(e){$.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』 下载组合订阅失败",`❌ 下载组合订阅错误:${s}!`,`🤔 原因:${e}`),t.status(500).json({status:"failed",message:e})}else $.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』 下载组合订阅失败",`❌ 未找到组合订阅:${s}!`),t.status(404).json({status:"failed"})}),e.get("/download/:namLine truncated
// UPDATED AT: 2022年 5月18日 星期三 11时05分30秒 CST
const $=API("sub-store"),Base64=new Base64Code,$downloader=new ResourceDownloader;function service(){console.log("\n┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅\n 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 © 𝑷𝒆𝒏𝒈-𝒀𝑴\n┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅\n");const e=express(),t="settings",n="subs",r="collections",s="rules",o="builtin",i="artifacts",a="Auto Generated Sub-Store Backup",c="Sub-Store",l="Sub-Store Artifacts Repository";async function p(e){const{gistToken:n}=$.read(t);return n?new Gist({token:n,key:l}).upload(e):Promise.reject("未设置Gist Token!")}async function u(e){const{headers:t}=await $.http.get({url:e,headers:{"User-Agent":"Quantumult/1.0.13 (iPhone10,3; iOS 14.0)"}});return t[Object.keys(t).filter(e=>/SUBSCRIPTION-USERINFO/i.test(e))[0]]}function f(e){const t=Object.keys(e);let n="";for(let r of t)if(/USER-AGENT/i.test(r)){n=e[r];break}return-1!==n.indexOf("Quantumult%20X")?"QX":-1!==n.indexOf("Surge")?"Surge":-1!==n.indexOf("Decar")||-1!==n.indexOf("Loon")?"Loon":-1!==n.indexOf("Stash")||-1!==n.indexOf("Shadowrocket")?"Clash":null}async function d({type:e,item:t,platform:r,noProcessor:s}={platform:"JSON",noProcessor:!1}){if("subscription"===e){const e=t,n=await $downloader.download(e.url,e.ua);let o=ProxyUtils.parse(n);s||(o=await ProxyUtils.process(o,e.process||[],r));const i={};return o.forEach(e=>{i[e.name]&&$.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』","⚠️ 订阅包含重复节点!","请仔细检测配置!",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"})}),ProxyUtils.produce(o,r)}if("collection"===e){const e=$.read(n),o=t,i=o.subscriptions;let a=[],c=0;if(await Promise.all(i.map(async t=>{const n=e[t];try{$.info(`正在处理子订阅:${n.name}...`);const e=await $downloader.download(n.url,n.ua);let t=ProxyUtils.parse(e);s||(t=await ProxyUtils.process(t,n.process||[],r)),a=a.concat(t),c++,$.info(`✅ 子订阅:${n.name}加载成功,进度--${100*(c/i.length).toFixed(1)}% `)}catch(e){c++,$.error(`❌ 处理组合订阅中的子订阅: ${n.name}时出现错误:${e},该订阅已被跳过!进度--${100*(c/i.length).toFixed(1)}%`)}})),s||(a=await ProxyUtils.process(a,o.process||[],r)),0===a.length)throw new Error("组合订阅中不含有效节点!");const l={};return a.forEach(e=>{l[e.name]&&$.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』","⚠️ 订阅包含重复节点!","请仔细检测配置!",{"media-url":"https://cdn3.iconfinder.com/data/icons/seo-outline-1/512/25_code_program_programming_develop_bug_search_developer-512.png"})}),ProxyUtils.produce(a,r)}if("rule"===e){const e=t;let n=[];for(let t=0;t<e.urls.length;t++){const r=e.urls[t];$.info(`正在处理URL:${r},进度--${100*((t+1)/e.urls.length).toFixed(1)}% `);try{const{body:e}=await $downloader.download(r),t=RuleUtils.parse(e);n=n.concat(t)}catch(e){$.error(`处理分流订阅中的URL: ${r}时出现错误:${e}! 该订阅已被跳过。`)}}return n=await RuleUtils.process(n,[{type:"Remove Duplicate Filter"}]),RuleUtils.produce(n,r)}}$.read(n)||$.write({},n),$.read(r)||$.write({},r),$.read(t)||$.write({},t),$.read(s)||$.write({},s),$.read(i)||$.write({},i),$.write({rules:getBuiltInRules()},o),e.get("/download/collection/:name",async function(e,t){const{name:s}=e.params,{raw:o}=e.query||"false",i=e.query.target||f(e.headers)||"JSON",a=$.read(r)[s];$.info(`正在下载组合订阅:${s}`);const c=$.read(n),l=a.subscriptions;if(l.length>0){const e=c[l[0]],n=await u(e.url);n&&t.set("subscription-userinfo",n)}if(a)try{const e=await d({type:"collection",item:a,platform:i,noProcessor:o});"JSON"===i?t.set("Content-Type","application/json;charset=utf-8").send(e):t.send(e)}catch(e){$.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』 下载组合订阅失败",`❌ 下载组合订阅错误:${s}!`,`🤔 原因:${e}`),t.status(500).json({status:"failed",message:e})}else $.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』 下载组合订阅失败",`❌ 未找到组合订阅:${s}!`),t.status(404).json({status:"failed"})}),e.get("/download/:name",async function(e,t){const{name:r}=e.params,{cache:s}=e.query,{raw:o}=e.query||"false",i=e.query.target||f(e.headers)||"JSON";$.info(`正在下载订阅:${r}`);const a=$.read(n)[r];if(a)try{const e=await d({type:"subscription",item:a,platform:i,noProcessor:o}),n=await u(a.url);n&&t.set("subscription-userinfo",n),"JSON"===i?t.set("Content-Type","application/json;charset=utf-8").send(e):t.send(e)}catch(e){$.notify("🌍 『 𝑺𝒖𝒃-𝑺𝒕𝒐𝒓𝒆 』 下载订阅失败",`❌ 无法下载订阅:${r}!`,`🤔 原因:${JSON.stringify(e)}`),$.error(JSON.stringify(e)),t.status(500).json({status:"failed",message:e})}else $Line truncated
+22 -22
View File
@@ -108,31 +108,31 @@ export default {
}
},
methods: {
async refresh() {
await axios.post(`/utils/refresh`, {url: this.sub});
await this.fetch();
},
async fetch() {
await axios.get(this.raw ? `${this.url}?raw=true` : this.url).then(resp => {
let {data} = resp;
// eslint-disable-next-line no-debugger
this.proxies = data;
}).catch(err => {
this.$store.commit("SET_ERROR_MESSAGE", err);
});
try {
this.$store.commit("SET_LOADING", true);
await axios.get(this.raw ? `${this.url}?raw=true` : this.url).then(resp => {
let {data} = resp;
// eslint-disable-next-line no-debugger
this.proxies = data;
}).catch(err => {
this.$store.commit("SET_ERROR_MESSAGE", err);
});
await axios.get(this.raw ? `${this.url}?target=URI&raw=true` : `${this.url}?target=URI`).then(resp => {
const {data} = resp;
this.uris = data.split("\n");
});
await axios.get(this.raw ? `${this.url}?target=URI&raw=true` : `${this.url}?target=URI`).then(resp => {
const {data} = resp;
this.uris = data.split("\n");
});
// fix http offset
this.proxies.forEach((p, idx) => {
if (p.type === 'http') {
this.uris.splice(idx, 0, null);
}
})
// fix http offset
this.proxies.forEach((p, idx) => {
if (p.type === 'http') {
this.uris.splice(idx, 0, null);
}
})
} finally {
this.$store.commit("SET_LOADING", false);
}
},
async showInfo(idx) {
+6 -7
View File
@@ -322,16 +322,15 @@ export default {
},
async syncAllArtifacts() {
this.$store.commit("SET_LOADING", true);
try {
const {data} = await axios.get(`/cron/sync-artifacts`);
const {failed} = data;
if (failed.length > 0) {
this.$store.commit("SET_ERROR_MESSAGE", `部分配置(${failed.map(artifact => artifact.name).join(", ")})同步失败,请查看日志!`);
} else {
this.$store.commit("SET_SUCCESS_MESSAGE", `Gist 同步生成节点成功!`);
}
await axios.get(`/cron/sync-artifacts`);
await this.$store.dispatch("FETCH_ARTIFACTS");
this.$store.commit("SET_SUCCESS_MESSAGE", `Gist 同步生成节点成功!`);
} catch (err) {
this.$store.commit("SET_ERROR_MESSAGE", `Gist 同步生成节点失败!${err}`);
} finally {
this.$store.commit("SET_LOADING", false);
}
},