channel-worker 1.0.27 → 1.0.29
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/command-poller.js +10 -1
- package/package.json +1 -1
package/lib/command-poller.js
CHANGED
|
@@ -550,7 +550,7 @@ class CommandPoller {
|
|
|
550
550
|
}
|
|
551
551
|
|
|
552
552
|
async handleTypeText(command) {
|
|
553
|
-
const { text, profile_id, url_match, focus_selector } = command.payload || {};
|
|
553
|
+
const { text, profile_id, url_match, focus_selector, press_enter } = command.payload || {};
|
|
554
554
|
console.log(`[commands] Typing text (${text?.length} chars) for profile: ${profile_id}`);
|
|
555
555
|
try {
|
|
556
556
|
const WebSocket = require('ws');
|
|
@@ -620,6 +620,15 @@ class CommandPoller {
|
|
|
620
620
|
await new Promise(r => setTimeout(r, 300));
|
|
621
621
|
// Type text
|
|
622
622
|
await send('Input.insertText', { text });
|
|
623
|
+
// Press Enter/comma if requested (to confirm tag)
|
|
624
|
+
if (press_enter) {
|
|
625
|
+
// Type comma to separate tags (Facebook accepts comma as delimiter)
|
|
626
|
+
await send('Input.insertText', { text: ',' });
|
|
627
|
+
await new Promise(r => setTimeout(r, 300));
|
|
628
|
+
// Also press Enter
|
|
629
|
+
await send('Input.dispatchKeyEvent', { type: 'rawKeyDown', key: 'Enter', code: 'Enter', windowsVirtualKeyCode: 13, nativeVirtualKeyCode: 13 });
|
|
630
|
+
await send('Input.dispatchKeyEvent', { type: 'keyUp', key: 'Enter', code: 'Enter', windowsVirtualKeyCode: 13, nativeVirtualKeyCode: 13 });
|
|
631
|
+
}
|
|
623
632
|
ws.close();
|
|
624
633
|
resolve({ success: true, length: text.length });
|
|
625
634
|
} catch (e) { ws.close(); resolve({ success: false, error: e.message }); }
|