Sub-Store 1.2 支持生成远程配置

现在允许用户生成配置并上传到Gist。
This commit is contained in:
Peng-YM
2020-12-08 20:19:46 +08:00
parent 29abac4619
commit bb8bac760e
10 changed files with 403 additions and 36 deletions

View File

@@ -581,14 +581,18 @@ function service() {
async function deleteArtifact(req, res) {
const name = req.params.name;
$.info(`正在删除Artifact${name}`);
try {
const allArtifacts = $.read(ARTIFACTS_KEY);
if (!allArtifacts[name]) throw new Error(`远程配置:${name}不存在!`);
// delete gist
await syncArtifact({
filename: name,
content: ""
});
const artifact = allArtifacts[name];
if (!artifact) throw new Error(`远程配置:${name}不存在!`);
if (artifact.updated) {
// delete gist
await syncArtifact({
filename: name,
content: ""
});
}
// delete local cache
delete allArtifacts[name];
$.write(allArtifacts, ARTIFACTS_KEY);

File diff suppressed because one or more lines are too long