rushangle-cli 0.4.0 → 0.4.1
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/package.json +1 -1
- package/src/api.js +5 -4
package/package.json
CHANGED
package/src/api.js
CHANGED
|
@@ -100,18 +100,19 @@ module.exports = {
|
|
|
100
100
|
installedCli() { return apiCall('GET', '/api/cli/installed'); },
|
|
101
101
|
myCli() { return apiCall('GET', '/api/cli/my'); },
|
|
102
102
|
|
|
103
|
-
// CLI file upload
|
|
103
|
+
// CLI file upload (native FormData — compatible with backend busboy/multer)
|
|
104
104
|
async uploadCliFiles(cliId, files) {
|
|
105
105
|
const token = auth.getToken();
|
|
106
|
-
const FormData = require('form-data');
|
|
107
106
|
const form = new FormData();
|
|
108
107
|
for (const { fieldName, filePath } of files) {
|
|
109
|
-
|
|
108
|
+
const content = fs.readFileSync(filePath);
|
|
109
|
+
const blob = new Blob([content], { type: 'application/octet-stream' });
|
|
110
|
+
form.append(fieldName, blob, path.basename(filePath));
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
const res = await fetch(`${SITE_URL}/api/cli/${encodeURIComponent(cliId)}/files`, {
|
|
113
114
|
method: 'POST',
|
|
114
|
-
headers: {
|
|
115
|
+
headers: { 'Authorization': `Bearer ${token}` },
|
|
115
116
|
body: form,
|
|
116
117
|
});
|
|
117
118
|
|