detached 336f6ec

feat(main): add early logging initialization and asset embedding

commit
336f6eccaa7dcd5ec2b1b13bba37c581c45a3d86
author
bamen · · 2025-09-13 13:01 UTC
committer
bamen · · 2025-09-13 19:42 UTC
parent
e7b7835
signature
unsigned
1 file · +20 -1
M main.go +20 -1
@@ -2,16 +2,18 @@ package main
22
33 import (
44 "embed"
5+ "log"
56 "os"
67 "runtime"
78
89 "github.com/bnema/dumber/internal/app/browser"
910 "github.com/bnema/dumber/internal/app/cli"
11+ "github.com/bnema/dumber/internal/config"
1012 "github.com/bnema/dumber/internal/logging"
1113 "github.com/bnema/dumber/pkg/webkit"
1214 )
1315
14-//go:embed frontend/dist
16+//go:embed frontend/dist assets
1517 var assets embed.FS
1618
1719 // Build information set via ldflags
@@ -31,6 +33,23 @@ func main() {
3133 return
3234 }
3335
36+ // Initialize logging early for GUI mode using default config
37+ cfg := config.New()
38+ if err := logging.Init(
39+ cfg.Logging.LogDir,
40+ cfg.Logging.Level,
41+ cfg.Logging.Format,
42+ cfg.Logging.EnableFileLog,
43+ cfg.Logging.MaxSize,
44+ cfg.Logging.MaxBackups,
45+ cfg.Logging.MaxAge,
46+ cfg.Logging.Compress,
47+ ); err != nil {
48+ log.Printf("Warning: failed to initialize logging: %v", err)
49+ }
50+
51+ log.Printf("Starting dumber browser v%s (commit: %s, built: %s)", version, commit, buildDate)
52+
3453 // GTK requires all UI calls to run on the main OS thread
3554 if webkit.IsNativeAvailable() {
3655 runtime.LockOSThread()
@@ -2,16 +2,18 @@ package main
2 2
3 import (3 import (
4 "embed"4 "embed"
5+ "log"
5 "os"6 "os"
6 "runtime"7 "runtime"
7 8
8 "github.com/bnema/dumber/internal/app/browser"9 "github.com/bnema/dumber/internal/app/browser"
9 "github.com/bnema/dumber/internal/app/cli"10 "github.com/bnema/dumber/internal/app/cli"
11+ "github.com/bnema/dumber/internal/config"
10 "github.com/bnema/dumber/internal/logging"12 "github.com/bnema/dumber/internal/logging"
11 "github.com/bnema/dumber/pkg/webkit"13 "github.com/bnema/dumber/pkg/webkit"
12 )14 )
13 15
14-//go:embed frontend/dist16+//go:embed frontend/dist assets
15 var assets embed.FS17 var assets embed.FS
16 18
17 // Build information set via ldflags19 // Build information set via ldflags
@@ -31,6 +33,23 @@ func main() {
31 return33 return
32 }34 }
33 35
36+ // Initialize logging early for GUI mode using default config
37+ cfg := config.New()
38+ if err := logging.Init(
39+ cfg.Logging.LogDir,
40+ cfg.Logging.Level,
41+ cfg.Logging.Format,
42+ cfg.Logging.EnableFileLog,
43+ cfg.Logging.MaxSize,
44+ cfg.Logging.MaxBackups,
45+ cfg.Logging.MaxAge,
46+ cfg.Logging.Compress,
47+ ); err != nil {
48+ log.Printf("Warning: failed to initialize logging: %v", err)
49+ }
50+
51+ log.Printf("Starting dumber browser v%s (commit: %s, built: %s)", version, commit, buildDate)
52+
34 // GTK requires all UI calls to run on the main OS thread53 // GTK requires all UI calls to run on the main OS thread
35 if webkit.IsNativeAvailable() {54 if webkit.IsNativeAvailable() {
36 runtime.LockOSThread()55 runtime.LockOSThread()

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