Skip to content

Commit d2c8f5a

Browse files
committed
fix(router): make progress inaccessible from web
1 parent 19f28cc commit d2c8f5a

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/router/create-router.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { chromeRuntimeId } from '@dvcol/web-extension-utils/chrome/runtime';
12
import { watch } from 'vue';
23
import { createRouter as createVueRouter, createWebHashHistory, type LocationQueryRaw } from 'vue-router';
34

@@ -56,6 +57,7 @@ export const createRouter = ({ baseName = '', baseUrl = import.meta.env.BASE_URL
5657
router.beforeResolve(async to => {
5758
const query: LocationQueryRaw = { ...routeParam.value };
5859
if (routeParam.value) setRouteParam(undefined);
60+
if (!chromeRuntimeId && to.name === Route.Progress) return defaultTab.value;
5961

6062
if (isLoginAuthResponseSuccess(query)) {
6163
try {

src/stores/router.store.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const useRouterStore = defineStore('router', () => {
3535
const restoreLastRoute = async () => {
3636
const _route = await storage.local.get<RouteLocationNormalized>(RouterStorageKey.LastRoute);
3737
if (_route) lastRoute.value = _route;
38-
return _route;
38+
return lastRoute.value;
3939
};
4040

4141
const baseName = ref('');

src/stores/settings/extension.store.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { CacheRetention } from '@dvcol/common-utils/common/cache';
2+
import { chromeRuntimeId } from '@dvcol/web-extension-utils/chrome/runtime';
23
import { defineStore, storeToRefs } from 'pinia';
34
import { computed, reactive, ref, toRaw } from 'vue';
45

@@ -102,6 +103,8 @@ export const useExtensionSettingsStore = defineStore(ExtensionSettingsConstants.
102103
if (restored?.loadListsPageSize !== undefined) loadListsPageSize.value = restored.loadListsPageSize;
103104
if (restored?.progressType !== undefined) progressType.value = restored.progressType;
104105
if (restored?.enableRatings !== undefined) enableRatings.value = restored.enableRatings;
106+
107+
if (!chromeRuntimeId) routeDictionary[Route.Progress] = false;
105108
};
106109

107110
const saveDefaultTab = debounce(() => storage.sync.set(ExtensionSettingsConstants.LocalDefaultTab, defaultTab.value), 500);

0 commit comments

Comments
 (0)