chore: update extension pnpm lock file

This commit is contained in:
Steven 2023-08-08 22:01:07 +08:00
parent 2264b64007
commit 07365fda73
3 changed files with 304 additions and 279 deletions

View File

@ -47,10 +47,12 @@
}, },
"manifest": { "manifest": {
"host_permissions": [ "host_permissions": [
"http://*/*",
"https://*/*" "https://*/*"
], ],
"permissions": [ "permissions": [
"tabs", "tabs",
"activeTab",
"scripting", "scripting",
"storage" "storage"
] ]

561
extension/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,10 @@ const storage = new Storage();
const urlRegex = /https?:\/\/s\/(.+)/; const urlRegex = /https?:\/\/s\/(.+)/;
chrome.tabs.onUpdated.addListener(async (tabId, _, tab) => { chrome.tabs.onUpdated.addListener(async (tabId, _, tab) => {
if (typeof tab.url === "string") { if (!tab.url) {
return;
}
const shortcutName = getShortcutNameFromUrl(tab.url); const shortcutName = getShortcutNameFromUrl(tab.url);
if (shortcutName) { if (shortcutName) {
const shortcuts = (await storage.getItem<Shortcut[]>("shortcuts")) || []; const shortcuts = (await storage.getItem<Shortcut[]>("shortcuts")) || [];
@ -15,7 +18,6 @@ chrome.tabs.onUpdated.addListener(async (tabId, _, tab) => {
} }
return chrome.tabs.update(tabId, { url: shortcut.link }); return chrome.tabs.update(tabId, { url: shortcut.link });
} }
}
}); });
const getShortcutNameFromUrl = (urlString: string) => { const getShortcutNameFromUrl = (urlString: string) => {