support history
This commit is contained in:
@@ -2,7 +2,13 @@ import { computed, onMounted, ref, watch } from "vue";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { open } from "@tauri-apps/plugin-dialog";
|
||||
|
||||
import { sortBookmarks, sortExtensions, sortPasswordSites, sortProfiles } from "../utils/sort";
|
||||
import {
|
||||
sortBookmarks,
|
||||
sortExtensions,
|
||||
sortHistoryDomains,
|
||||
sortPasswordSites,
|
||||
sortProfiles,
|
||||
} from "../utils/sort";
|
||||
import type {
|
||||
ActiveSection,
|
||||
AppPage,
|
||||
@@ -14,6 +20,7 @@ import type {
|
||||
BrowserView,
|
||||
CreateCustomBrowserConfigInput,
|
||||
ExtensionSortKey,
|
||||
HistoryDomainSortKey,
|
||||
PasswordSiteSortKey,
|
||||
ProfileSortKey,
|
||||
ScanResponse,
|
||||
@@ -49,6 +56,7 @@ export function useBrowserManager() {
|
||||
const extensionSortKey = ref<ExtensionSortKey>("name");
|
||||
const bookmarkSortKey = ref<BookmarkSortKey>("title");
|
||||
const passwordSiteSortKey = ref<PasswordSiteSortKey>("domain");
|
||||
const historyDomainSortKey = ref<HistoryDomainSortKey>("visits");
|
||||
|
||||
const browsers = computed(() => response.value.browsers);
|
||||
const currentBrowser = computed<BrowserView | null>(
|
||||
@@ -70,6 +78,9 @@ export function useBrowserManager() {
|
||||
const sortedPasswordSites = computed(() =>
|
||||
sortPasswordSites(currentBrowser.value?.passwordSites ?? [], passwordSiteSortKey.value),
|
||||
);
|
||||
const sortedHistoryDomains = computed(() =>
|
||||
sortHistoryDomains(currentBrowser.value?.historyDomains ?? [], historyDomainSortKey.value),
|
||||
);
|
||||
|
||||
watch(
|
||||
browsers,
|
||||
@@ -286,7 +297,8 @@ export function useBrowserManager() {
|
||||
if (section === "profiles") return currentBrowser.value.profiles.length;
|
||||
if (section === "extensions") return currentBrowser.value.extensions.length;
|
||||
if (section === "bookmarks") return currentBrowser.value.bookmarks.length;
|
||||
return currentBrowser.value.passwordSites.length;
|
||||
if (section === "passwords") return currentBrowser.value.passwordSites.length;
|
||||
return currentBrowser.value.historyDomains.length;
|
||||
}
|
||||
|
||||
function showExtensionProfilesModal(extensionId: string) {
|
||||
@@ -322,6 +334,19 @@ export function useBrowserManager() {
|
||||
};
|
||||
}
|
||||
|
||||
function showHistoryDomainProfilesModal(domain: string) {
|
||||
const historyDomain = currentBrowser.value?.historyDomains.find(
|
||||
(item) => item.domain === domain,
|
||||
);
|
||||
if (!historyDomain || !currentBrowser.value) return;
|
||||
associatedProfilesModal.value = {
|
||||
title: `${historyDomain.domain} Profiles`,
|
||||
browserId: currentBrowser.value.browserId,
|
||||
profiles: historyDomain.profiles,
|
||||
isBookmark: false,
|
||||
};
|
||||
}
|
||||
|
||||
function closeAssociatedProfilesModal() {
|
||||
associatedProfilesModal.value = null;
|
||||
}
|
||||
@@ -348,6 +373,7 @@ export function useBrowserManager() {
|
||||
error,
|
||||
extensionMonogram,
|
||||
extensionSortKey,
|
||||
historyDomainSortKey,
|
||||
isDeletingConfig,
|
||||
isOpeningProfile,
|
||||
loading,
|
||||
@@ -364,9 +390,11 @@ export function useBrowserManager() {
|
||||
selectedBrowserId,
|
||||
showBookmarkProfilesModal,
|
||||
showExtensionProfilesModal,
|
||||
showHistoryDomainProfilesModal,
|
||||
showPasswordSiteProfilesModal,
|
||||
sortedBookmarks,
|
||||
sortedExtensions,
|
||||
sortedHistoryDomains,
|
||||
sortedPasswordSites,
|
||||
sortedProfiles,
|
||||
closeAssociatedProfilesModal,
|
||||
|
||||
Reference in New Issue
Block a user