support login data
This commit is contained in:
@@ -2,7 +2,7 @@ import { computed, onMounted, ref, watch } from "vue";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { open } from "@tauri-apps/plugin-dialog";
|
||||
|
||||
import { sortBookmarks, sortExtensions, sortProfiles } from "../utils/sort";
|
||||
import { sortBookmarks, sortExtensions, sortPasswordSites, sortProfiles } from "../utils/sort";
|
||||
import type {
|
||||
ActiveSection,
|
||||
AppPage,
|
||||
@@ -14,6 +14,7 @@ import type {
|
||||
BrowserView,
|
||||
CreateCustomBrowserConfigInput,
|
||||
ExtensionSortKey,
|
||||
PasswordSiteSortKey,
|
||||
ProfileSortKey,
|
||||
ScanResponse,
|
||||
} from "../types/browser";
|
||||
@@ -47,6 +48,7 @@ export function useBrowserManager() {
|
||||
const profileSortKey = ref<ProfileSortKey>("name");
|
||||
const extensionSortKey = ref<ExtensionSortKey>("name");
|
||||
const bookmarkSortKey = ref<BookmarkSortKey>("title");
|
||||
const passwordSiteSortKey = ref<PasswordSiteSortKey>("domain");
|
||||
|
||||
const browsers = computed(() => response.value.browsers);
|
||||
const currentBrowser = computed<BrowserView | null>(
|
||||
@@ -65,6 +67,9 @@ export function useBrowserManager() {
|
||||
const sortedBookmarks = computed(() =>
|
||||
sortBookmarks(currentBrowser.value?.bookmarks ?? [], bookmarkSortKey.value),
|
||||
);
|
||||
const sortedPasswordSites = computed(() =>
|
||||
sortPasswordSites(currentBrowser.value?.passwordSites ?? [], passwordSiteSortKey.value),
|
||||
);
|
||||
|
||||
watch(
|
||||
browsers,
|
||||
@@ -280,7 +285,8 @@ export function useBrowserManager() {
|
||||
if (!currentBrowser.value) return 0;
|
||||
if (section === "profiles") return currentBrowser.value.profiles.length;
|
||||
if (section === "extensions") return currentBrowser.value.extensions.length;
|
||||
return currentBrowser.value.bookmarks.length;
|
||||
if (section === "bookmarks") return currentBrowser.value.bookmarks.length;
|
||||
return currentBrowser.value.passwordSites.length;
|
||||
}
|
||||
|
||||
function showExtensionProfilesModal(extensionId: string) {
|
||||
@@ -305,6 +311,17 @@ export function useBrowserManager() {
|
||||
};
|
||||
}
|
||||
|
||||
function showPasswordSiteProfilesModal(url: string) {
|
||||
const passwordSite = currentBrowser.value?.passwordSites.find((item) => item.url === url);
|
||||
if (!passwordSite || !currentBrowser.value) return;
|
||||
associatedProfilesModal.value = {
|
||||
title: `${passwordSite.domain} Profiles`,
|
||||
browserId: currentBrowser.value.browserId,
|
||||
profiles: passwordSite.profiles,
|
||||
isBookmark: false,
|
||||
};
|
||||
}
|
||||
|
||||
function closeAssociatedProfilesModal() {
|
||||
associatedProfilesModal.value = null;
|
||||
}
|
||||
@@ -339,6 +356,7 @@ export function useBrowserManager() {
|
||||
page,
|
||||
pickExecutablePath,
|
||||
pickUserDataPath,
|
||||
passwordSiteSortKey,
|
||||
profileSortKey,
|
||||
refreshAll,
|
||||
savingConfig,
|
||||
@@ -346,8 +364,10 @@ export function useBrowserManager() {
|
||||
selectedBrowserId,
|
||||
showBookmarkProfilesModal,
|
||||
showExtensionProfilesModal,
|
||||
showPasswordSiteProfilesModal,
|
||||
sortedBookmarks,
|
||||
sortedExtensions,
|
||||
sortedPasswordSites,
|
||||
sortedProfiles,
|
||||
closeAssociatedProfilesModal,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user