rapay 1.0.2 → 1.0.4
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 +18 -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;
|
|
@@ -165,6 +175,11 @@ async function install() {
|
|
|
165
175
|
// Step 5: Make executable on Unix
|
|
166
176
|
if (platform !== 'win32') {
|
|
167
177
|
fs.chmodSync(destPath, 0o755);
|
|
178
|
+
// Also ensure launcher script is executable
|
|
179
|
+
const launcherPath = path.join(binDir, 'ra');
|
|
180
|
+
if (fs.existsSync(launcherPath)) {
|
|
181
|
+
fs.chmodSync(launcherPath, 0o755);
|
|
182
|
+
}
|
|
168
183
|
}
|
|
169
184
|
|
|
170
185
|
console.log('');
|
|
@@ -180,7 +195,7 @@ async function install() {
|
|
|
180
195
|
console.error('Failed to install Ra Pay CLI:', error.message);
|
|
181
196
|
console.error('');
|
|
182
197
|
console.error('You can manually download the binary from:');
|
|
183
|
-
console.error(
|
|
198
|
+
console.error(`${CDN_BASE}/v${VERSION}/`);
|
|
184
199
|
process.exit(1);
|
|
185
200
|
}
|
|
186
201
|
}
|