channel-worker 1.6.17 → 1.6.19
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/lib/api-client.js +1 -1
- package/lib/nst-manager.js +14 -22
- package/package.json +1 -1
package/lib/api-client.js
CHANGED
|
@@ -65,7 +65,7 @@ class ApiClient {
|
|
|
65
65
|
|
|
66
66
|
// Commands
|
|
67
67
|
async getNextCommand(workerId) {
|
|
68
|
-
const workerTypes = 'launch_profile,close_profile,launch_veo3_profile,save_file,set_thumbnail,set_tags,set_file_input,click_and_upload,type_text,verify_logins,update_extension,sync_youtube_stats,restart_worker';
|
|
68
|
+
const workerTypes = 'launch_profile,close_profile,launch_veo3_profile,set_profile_proxy,save_file,set_thumbnail,set_tags,set_file_input,click_and_upload,type_text,verify_logins,update_extension,sync_youtube_stats,restart_worker';
|
|
69
69
|
return this.request('GET', `/workers/commands?worker_id=${workerId}&types=${encodeURIComponent(workerTypes)}`);
|
|
70
70
|
}
|
|
71
71
|
|
package/lib/nst-manager.js
CHANGED
|
@@ -117,29 +117,21 @@ class NstManager {
|
|
|
117
117
|
async setProxy(profileId, proxyUrl) {
|
|
118
118
|
if (!proxyUrl) return;
|
|
119
119
|
console.log(`[nst] Setting proxy for ${profileId}: ${proxyUrl}`);
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const res = await fetch(`${this.baseUrl}/profiles/${profileId}`, {
|
|
135
|
-
method,
|
|
136
|
-
headers: { 'Content-Type': 'application/json', 'x-api-key': this.apiKey },
|
|
137
|
-
body: JSON.stringify(proxyConfig),
|
|
138
|
-
});
|
|
139
|
-
if (res.ok) { console.log(`[nst] Proxy saved to profile (${method})`); return; }
|
|
140
|
-
} catch {}
|
|
120
|
+
try {
|
|
121
|
+
const res = await fetch(`${this.baseUrl}/profiles/${profileId}/proxy`, {
|
|
122
|
+
method: 'PUT',
|
|
123
|
+
headers: { 'Content-Type': 'application/json', 'x-api-key': this.apiKey },
|
|
124
|
+
body: JSON.stringify({ url: proxyUrl }),
|
|
125
|
+
});
|
|
126
|
+
const text = await res.text();
|
|
127
|
+
if (res.ok) {
|
|
128
|
+
console.log(`[nst] Proxy saved to profile`);
|
|
129
|
+
} else {
|
|
130
|
+
console.warn(`[nst] setProxy failed ${res.status}: ${text.substring(0, 200)}`);
|
|
131
|
+
}
|
|
132
|
+
} catch (e) {
|
|
133
|
+
console.warn(`[nst] setProxy error: ${e.message}`);
|
|
141
134
|
}
|
|
142
|
-
console.warn(`[nst] Failed to save proxy to profile — will still use at launch time`);
|
|
143
135
|
}
|
|
144
136
|
|
|
145
137
|
// Launch browser — skip if already running, set proxy if provided
|