v0.21.0 73bf644

history.go RawHistoryFolder

1package entity
2
3import "time"
4
5// HistoryEntry represents a visited URL in browsing history.
6type HistoryEntry struct {
7	ID          int64     `json:"id"`
8	URL         string    `json:"url"`
9	Title       string    `json:"title"`
10	FaviconURL  string    `json:"favicon_url"`
11	VisitCount  int64     `json:"visit_count"`
12	LastVisited time.Time `json:"last_visited"`
13	CreatedAt   time.Time `json:"created_at"`
14}
15
16// NewHistoryEntry creates a new history entry for a URL.
17func NewHistoryEntry(url, title string) *HistoryEntry {
18	now := time.Now()
19	return &HistoryEntry{
20		URL:         url,
21		Title:       title,
22		VisitCount:  1,
23		LastVisited: now,
24		CreatedAt:   now,
25	}
26}
27
28// IncrementVisit updates the entry for a new visit.
29func (h *HistoryEntry) IncrementVisit() {
30	h.VisitCount++
31	h.LastVisited = time.Now()
32}
33
34// HistoryMatch represents a history entry that matched a search query.
35// Used for fuzzy search results with scoring.
36type HistoryMatch struct {
37	Entry *HistoryEntry
38	Score float64 // Match score (higher is better)
39}
40
41// HistoryStats contains aggregated history statistics.
42type HistoryStats struct {
43	TotalEntries int64 `json:"total_entries"`
44	TotalVisits  int64 `json:"total_visits"`
45	UniqueDays   int64 `json:"unique_days"`
46}
47
48// DomainStat contains per-domain visit statistics.
49type DomainStat struct {
50	Domain      string    `json:"domain"`
51	PageCount   int64     `json:"page_count"`
52	TotalVisits int64     `json:"total_visits"`
53	LastVisit   time.Time `json:"last_visit"`
54}
55
56// HourlyDistribution contains visit counts by hour of day.
57type HourlyDistribution struct {
58	Hour       int   `json:"hour"`
59	VisitCount int64 `json:"visit_count"`
60}
61
62// DailyVisitCount contains visit counts by day.
63type DailyVisitCount struct {
64	Day     string `json:"day"`
65	Entries int64  `json:"entries"`
66	Visits  int64  `json:"visits"`
67}
68
69// HistoryAnalytics contains all analytics data for the homepage.
70type HistoryAnalytics struct {
71	TotalEntries       int64                 `json:"total_entries"`
72	TotalVisits        int64                 `json:"total_visits"`
73	UniqueDays         int64                 `json:"unique_days"`
74	TopDomains         []*DomainStat         `json:"top_domains"`
75	DailyVisits        []*DailyVisitCount    `json:"daily_visits"`
76	HourlyDistribution []*HourlyDistribution `json:"hourly_distribution"`
77}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close