feat: rename to shortify

This commit is contained in:
Steven
2023-03-16 08:25:58 +08:00
parent 143bdb7596
commit d08a738a57
43 changed files with 114 additions and 116 deletions

View File

@@ -1,4 +1,4 @@
import { getCorgiData } from "./common.js";
import { getShortifyData } from "./common.js";
const urlRegex = /https?:\/\/o\/(.+)/;
@@ -6,16 +6,16 @@ chrome.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => {
if (typeof tab.url === "string") {
const matchResult = urlRegex.exec(tab.url);
if (matchResult) {
const corgiData = await getCorgiData();
const shortifyData = await getShortifyData();
const name = matchResult[1];
const url = `${corgiData.domain}/api/shortcut?openId=${corgiData.openId}&name=${name}&redirect=true`;
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 corgiData = await getCorgiData();
const url = `${corgiData.domain}/api/shortcut?openId=${corgiData.openId}&name=${text}&redirect=true`;
const shortifyData = await getShortifyData();
const url = `${shortifyData.domain}/api/shortcut?openId=${shortifyData.openId}&name=${text}&redirect=true`;
return chrome.tabs.update({ url });
});