mirror of
https://gitcode.com/github-mirrors/react-native-update-cli.git
synced 2025-09-17 10:02:19 +08:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a9dea5c188 | ||
![]() |
83fe70f840 | ||
![]() |
f1dd31cd56 | ||
![]() |
a6477b4f0f |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-update-cli",
|
||||
"version": "1.0.8",
|
||||
"version": "1.1.0",
|
||||
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
|
@@ -101,7 +101,7 @@ exports.post = queryWithBody('POST');
|
||||
exports.put = queryWithBody('PUT');
|
||||
exports.doDelete = queryWithBody('DELETE');
|
||||
|
||||
async function uploadFile(fn) {
|
||||
async function uploadFile(fn, key) {
|
||||
const { url, backupUrl, formData } = await exports.post('/upload', {});
|
||||
let realUrl = url;
|
||||
|
||||
@@ -112,7 +112,7 @@ async function uploadFile(fn) {
|
||||
timeout: 1000,
|
||||
});
|
||||
// console.log({pingResult});
|
||||
if (pingResult.avg > 150) {
|
||||
if (isNaN(pingResult.avg) || pingResult.avg > 150) {
|
||||
realUrl = backupUrl;
|
||||
}
|
||||
// console.log({realUrl});
|
||||
@@ -127,6 +127,9 @@ async function uploadFile(fn) {
|
||||
});
|
||||
|
||||
const info = await new Promise((resolve, reject) => {
|
||||
if (key) {
|
||||
formData.key = key;
|
||||
}
|
||||
formData.file = fs.createReadStream(fn);
|
||||
|
||||
formData.file.on('data', function(data) {
|
||||
|
Reference in New Issue
Block a user