diff --git a/src/api.js b/src/api.js index a218cc6..704894b 100644 --- a/src/api.js +++ b/src/api.js @@ -119,14 +119,18 @@ async function uploadFile(fn, key) { let realUrl = url; if (backupUrl) { - const pingResult = await tcpPing({ - address: url.replace('https://', ''), - attempts: 4, - timeout: 1000, - }); - // console.log({pingResult}); - if (isNaN(pingResult.avg) || pingResult.avg > 150) { + if (global.USE_ACC_OSS) { realUrl = backupUrl; + } else { + const pingResult = await tcpPing({ + address: url.replace('https://', ''), + attempts: 4, + timeout: 1000, + }); + // console.log({pingResult}); + if (isNaN(pingResult.avg) || pingResult.avg > 150) { + realUrl = backupUrl; + } } // console.log({realUrl}); } diff --git a/src/index.js b/src/index.js index e05a38f..f54cfc9 100644 --- a/src/index.js +++ b/src/index.js @@ -36,6 +36,7 @@ function run() { const argv = require('cli-arguments').parse(require('../cli.json')); global.NO_INTERACTIVE = argv.options['no-interactive']; + global.USE_ACC_OSS = argv.options['acc']; loadSession() .then(()=>commands[argv.command](argv))