mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2026-04-01 22:13:19 +08:00
feat: 内容无变化时 不进行上传; 增加 gist 数量日志
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.16.55",
|
"version": "2.16.56",
|
||||||
"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": {
|
||||||
|
|||||||
@@ -109,6 +109,21 @@ async function gistBackupAction(action) {
|
|||||||
const updated = settings.syncTime;
|
const updated = settings.syncTime;
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case 'upload':
|
case 'upload':
|
||||||
|
try {
|
||||||
|
content = $.read('#sub-store');
|
||||||
|
if ($.env.isNode) content = JSON.stringify($.cache, null, ` `);
|
||||||
|
$.info(`下载备份, 与本地内容对比...`);
|
||||||
|
const onlineContent = await gist.download(
|
||||||
|
GIST_BACKUP_FILE_NAME,
|
||||||
|
);
|
||||||
|
if (onlineContent === content) {
|
||||||
|
$.info(`内容一致, 无需上传备份`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
$.error(`${error.message ?? error}`);
|
||||||
|
}
|
||||||
|
|
||||||
// update syncTime
|
// update syncTime
|
||||||
settings.syncTime = new Date().getTime();
|
settings.syncTime = new Date().getTime();
|
||||||
$.write(settings, SETTINGS_KEY);
|
$.write(settings, SETTINGS_KEY);
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ export default class Gist {
|
|||||||
.get('/gists?per_page=100&page=1')
|
.get('/gists?per_page=100&page=1')
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
const gists = JSON.parse(response.body);
|
const gists = JSON.parse(response.body);
|
||||||
|
$.info(`获取到当前 GitHub 用户的 gist: ${gists.length} 个`);
|
||||||
for (let g of gists) {
|
for (let g of gists) {
|
||||||
if (g.description === this.key) {
|
if (g.description === this.key) {
|
||||||
return g;
|
return g;
|
||||||
|
|||||||
Reference in New Issue
Block a user