rapay 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/install.js +13 -3
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -56,8 +56,18 @@ function download(url) {
|
|
|
56
56
|
const chunks = [];
|
|
57
57
|
|
|
58
58
|
const request = (url) => {
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
const urlObj = new URL(url);
|
|
60
|
+
const options = {
|
|
61
|
+
hostname: urlObj.hostname,
|
|
62
|
+
path: urlObj.pathname,
|
|
63
|
+
headers: {
|
|
64
|
+
'User-Agent': 'rapay-installer/1.0',
|
|
65
|
+
'Accept': '*/*'
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
https.get(options, (response) => {
|
|
70
|
+
// Handle redirects
|
|
61
71
|
if (response.statusCode === 301 || response.statusCode === 302) {
|
|
62
72
|
request(response.headers.location);
|
|
63
73
|
return;
|
|
@@ -180,7 +190,7 @@ async function install() {
|
|
|
180
190
|
console.error('Failed to install Ra Pay CLI:', error.message);
|
|
181
191
|
console.error('');
|
|
182
192
|
console.error('You can manually download the binary from:');
|
|
183
|
-
console.error(
|
|
193
|
+
console.error(`${CDN_BASE}/v${VERSION}/`);
|
|
184
194
|
process.exit(1);
|
|
185
195
|
}
|
|
186
196
|
}
|