v0.2.0 759cc92

app.ts RawHistoryFolder

1type HistoryEntry = {
2  id: number;
3  url: string;
4  title: string;
5  visit_count: number;
6  last_visited: string | null;
7  created_at: string | null;
8}
9
10export class AppService {
11  private history: HistoryEntry[] = [];
12  private shortcuts: Record<string, any> = {};
13
14  constructor() {}
15
16  async initialize(): Promise<void> {
17    try {
18      await Promise.all([
19        this.loadHistory(),
20        this.loadShortcuts()
21      ]);
22    } catch (error) {
23      console.error('Failed to initialize app:', error);
24    }
25  }
26
27  async loadHistory(): Promise<void> {
28    try {
29      const recentHistory: HistoryEntry[] = await fetch('/api/history/recent?limit=50').then(r => r.json());
30      this.history = recentHistory;
31    } catch (error) {
32      console.error('Failed to load history:', error);
33      // Mock history for development/fallback
34      this.history = [
35        { 
36          id: 1, 
37          url: 'https://github.com/wailsapp/wails', 
38          title: 'Wails Framework', 
39          visit_count: 3,
40          last_visited: new Date().toISOString(),
41          created_at: new Date().toISOString()
42        },
43        { 
44          id: 2, 
45          url: 'https://go.dev', 
46          title: 'The Go Programming Language', 
47          visit_count: 2,
48          last_visited: new Date().toISOString(),
49          created_at: new Date().toISOString()
50        },
51        { 
52          id: 3, 
53          url: 'https://developer.mozilla.org', 
54          title: 'MDN Web Docs', 
55          visit_count: 1,
56          last_visited: new Date().toISOString(),
57          created_at: new Date().toISOString()
58        }
59      ];
60    }
61  }
62
63  async loadShortcuts(): Promise<void> {
64    try {
65      const cfg = await fetch('/api/config').then(r => r.json());
66      this.shortcuts = cfg?.search_shortcuts || {};
67    } catch (error) {
68      console.error('Failed to load shortcuts:', error);
69      // Mock shortcuts for development/fallback
70      this.shortcuts = {
71        'g': { description: 'Google Search', url: 'https://google.com/search?q={query}' },
72        'gh': { description: 'GitHub Search', url: 'https://github.com/search?q={query}' },
73        'so': { description: 'Stack Overflow', url: 'https://stackoverflow.com/search?q={query}' },
74        'w': { description: 'Wikipedia', url: 'https://en.wikipedia.org/wiki/Special:Search?search={query}' }
75      };
76    }
77  }
78
79  getHistory(): HistoryEntry[] {
80    return this.history;
81  }
82
83  getShortcuts(): Record<string, any> {
84    return this.shortcuts;
85  }
86
87  async copyToClipboard(text: string): Promise<void> {
88    try {
89      await navigator.clipboard.writeText(text);
90      console.log('Copied to clipboard:', text);
91    } catch (err) {
92      console.error('Failed to copy:', err);
93    }
94  }
95}

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