瀏覽代碼

fix: auto install

Zen 2 年之前
父節點
當前提交
1525e9ea59
共有 1 個文件被更改,包括 4 次插入10 次删除
  1. 4 10
      src/content/index.js

+ 4 - 10
src/content/index.js

@@ -1,7 +1,6 @@
 import browser from 'webextension-polyfill';
 import findSelector from '@/lib/findSelector';
 import { toCamelCase } from '@/utils/helper';
-import { openDB } from 'idb';
 import cloneDeep from 'lodash.clonedeep';
 import { nanoid } from 'nanoid';
 import blocksHandler from './blocksHandler';
@@ -241,17 +240,12 @@ function messageListener({ data, source }) {
 async function autoInstall() {
   const link = window.location.href;
   if (/.+\.automa\.json$/.test(link)) {
+    const accept = window.confirm(
+      'Do you want to add this workflow into Automa?'
+    );
+    if (!accept) return;
     const workflow = JSON.parse(document.body.innerText);
 
-    const { workflows } = await browser.storage.local.get('workflows');
-    const db = await openDB('automa', 1, {
-      upgrade(event) {
-        event.createObjectStore('store');
-      },
-    });
-
-    await db.put('store', workflows, 'workflows');
-
     const { workflows: workflowsStorage } = await browser.storage.local.get(
       'workflows'
     );