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": {
"host_permissions": [
"http://*/*",
"https://*/*"
],
"permissions": [
"tabs",
"activeTab",
"scripting",
"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\/(.+)/;
chrome.tabs.onUpdated.addListener(async (tabId, _, tab) => {
if (typeof tab.url === "string") {
if (!tab.url) {
return;
}
const shortcutName = getShortcutNameFromUrl(tab.url);
if (shortcutName) {
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 });
}
}
});
const getShortcutNameFromUrl = (urlString: string) => {