Skip to content

Commit

Permalink
fix: update allow_url
Browse files Browse the repository at this point in the history
  • Loading branch information
oeyoews committed Jul 14, 2024
1 parent edabc88 commit 74e9061
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 34 deletions.
1 change: 0 additions & 1 deletion components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export {}

declare module 'vue' {
export interface GlobalComponents {
ElBacktop: typeof import('element-plus/es')['ElBacktop']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
Expand Down
62 changes: 32 additions & 30 deletions entrypoints/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,38 +124,40 @@ export default defineBackground(() => {
}
});

browser.tabs.onUpdated.addListener((tabId, info, tab) => {
if (!tab.url) return;
const url = new URL(tab.url);
const domains = [
'https://www.google.com',
'https://www.bing.com',
'https://baidu.com',
];
setTimeout(() => {
browser.tabs.onUpdated.addListener((tabId, info, tab) => {
if (!tab.url) return;
const url = new URL(tab.url);
const domains = [
'https://www.google.com',
'https://www.bing.com',
'https://baidu.com',
];

// 部分页面不开启侧边栏
if (!domains.includes(url.origin) && !tab.url?.startsWith('chrome://')) {
chrome.sidePanel.setOptions({
tabId,
path: pages.sidePanelPage,
enabled: true,
});
} else {
chrome.sidePanel.setOptions({
tabId,
enabled: false,
});
return;
}
// 部分页面不开启侧边栏
if (!domains.includes(url.origin) && !tab.url?.startsWith('chrome://')) {
chrome.sidePanel.setOptions({
tabId,
path: pages.sidePanelPage,
enabled: true,
});
} else {
chrome.sidePanel.setOptions({
tabId,
enabled: false,
});
return;
}

// 页面路由发生变化通知侧边栏前端页面更新
if (info.status === 'complete') {
chrome.tabs.sendMessage(tabId, {
type: 'routeUpdate',
data: tab.url,
});
}
});
// 页面路由发生变化通知侧边栏前端页面更新
if (info.status === 'complete') {
chrome.tabs.sendMessage(tabId, {
type: 'routeUpdate',
data: tab.url,
});
}
});
}, 1000);

chrome.contextMenus.onClicked.addListener((info, tab) => {
const { menuItemId } = info;
Expand Down
4 changes: 3 additions & 1 deletion entrypoints/sidepanel/Sidepanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,9 @@ const toggleInfoDialog = () => {
Tiddlers</el-button
>
</el-badge> -->
<el-tag size="large">
<el-tag
size="large"
@click="setupDialogStatus = true">
<!-- <WI.SvgSpinnersWifi
class="text-gray-500"
v-if="isChecking && !isOnline" /> -->
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "usewiki2",
"description": "Convert HTML to Markdown, and save to your computer, support nodejs tiddlywiki",
"private": true,
"version": "4.5.5",
"version": "4.5.6",
"type": "module",
"scripts": {
"dev": "wxt --mode development",
Expand Down
2 changes: 1 addition & 1 deletion wxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default defineConfig({
'activeTab',
'contextMenus',
'storage',
'<all_urls>',
// '<all_urls>',
'tabs',
'scripting',
],
Expand Down

0 comments on commit 74e9061

Please sign in to comment.