chore: remove extension folder

This commit is contained in:
Steven
2023-06-24 14:03:52 +08:00
parent 0a811d2568
commit 07814ef606
6 changed files with 2 additions and 90 deletions

View File

@@ -1,21 +0,0 @@
import { getShortifyData } from "./common.js";
const urlRegex = /https?:\/\/o\/(.+)/;
chrome.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => {
if (typeof tab.url === "string") {
const matchResult = urlRegex.exec(tab.url);
if (matchResult) {
const shortifyData = await getShortifyData();
const name = matchResult[1];
const url = `${shortifyData.domain}/api/shortcut?openId=${shortifyData.openId}&name=${name}&redirect=true`;
return chrome.tabs.update({ url });
}
}
});
chrome.omnibox.onInputEntered.addListener(async (text) => {
const shortifyData = await getShortifyData();
const url = `${shortifyData.domain}/api/shortcut?openId=${shortifyData.openId}&name=${text}&redirect=true`;
return chrome.tabs.update({ url });
});