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

@ -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

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