Просмотр исходного кода

feat: add custom user agent option in new tab block

Ahmad Kholid 3 лет назад
Родитель
Сommit
f84d71ad29

+ 0 - 1
src/background/index.js

@@ -355,7 +355,6 @@ message.on('set:active-tab', (tabId) => {
 
 message.on('debugger:send-command', ({ tabId, method, params }) => {
   return new Promise((resolve) => {
-    console.log(tabId, method, params);
     chrome.debugger.sendCommand({ tabId }, method, params, resolve);
   });
 });

+ 6 - 9
src/background/workflow-engine/blocks-handler/handler-new-tab.js

@@ -4,7 +4,7 @@ import {
   attachDebugger,
   sendDebugCommand,
 } from '../helper';
-import { isWhitespace } from '@/utils/helper';
+import { isWhitespace, sleep } from '@/utils/helper';
 
 async function newTab(block) {
   if (this.windowId) {
@@ -49,14 +49,11 @@ async function newTab(block) {
         await attachDebugger(tab.id, this.activeTab.id);
 
         if (customUserAgent) {
-          const res = await sendDebugCommand(
-            tab.id,
-            'Network.setUserAgentOverride',
-            {
-              userAgent,
-            }
-          );
-          console.log('agent:', res);
+          await sendDebugCommand(tab.id, 'Network.setUserAgentOverride', {
+            userAgent,
+          });
+          await browser.tabs.reload(tab.id);
+          await sleep(1000);
         }
       }
 

+ 0 - 1
src/components/newtab/workflow/WorkflowDataTable.vue

@@ -105,7 +105,6 @@ function addColumn() {
 watch(
   () => state.columns,
   debounce((newValue) => {
-    console.log(newValue);
     emit('update', { table: newValue });
   }, 250),
   { deep: true }

+ 0 - 1
src/components/newtab/workflow/edit/EditNewTab.vue

@@ -36,7 +36,6 @@
       {{ t('workflow.blocks.new-tab.tabToGroup') }}
     </ui-checkbox>
     <ui-checkbox
-      v-if="false"
       :model-value="data.customUserAgent"
       block
       class="mt-2"