From 3b94ccac7deb8b55b4b8ae1148e59513dabfed53 Mon Sep 17 00:00:00 2001 From: liaojack8 Date: Sun, 5 Jul 2020 22:55:15 +0800 Subject: [PATCH] fix idiot problem --- src/gd.js | 5 +++-- src/tg.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gd.js b/src/gd.js index a21abf6..1cac3b7 100644 --- a/src/gd.js +++ b/src/gd.js @@ -289,7 +289,7 @@ async function get_access_token () { // get_sa_token().catch(console.error) async function get_sa_token () { - if (use_sa && !SA_TOKENS.length) SA_TOKENS = get_sa_batch() + if (!SA_TOKENS.length) SA_TOKENS = get_sa_batch() while (SA_TOKENS.length) { const tk = get_random_element(SA_TOKENS) try { @@ -567,8 +567,9 @@ async function copy_file (id, parent, use_sa, limit) { } } } - if (!SA_TOKENS.length) { + if (use_sa && !SA_TOKENS.length) { if (limit) limit.clearQueue() + if (task_id) db.prepare('update task set status=? where id=?').run('error', task_id) throw new Error('所有SA帐号流量已用完') } else { console.warn('复制文件失败,文件id: ' + id) diff --git a/src/tg.js b/src/tg.js index 53145ce..c9217f8 100644 --- a/src/tg.js +++ b/src/tg.js @@ -157,7 +157,7 @@ async function tg_copy ({ fid, target, chat_id, update }) { // return task_id } } - real_copy({ source: fid, update, target, service_account: !USE_PERSONAL_AUTH, is_server: true }) + real_copy({ source: fid, update, target, not_teamdrive: true, service_account: true, is_server: true }) .then(async info => { if (!record) record = {} // 防止无限循环 if (!info) return