소스 검색

fix: can't jump to a block on running workflows page

Ahmad Kholid 2 년 전
부모
커밋
05806f44ff
4개의 변경된 파일6개의 추가작업 그리고 23개의 파일을 삭제
  1. 2 0
      src/manifest.chrome.json
  2. 2 0
      src/manifest.firefox.json
  3. 2 1
      src/newtab/pages/logs/Running.vue
  4. 0 22
      src/utils/api.js

+ 2 - 0
src/manifest.chrome.json

@@ -25,6 +25,7 @@
     {
       "matches": ["<all_urls>"],
       "js": ["contentScript.bundle.js"],
+      "run_at": "document_start",
       "all_frames": true
     },
     {
@@ -34,6 +35,7 @@
         "*://automa.vercel.app/*"
       ],
       "js": ["webService.bundle.js"],
+      "run_at": "document_start",
       "all_frames": false
     }
   ],

+ 2 - 0
src/manifest.firefox.json

@@ -30,11 +30,13 @@
     {
       "matches": ["<all_urls>"],
       "js": ["contentScript.bundle.js"],
+      "run_at": "document_start",
       "all_frames": true
     },
     {
       "matches": ["*://*.automa.site/*", "*://automa.vercel.app/*"],
       "js": ["webService.bundle.js"],
+      "run_at": "document_start",
       "all_frames": false
     }
   ],

+ 2 - 1
src/newtab/pages/logs/Running.vue

@@ -105,12 +105,13 @@ function stopWorkflow() {
 watch(
   running,
   async () => {
+    if (!route.name.startsWith('logs')) return;
     if (!running.value && route.params.id) {
       const log = await dbLogs.items
         .where('id')
         .equals(route.params.id)
         .first();
-      let path = 'logs';
+      let path = '/logs';
 
       if (log) {
         path = `/logs/${route.params.id}`;

+ 0 - 22
src/utils/api.js

@@ -16,32 +16,10 @@ function queryBuilder(obj) {
 
 export async function fetchApi(path, options) {
   const urlPath = path.startsWith('/') ? path : `/${path}`;
-  const headers = {};
-
-  if (urlPath.startsWith('/me')) {
-    let { session } = await browser.storage.local.get('session');
-    if (!session) throw new Error('Unauthorized');
-
-    const isExpired = Date.now() > session.expires_at * 1000 - 64000;
-
-    if (isExpired) {
-      const response = await fetchApi(
-        `/session/refresh?token=${session.refresh_token}`
-      );
-      const result = await response.json();
-      if (!response.ok) throw new Error(result.message);
-
-      session = result;
-      await browser.storage.local.set({ session });
-    }
-
-    headers.Authorization = `Bearer ${session.access_token}`;
-  }
 
   return fetch(`${secrets.baseApiUrl}${urlPath}`, {
     headers: {
       'Content-Type': 'application/json',
-      ...headers,
     },
     ...options,
   });