Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bugfix for update permission #11642

Merged
merged 1 commit into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions packages/mask/background/tasks/NotCancellable/OnInstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@
import type { DashboardRoutes } from '@masknet/shared-base'
import * as base from /* webpackDefer: true */ '@masknet/shared-base'

type DashboardRoutes_Permission = DashboardRoutes.Permissions extends `${infer T}` ? T : never
type DashboardRoutes_Welcome = DashboardRoutes.Welcome extends `${infer T}` ? T : never
function openWelcome() {
const welcome: DashboardRoutes_Welcome = '/setup/welcome'
browser.tabs.create({
url: browser.runtime.getURL(`dashboard.html#${welcome}`),
})
}

type DashboardRoutes_Permission = DashboardRoutes.Permissions extends `${infer T}` ? T : never
function openPermission() {
const permissions: DashboardRoutes_Permission = '/setup/permissions'
browser.tabs.create({
url: browser.runtime.getURL(`dashboard.html#${permissions}`),
Expand All @@ -16,7 +24,7 @@ browser.runtime.onInstalled.addListener(async (detail) => {
} else if (detail.reason === 'update') {
const connect = await import('../../services/site-adaptors/connect.js')
const groups = await connect.getOriginsWithoutPermission()
if (groups.length) openWelcome()
if (groups.length) openPermission()
const localStorage = (globalThis as any).localStorage
if (localStorage) {
const backupPassword = localStorage.getItem('backupPassword')
Expand Down
Loading