support history
This commit is contained in:
@@ -20,6 +20,7 @@ pub struct BrowserView {
|
|||||||
pub extensions: Vec<ExtensionSummary>,
|
pub extensions: Vec<ExtensionSummary>,
|
||||||
pub bookmarks: Vec<BookmarkSummary>,
|
pub bookmarks: Vec<BookmarkSummary>,
|
||||||
pub password_sites: Vec<PasswordSiteSummary>,
|
pub password_sites: Vec<PasswordSiteSummary>,
|
||||||
|
pub history_domains: Vec<HistoryDomainSummary>,
|
||||||
pub stats: BrowserStats,
|
pub stats: BrowserStats,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,6 +31,7 @@ pub struct BrowserStats {
|
|||||||
pub extension_count: usize,
|
pub extension_count: usize,
|
||||||
pub bookmark_count: usize,
|
pub bookmark_count: usize,
|
||||||
pub password_site_count: usize,
|
pub password_site_count: usize,
|
||||||
|
pub history_domain_count: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
@@ -75,6 +77,15 @@ pub struct PasswordSiteSummary {
|
|||||||
pub profiles: Vec<AssociatedProfileSummary>,
|
pub profiles: Vec<AssociatedProfileSummary>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct HistoryDomainSummary {
|
||||||
|
pub domain: String,
|
||||||
|
pub visit_count: i64,
|
||||||
|
pub profile_ids: Vec<String>,
|
||||||
|
pub profiles: Vec<AssociatedProfileSummary>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct AssociatedProfileSummary {
|
pub struct AssociatedProfileSummary {
|
||||||
@@ -183,3 +194,10 @@ pub struct TempPasswordSite {
|
|||||||
pub profile_ids: BTreeSet<String>,
|
pub profile_ids: BTreeSet<String>,
|
||||||
pub profiles: BTreeMap<String, AssociatedProfileSummary>,
|
pub profiles: BTreeMap<String, AssociatedProfileSummary>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct TempHistoryDomain {
|
||||||
|
pub domain: String,
|
||||||
|
pub visit_count: i64,
|
||||||
|
pub profile_ids: BTreeSet<String>,
|
||||||
|
pub profiles: BTreeMap<String, AssociatedProfileSummary>,
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ use crate::{
|
|||||||
config_store,
|
config_store,
|
||||||
models::{
|
models::{
|
||||||
AssociatedProfileSummary, BookmarkAssociatedProfileSummary, BookmarkSummary,
|
AssociatedProfileSummary, BookmarkAssociatedProfileSummary, BookmarkSummary,
|
||||||
BrowserConfigEntry, BrowserStats, BrowserView, ExtensionSummary, PasswordSiteSummary,
|
BrowserConfigEntry, BrowserStats, BrowserView, ExtensionSummary, HistoryDomainSummary,
|
||||||
ProfileSummary, ScanResponse, TempBookmark, TempExtension, TempPasswordSite,
|
PasswordSiteSummary, ProfileSummary, ScanResponse, TempBookmark, TempExtension,
|
||||||
|
TempHistoryDomain, TempPasswordSite,
|
||||||
},
|
},
|
||||||
utils::{
|
utils::{
|
||||||
copy_sqlite_database_to_temp, first_non_empty, load_image_as_data_url, read_json_file,
|
copy_sqlite_database_to_temp, first_non_empty, load_image_as_data_url, read_json_file,
|
||||||
@@ -47,6 +48,7 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
|
|||||||
let mut extensions = BTreeMap::<String, TempExtension>::new();
|
let mut extensions = BTreeMap::<String, TempExtension>::new();
|
||||||
let mut bookmarks = BTreeMap::<String, TempBookmark>::new();
|
let mut bookmarks = BTreeMap::<String, TempBookmark>::new();
|
||||||
let mut password_sites = BTreeMap::<String, TempPasswordSite>::new();
|
let mut password_sites = BTreeMap::<String, TempPasswordSite>::new();
|
||||||
|
let mut history_domains = BTreeMap::<String, TempHistoryDomain>::new();
|
||||||
|
|
||||||
for profile_id in profile_ids {
|
for profile_id in profile_ids {
|
||||||
let profile_path = root.join(&profile_id);
|
let profile_path = root.join(&profile_id);
|
||||||
@@ -60,6 +62,7 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
|
|||||||
scan_extensions_for_profile(&profile_path, &profile_summary, &mut extensions);
|
scan_extensions_for_profile(&profile_path, &profile_summary, &mut extensions);
|
||||||
scan_bookmarks_for_profile(&profile_path, &profile_summary, &mut bookmarks);
|
scan_bookmarks_for_profile(&profile_path, &profile_summary, &mut bookmarks);
|
||||||
scan_password_sites_for_profile(&profile_path, &profile_summary, &mut password_sites);
|
scan_password_sites_for_profile(&profile_path, &profile_summary, &mut password_sites);
|
||||||
|
scan_history_domains_for_profile(&profile_path, &profile_summary, &mut history_domains);
|
||||||
profiles.push(profile_summary);
|
profiles.push(profile_summary);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,6 +96,15 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
|
|||||||
profiles: entry.profiles.into_values().collect(),
|
profiles: entry.profiles.into_values().collect(),
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
let history_domains = history_domains
|
||||||
|
.into_values()
|
||||||
|
.map(|entry| HistoryDomainSummary {
|
||||||
|
domain: entry.domain,
|
||||||
|
visit_count: entry.visit_count,
|
||||||
|
profile_ids: entry.profile_ids.into_iter().collect(),
|
||||||
|
profiles: entry.profiles.into_values().collect(),
|
||||||
|
})
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
Some(BrowserView {
|
Some(BrowserView {
|
||||||
browser_id: config.id,
|
browser_id: config.id,
|
||||||
@@ -105,11 +117,13 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
|
|||||||
extension_count: extensions.len(),
|
extension_count: extensions.len(),
|
||||||
bookmark_count: bookmarks.len(),
|
bookmark_count: bookmarks.len(),
|
||||||
password_site_count: password_sites.len(),
|
password_site_count: password_sites.len(),
|
||||||
|
history_domain_count: history_domains.len(),
|
||||||
},
|
},
|
||||||
profiles,
|
profiles,
|
||||||
extensions: sort_extensions(extensions),
|
extensions: sort_extensions(extensions),
|
||||||
bookmarks: sort_bookmarks(bookmarks),
|
bookmarks: sort_bookmarks(bookmarks),
|
||||||
password_sites: sort_password_sites(password_sites),
|
password_sites: sort_password_sites(password_sites),
|
||||||
|
history_domains: sort_history_domains(history_domains),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -609,6 +623,71 @@ fn scan_password_sites_for_profile(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn scan_history_domains_for_profile(
|
||||||
|
profile_path: &Path,
|
||||||
|
profile: &ProfileSummary,
|
||||||
|
history_domains: &mut BTreeMap<String, TempHistoryDomain>,
|
||||||
|
) {
|
||||||
|
let history_path = profile_path.join("History");
|
||||||
|
if !history_path.is_file() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let Some(temp_copy) = copy_sqlite_database_to_temp(&history_path) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
let Ok(connection) = Connection::open_with_flags(
|
||||||
|
temp_copy.path(),
|
||||||
|
OpenFlags::SQLITE_OPEN_READ_ONLY | OpenFlags::SQLITE_OPEN_NO_MUTEX,
|
||||||
|
) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
let Ok(mut statement) = connection
|
||||||
|
.prepare("SELECT url, visit_count FROM urls WHERE hidden = 0 AND visit_count > 0")
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
let Ok(rows) = statement.query_map([], |row| {
|
||||||
|
Ok((row.get::<_, Option<String>>(0)?, row.get::<_, i64>(1)?))
|
||||||
|
}) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
for row in rows.flatten() {
|
||||||
|
let Some(url) = row.0.as_deref() else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
let Some(domain) = domain_from_url(url) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
|
let entry = history_domains
|
||||||
|
.entry(domain.clone())
|
||||||
|
.or_insert_with(|| TempHistoryDomain {
|
||||||
|
domain: domain.clone(),
|
||||||
|
visit_count: 0,
|
||||||
|
profile_ids: BTreeSet::new(),
|
||||||
|
profiles: BTreeMap::new(),
|
||||||
|
});
|
||||||
|
|
||||||
|
entry.visit_count += row.1.max(0);
|
||||||
|
entry.profile_ids.insert(profile.id.clone());
|
||||||
|
entry
|
||||||
|
.profiles
|
||||||
|
.entry(profile.id.clone())
|
||||||
|
.or_insert_with(|| AssociatedProfileSummary {
|
||||||
|
id: profile.id.clone(),
|
||||||
|
name: profile.name.clone(),
|
||||||
|
avatar_data_url: profile.avatar_data_url.clone(),
|
||||||
|
avatar_icon: profile.avatar_icon.clone(),
|
||||||
|
default_avatar_fill_color: profile.default_avatar_fill_color,
|
||||||
|
default_avatar_stroke_color: profile.default_avatar_stroke_color,
|
||||||
|
avatar_label: profile.avatar_label.clone(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn normalize_login_site(origin_url: Option<&str>, signon_realm: Option<&str>) -> Option<String> {
|
fn normalize_login_site(origin_url: Option<&str>, signon_realm: Option<&str>) -> Option<String> {
|
||||||
let candidate = [signon_realm, origin_url]
|
let candidate = [signon_realm, origin_url]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@@ -640,3 +719,16 @@ fn sort_password_sites(mut password_sites: Vec<PasswordSiteSummary>) -> Vec<Pass
|
|||||||
});
|
});
|
||||||
password_sites
|
password_sites
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn sort_history_domains(
|
||||||
|
mut history_domains: Vec<HistoryDomainSummary>,
|
||||||
|
) -> Vec<HistoryDomainSummary> {
|
||||||
|
history_domains.sort_by(|left, right| {
|
||||||
|
right
|
||||||
|
.visit_count
|
||||||
|
.cmp(&left.visit_count)
|
||||||
|
.then_with(|| left.domain.to_lowercase().cmp(&right.domain.to_lowercase()))
|
||||||
|
.then_with(|| left.domain.cmp(&right.domain))
|
||||||
|
});
|
||||||
|
history_domains
|
||||||
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ const {
|
|||||||
error,
|
error,
|
||||||
extensionMonogram,
|
extensionMonogram,
|
||||||
extensionSortKey,
|
extensionSortKey,
|
||||||
|
historyDomainSortKey,
|
||||||
isDeletingConfig,
|
isDeletingConfig,
|
||||||
isOpeningProfile,
|
isOpeningProfile,
|
||||||
loading,
|
loading,
|
||||||
@@ -38,9 +39,11 @@ const {
|
|||||||
selectedBrowserId,
|
selectedBrowserId,
|
||||||
showBookmarkProfilesModal,
|
showBookmarkProfilesModal,
|
||||||
showExtensionProfilesModal,
|
showExtensionProfilesModal,
|
||||||
|
showHistoryDomainProfilesModal,
|
||||||
showPasswordSiteProfilesModal,
|
showPasswordSiteProfilesModal,
|
||||||
sortedBookmarks,
|
sortedBookmarks,
|
||||||
sortedExtensions,
|
sortedExtensions,
|
||||||
|
sortedHistoryDomains,
|
||||||
sortedPasswordSites,
|
sortedPasswordSites,
|
||||||
sortedProfiles,
|
sortedProfiles,
|
||||||
closeAssociatedProfilesModal,
|
closeAssociatedProfilesModal,
|
||||||
@@ -106,10 +109,12 @@ const {
|
|||||||
:extension-sort-key="extensionSortKey"
|
:extension-sort-key="extensionSortKey"
|
||||||
:bookmark-sort-key="bookmarkSortKey"
|
:bookmark-sort-key="bookmarkSortKey"
|
||||||
:password-site-sort-key="passwordSiteSortKey"
|
:password-site-sort-key="passwordSiteSortKey"
|
||||||
|
:history-domain-sort-key="historyDomainSortKey"
|
||||||
:sorted-profiles="sortedProfiles"
|
:sorted-profiles="sortedProfiles"
|
||||||
:sorted-extensions="sortedExtensions"
|
:sorted-extensions="sortedExtensions"
|
||||||
:sorted-bookmarks="sortedBookmarks"
|
:sorted-bookmarks="sortedBookmarks"
|
||||||
:sorted-password-sites="sortedPasswordSites"
|
:sorted-password-sites="sortedPasswordSites"
|
||||||
|
:sorted-history-domains="sortedHistoryDomains"
|
||||||
:open-profile-error="openProfileError"
|
:open-profile-error="openProfileError"
|
||||||
:section-count="sectionCount"
|
:section-count="sectionCount"
|
||||||
:is-opening-profile="isOpeningProfile"
|
:is-opening-profile="isOpeningProfile"
|
||||||
@@ -121,10 +126,12 @@ const {
|
|||||||
@update:extension-sort-key="extensionSortKey = $event"
|
@update:extension-sort-key="extensionSortKey = $event"
|
||||||
@update:bookmark-sort-key="bookmarkSortKey = $event"
|
@update:bookmark-sort-key="bookmarkSortKey = $event"
|
||||||
@update:password-site-sort-key="passwordSiteSortKey = $event"
|
@update:password-site-sort-key="passwordSiteSortKey = $event"
|
||||||
|
@update:history-domain-sort-key="historyDomainSortKey = $event"
|
||||||
@open-profile="(browserId, profileId) => openBrowserProfile(browserId, profileId)"
|
@open-profile="(browserId, profileId) => openBrowserProfile(browserId, profileId)"
|
||||||
@show-extension-profiles="showExtensionProfilesModal"
|
@show-extension-profiles="showExtensionProfilesModal"
|
||||||
@show-bookmark-profiles="showBookmarkProfilesModal"
|
@show-bookmark-profiles="showBookmarkProfilesModal"
|
||||||
@show-password-site-profiles="showPasswordSiteProfilesModal"
|
@show-password-site-profiles="showPasswordSiteProfilesModal"
|
||||||
|
@show-history-domain-profiles="showHistoryDomainProfilesModal"
|
||||||
@close-associated-profiles="closeAssociatedProfilesModal"
|
@close-associated-profiles="closeAssociatedProfilesModal"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,14 @@ import type {
|
|||||||
BookmarkSortKey,
|
BookmarkSortKey,
|
||||||
BrowserView,
|
BrowserView,
|
||||||
ExtensionSortKey,
|
ExtensionSortKey,
|
||||||
|
HistoryDomainSortKey,
|
||||||
PasswordSiteSortKey,
|
PasswordSiteSortKey,
|
||||||
ProfileSortKey,
|
ProfileSortKey,
|
||||||
} from "../../types/browser";
|
} from "../../types/browser";
|
||||||
import AssociatedProfilesModal from "./AssociatedProfilesModal.vue";
|
import AssociatedProfilesModal from "./AssociatedProfilesModal.vue";
|
||||||
import BookmarksList from "./BookmarksList.vue";
|
import BookmarksList from "./BookmarksList.vue";
|
||||||
import ExtensionsList from "./ExtensionsList.vue";
|
import ExtensionsList from "./ExtensionsList.vue";
|
||||||
|
import HistoryDomainsList from "./HistoryDomainsList.vue";
|
||||||
import PasswordSitesList from "./PasswordSitesList.vue";
|
import PasswordSitesList from "./PasswordSitesList.vue";
|
||||||
import ProfilesList from "./ProfilesList.vue";
|
import ProfilesList from "./ProfilesList.vue";
|
||||||
|
|
||||||
@@ -22,10 +24,12 @@ defineProps<{
|
|||||||
extensionSortKey: ExtensionSortKey;
|
extensionSortKey: ExtensionSortKey;
|
||||||
bookmarkSortKey: BookmarkSortKey;
|
bookmarkSortKey: BookmarkSortKey;
|
||||||
passwordSiteSortKey: PasswordSiteSortKey;
|
passwordSiteSortKey: PasswordSiteSortKey;
|
||||||
|
historyDomainSortKey: HistoryDomainSortKey;
|
||||||
sortedProfiles: BrowserView["profiles"];
|
sortedProfiles: BrowserView["profiles"];
|
||||||
sortedExtensions: BrowserView["extensions"];
|
sortedExtensions: BrowserView["extensions"];
|
||||||
sortedBookmarks: BrowserView["bookmarks"];
|
sortedBookmarks: BrowserView["bookmarks"];
|
||||||
sortedPasswordSites: BrowserView["passwordSites"];
|
sortedPasswordSites: BrowserView["passwordSites"];
|
||||||
|
sortedHistoryDomains: BrowserView["historyDomains"];
|
||||||
openProfileError: string;
|
openProfileError: string;
|
||||||
sectionCount: (section: ActiveSection) => number;
|
sectionCount: (section: ActiveSection) => number;
|
||||||
isOpeningProfile: (browserId: string, profileId: string) => boolean;
|
isOpeningProfile: (browserId: string, profileId: string) => boolean;
|
||||||
@@ -45,10 +49,12 @@ const emit = defineEmits<{
|
|||||||
"update:extensionSortKey": [value: ExtensionSortKey];
|
"update:extensionSortKey": [value: ExtensionSortKey];
|
||||||
"update:bookmarkSortKey": [value: BookmarkSortKey];
|
"update:bookmarkSortKey": [value: BookmarkSortKey];
|
||||||
"update:passwordSiteSortKey": [value: PasswordSiteSortKey];
|
"update:passwordSiteSortKey": [value: PasswordSiteSortKey];
|
||||||
|
"update:historyDomainSortKey": [value: HistoryDomainSortKey];
|
||||||
openProfile: [browserId: string, profileId: string];
|
openProfile: [browserId: string, profileId: string];
|
||||||
showExtensionProfiles: [extensionId: string];
|
showExtensionProfiles: [extensionId: string];
|
||||||
showBookmarkProfiles: [url: string];
|
showBookmarkProfiles: [url: string];
|
||||||
showPasswordSiteProfiles: [url: string];
|
showPasswordSiteProfiles: [url: string];
|
||||||
|
showHistoryDomainProfiles: [domain: string];
|
||||||
closeAssociatedProfiles: [];
|
closeAssociatedProfiles: [];
|
||||||
}>();
|
}>();
|
||||||
</script>
|
</script>
|
||||||
@@ -91,6 +97,15 @@ const emit = defineEmits<{
|
|||||||
<span>Saved Logins</span>
|
<span>Saved Logins</span>
|
||||||
<span class="count-pill">{{ sectionCount("passwords") }}</span>
|
<span class="count-pill">{{ sectionCount("passwords") }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
class="section-tab"
|
||||||
|
:class="{ active: activeSection === 'history' }"
|
||||||
|
type="button"
|
||||||
|
@click="emit('update:activeSection', 'history')"
|
||||||
|
>
|
||||||
|
<span>History</span>
|
||||||
|
<span class="count-pill">{{ sectionCount("history") }}</span>
|
||||||
|
</button>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<div class="content-scroll-area">
|
<div class="content-scroll-area">
|
||||||
@@ -124,12 +139,20 @@ const emit = defineEmits<{
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<PasswordSitesList
|
<PasswordSitesList
|
||||||
v-else
|
v-else-if="activeSection === 'passwords'"
|
||||||
:password-sites="sortedPasswordSites"
|
:password-sites="sortedPasswordSites"
|
||||||
:sort-key="passwordSiteSortKey"
|
:sort-key="passwordSiteSortKey"
|
||||||
@update:sort-key="emit('update:passwordSiteSortKey', $event)"
|
@update:sort-key="emit('update:passwordSiteSortKey', $event)"
|
||||||
@show-profiles="emit('showPasswordSiteProfiles', $event)"
|
@show-profiles="emit('showPasswordSiteProfiles', $event)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<HistoryDomainsList
|
||||||
|
v-else
|
||||||
|
:history-domains="sortedHistoryDomains"
|
||||||
|
:sort-key="historyDomainSortKey"
|
||||||
|
@update:sort-key="emit('update:historyDomainSortKey', $event)"
|
||||||
|
@show-profiles="emit('showHistoryDomainProfiles', $event)"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<AssociatedProfilesModal
|
<AssociatedProfilesModal
|
||||||
|
|||||||
165
src/components/browser-data/HistoryDomainsList.vue
Normal file
165
src/components/browser-data/HistoryDomainsList.vue
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { HistoryDomainSortKey, HistoryDomainSummary } from "../../types/browser";
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
historyDomains: HistoryDomainSummary[];
|
||||||
|
sortKey: HistoryDomainSortKey;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
"update:sortKey": [value: HistoryDomainSortKey];
|
||||||
|
showProfiles: [domain: string];
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<section class="table-section">
|
||||||
|
<div v-if="historyDomains.length" class="data-table">
|
||||||
|
<div class="data-table-header history-grid">
|
||||||
|
<button class="header-cell sortable" :class="{ active: sortKey === 'domain' }" type="button" @click="emit('update:sortKey', 'domain')">Domain</button>
|
||||||
|
<button class="header-cell sortable" :class="{ active: sortKey === 'visits' }" type="button" @click="emit('update:sortKey', 'visits')">Visits</button>
|
||||||
|
<div class="header-cell actions-cell">Profiles</div>
|
||||||
|
</div>
|
||||||
|
<div class="data-table-body styled-scrollbar">
|
||||||
|
<article
|
||||||
|
v-for="historyDomain in historyDomains"
|
||||||
|
:key="historyDomain.domain"
|
||||||
|
class="data-table-row history-grid"
|
||||||
|
>
|
||||||
|
<div class="row-cell primary-cell">
|
||||||
|
<strong>{{ historyDomain.domain }}</strong>
|
||||||
|
</div>
|
||||||
|
<div class="row-cell muted-cell">{{ historyDomain.visitCount.toLocaleString() }}</div>
|
||||||
|
<div class="row-cell actions-cell">
|
||||||
|
<button class="disclosure-button" type="button" @click="emit('showProfiles', historyDomain.domain)">
|
||||||
|
<span>View</span>
|
||||||
|
<span class="badge neutral">{{ historyDomain.profileIds.length }}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else class="empty-card">
|
||||||
|
<p>No browsing history domains were discovered for this browser.</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.table-section {
|
||||||
|
padding: 0;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
border: 1px solid rgba(148, 163, 184, 0.18);
|
||||||
|
border-radius: 22px;
|
||||||
|
background: var(--panel);
|
||||||
|
box-shadow: var(--shadow);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-body {
|
||||||
|
min-height: 0;
|
||||||
|
overflow: auto;
|
||||||
|
scrollbar-gutter: stable;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(240px, 1.2fr) 140px 154px;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-header {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 2;
|
||||||
|
padding: 10px 24px 10px 14px;
|
||||||
|
border-bottom: 1px solid rgba(148, 163, 184, 0.14);
|
||||||
|
background: rgba(248, 250, 252, 0.94);
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
-webkit-backdrop-filter: blur(12px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-cell {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.81rem;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-cell.sortable {
|
||||||
|
padding: 0;
|
||||||
|
text-align: left;
|
||||||
|
background: transparent;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-cell.sortable.active {
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-row {
|
||||||
|
padding: 12px 14px;
|
||||||
|
border-bottom: 1px solid rgba(148, 163, 184, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-row:last-child {
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table-row:hover {
|
||||||
|
background: rgba(248, 250, 252, 0.65);
|
||||||
|
}
|
||||||
|
|
||||||
|
.row-cell {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-cell strong {
|
||||||
|
display: block;
|
||||||
|
font-size: 0.93rem;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.muted-cell {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.87rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disclosure-button {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 10px;
|
||||||
|
width: fit-content;
|
||||||
|
min-width: 120px;
|
||||||
|
padding: 7px 10px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: rgba(241, 245, 249, 0.9);
|
||||||
|
color: var(--badge-text);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions-cell {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 720px) {
|
||||||
|
.history-grid {
|
||||||
|
grid-template-columns: minmax(0, 1fr) 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.history-grid > :nth-child(2) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -2,7 +2,13 @@ import { computed, onMounted, ref, watch } from "vue";
|
|||||||
import { invoke } from "@tauri-apps/api/core";
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
import { open } from "@tauri-apps/plugin-dialog";
|
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 {
|
import type {
|
||||||
ActiveSection,
|
ActiveSection,
|
||||||
AppPage,
|
AppPage,
|
||||||
@@ -14,6 +20,7 @@ import type {
|
|||||||
BrowserView,
|
BrowserView,
|
||||||
CreateCustomBrowserConfigInput,
|
CreateCustomBrowserConfigInput,
|
||||||
ExtensionSortKey,
|
ExtensionSortKey,
|
||||||
|
HistoryDomainSortKey,
|
||||||
PasswordSiteSortKey,
|
PasswordSiteSortKey,
|
||||||
ProfileSortKey,
|
ProfileSortKey,
|
||||||
ScanResponse,
|
ScanResponse,
|
||||||
@@ -49,6 +56,7 @@ export function useBrowserManager() {
|
|||||||
const extensionSortKey = ref<ExtensionSortKey>("name");
|
const extensionSortKey = ref<ExtensionSortKey>("name");
|
||||||
const bookmarkSortKey = ref<BookmarkSortKey>("title");
|
const bookmarkSortKey = ref<BookmarkSortKey>("title");
|
||||||
const passwordSiteSortKey = ref<PasswordSiteSortKey>("domain");
|
const passwordSiteSortKey = ref<PasswordSiteSortKey>("domain");
|
||||||
|
const historyDomainSortKey = ref<HistoryDomainSortKey>("visits");
|
||||||
|
|
||||||
const browsers = computed(() => response.value.browsers);
|
const browsers = computed(() => response.value.browsers);
|
||||||
const currentBrowser = computed<BrowserView | null>(
|
const currentBrowser = computed<BrowserView | null>(
|
||||||
@@ -70,6 +78,9 @@ export function useBrowserManager() {
|
|||||||
const sortedPasswordSites = computed(() =>
|
const sortedPasswordSites = computed(() =>
|
||||||
sortPasswordSites(currentBrowser.value?.passwordSites ?? [], passwordSiteSortKey.value),
|
sortPasswordSites(currentBrowser.value?.passwordSites ?? [], passwordSiteSortKey.value),
|
||||||
);
|
);
|
||||||
|
const sortedHistoryDomains = computed(() =>
|
||||||
|
sortHistoryDomains(currentBrowser.value?.historyDomains ?? [], historyDomainSortKey.value),
|
||||||
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
browsers,
|
browsers,
|
||||||
@@ -286,7 +297,8 @@ export function useBrowserManager() {
|
|||||||
if (section === "profiles") return currentBrowser.value.profiles.length;
|
if (section === "profiles") return currentBrowser.value.profiles.length;
|
||||||
if (section === "extensions") return currentBrowser.value.extensions.length;
|
if (section === "extensions") return currentBrowser.value.extensions.length;
|
||||||
if (section === "bookmarks") return currentBrowser.value.bookmarks.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) {
|
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() {
|
function closeAssociatedProfilesModal() {
|
||||||
associatedProfilesModal.value = null;
|
associatedProfilesModal.value = null;
|
||||||
}
|
}
|
||||||
@@ -348,6 +373,7 @@ export function useBrowserManager() {
|
|||||||
error,
|
error,
|
||||||
extensionMonogram,
|
extensionMonogram,
|
||||||
extensionSortKey,
|
extensionSortKey,
|
||||||
|
historyDomainSortKey,
|
||||||
isDeletingConfig,
|
isDeletingConfig,
|
||||||
isOpeningProfile,
|
isOpeningProfile,
|
||||||
loading,
|
loading,
|
||||||
@@ -364,9 +390,11 @@ export function useBrowserManager() {
|
|||||||
selectedBrowserId,
|
selectedBrowserId,
|
||||||
showBookmarkProfilesModal,
|
showBookmarkProfilesModal,
|
||||||
showExtensionProfilesModal,
|
showExtensionProfilesModal,
|
||||||
|
showHistoryDomainProfilesModal,
|
||||||
showPasswordSiteProfilesModal,
|
showPasswordSiteProfilesModal,
|
||||||
sortedBookmarks,
|
sortedBookmarks,
|
||||||
sortedExtensions,
|
sortedExtensions,
|
||||||
|
sortedHistoryDomains,
|
||||||
sortedPasswordSites,
|
sortedPasswordSites,
|
||||||
sortedProfiles,
|
sortedProfiles,
|
||||||
closeAssociatedProfilesModal,
|
closeAssociatedProfilesModal,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ export type BrowserStats = {
|
|||||||
extensionCount: number;
|
extensionCount: number;
|
||||||
bookmarkCount: number;
|
bookmarkCount: number;
|
||||||
passwordSiteCount: number;
|
passwordSiteCount: number;
|
||||||
|
historyDomainCount: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ProfileSummary = {
|
export type ProfileSummary = {
|
||||||
@@ -40,6 +41,13 @@ export type PasswordSiteSummary = {
|
|||||||
profiles: AssociatedProfileSummary[];
|
profiles: AssociatedProfileSummary[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type HistoryDomainSummary = {
|
||||||
|
domain: string;
|
||||||
|
visitCount: number;
|
||||||
|
profileIds: string[];
|
||||||
|
profiles: AssociatedProfileSummary[];
|
||||||
|
};
|
||||||
|
|
||||||
export type AssociatedProfileSummary = {
|
export type AssociatedProfileSummary = {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -65,8 +73,9 @@ export type ProfileSortKey = "name" | "email" | "id";
|
|||||||
export type ExtensionSortKey = "name" | "id";
|
export type ExtensionSortKey = "name" | "id";
|
||||||
export type BookmarkSortKey = "title" | "url";
|
export type BookmarkSortKey = "title" | "url";
|
||||||
export type PasswordSiteSortKey = "domain" | "url";
|
export type PasswordSiteSortKey = "domain" | "url";
|
||||||
|
export type HistoryDomainSortKey = "visits" | "domain";
|
||||||
export type AssociatedProfileSortKey = "id" | "name";
|
export type AssociatedProfileSortKey = "id" | "name";
|
||||||
export type ActiveSection = "profiles" | "extensions" | "bookmarks" | "passwords";
|
export type ActiveSection = "profiles" | "extensions" | "bookmarks" | "passwords" | "history";
|
||||||
export type AppPage = "browserData" | "configuration";
|
export type AppPage = "browserData" | "configuration";
|
||||||
export type BrowserConfigSource = "default" | "custom";
|
export type BrowserConfigSource = "default" | "custom";
|
||||||
|
|
||||||
@@ -102,6 +111,7 @@ export type BrowserView = {
|
|||||||
extensions: ExtensionSummary[];
|
extensions: ExtensionSummary[];
|
||||||
bookmarks: BookmarkSummary[];
|
bookmarks: BookmarkSummary[];
|
||||||
passwordSites: PasswordSiteSummary[];
|
passwordSites: PasswordSiteSummary[];
|
||||||
|
historyDomains: HistoryDomainSummary[];
|
||||||
stats: BrowserStats;
|
stats: BrowserStats;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import type {
|
|||||||
BookmarkSummary,
|
BookmarkSummary,
|
||||||
ExtensionSortKey,
|
ExtensionSortKey,
|
||||||
ExtensionSummary,
|
ExtensionSummary,
|
||||||
|
HistoryDomainSortKey,
|
||||||
|
HistoryDomainSummary,
|
||||||
PasswordSiteSortKey,
|
PasswordSiteSortKey,
|
||||||
PasswordSiteSummary,
|
PasswordSiteSummary,
|
||||||
AssociatedProfileSortKey,
|
AssociatedProfileSortKey,
|
||||||
@@ -88,6 +90,16 @@ export function sortPasswordSites(items: PasswordSiteSummary[], sortKey: Passwor
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function sortHistoryDomains(items: HistoryDomainSummary[], sortKey: HistoryDomainSortKey) {
|
||||||
|
const historyDomains = [...items];
|
||||||
|
return historyDomains.sort((left, right) => {
|
||||||
|
if (sortKey === "domain") {
|
||||||
|
return compareOptionalText(left.domain, right.domain) || right.visitCount - left.visitCount;
|
||||||
|
}
|
||||||
|
return right.visitCount - left.visitCount || compareOptionalText(left.domain, right.domain);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export function sortAssociatedProfiles(
|
export function sortAssociatedProfiles(
|
||||||
items: (AssociatedProfileSummary | BookmarkAssociatedProfileSummary)[],
|
items: (AssociatedProfileSummary | BookmarkAssociatedProfileSummary)[],
|
||||||
sortKey: AssociatedProfileSortKey,
|
sortKey: AssociatedProfileSortKey,
|
||||||
|
|||||||
Reference in New Issue
Block a user