mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-09-16 09:41:38 +08:00
Add acc option
This commit is contained in:
18
src/api.js
18
src/api.js
@@ -119,14 +119,18 @@ async function uploadFile(fn, key) {
|
|||||||
let realUrl = url;
|
let realUrl = url;
|
||||||
|
|
||||||
if (backupUrl) {
|
if (backupUrl) {
|
||||||
const pingResult = await tcpPing({
|
if (global.USE_ACC_OSS) {
|
||||||
address: url.replace('https://', ''),
|
|
||||||
attempts: 4,
|
|
||||||
timeout: 1000,
|
|
||||||
});
|
|
||||||
// console.log({pingResult});
|
|
||||||
if (isNaN(pingResult.avg) || pingResult.avg > 150) {
|
|
||||||
realUrl = backupUrl;
|
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});
|
// console.log({realUrl});
|
||||||
}
|
}
|
||||||
|
@@ -36,6 +36,7 @@ function run() {
|
|||||||
|
|
||||||
const argv = require('cli-arguments').parse(require('../cli.json'));
|
const argv = require('cli-arguments').parse(require('../cli.json'));
|
||||||
global.NO_INTERACTIVE = argv.options['no-interactive'];
|
global.NO_INTERACTIVE = argv.options['no-interactive'];
|
||||||
|
global.USE_ACC_OSS = argv.options['acc'];
|
||||||
|
|
||||||
loadSession()
|
loadSession()
|
||||||
.then(()=>commands[argv.command](argv))
|
.then(()=>commands[argv.command](argv))
|
||||||
|
Reference in New Issue
Block a user