feat: persist last user + diagnostics + logging + icon + defensive whoami
Backend: - last_user.go: writes/reads <UserConfigDir>/matrix_client_pc/last_user.txt. Login persists; Logout clears. - GetLastUserID bind replaces fragile localStorage in App.tsx. - GetDiagnostics bind: live snapshot (started, client_ready, crypto_init, sync_active, rooms_count, encrypted_rooms, dms_count, last_error). - applog.go: slog to stderr + <UserConfigDir>/matrix_client_pc/app.log. GetLogTail + GetLogPath binds. - matrix_service.go logs throughout Login/Start. After MatrixClientInit, if client.DeviceID empty -> retry whoami + persist back (defensive). - main.go inits logger before wails.Run, OnShutdown logs close. Frontend: - App.tsx awaits GetLastUserID() instead of localStorage. - HomeScreen.tsx Health modal (green stethoscope button) with HealthRow status dots — comprobar chats. - Auto-relogin on token-rejected error in Start(). Icon: - appicon.ico (Phosphor chat-circle + #7c3aed) generated via generate_app_icon. - build/windows/icon.ico replaced (Wails embeds via windres). - build/appicon.png regenerated from ico (256x256). Refs: issues 0147 + 0148 + 0150 (partial). Fixes M_UNKNOWN_TOKEN auto-recovery.
This commit is contained in:
@@ -14,9 +14,16 @@ import (
|
||||
var assets embed.FS
|
||||
|
||||
func main() {
|
||||
logger, err := InitLogger()
|
||||
if err != nil {
|
||||
log.Fatalln("logger init:", err)
|
||||
}
|
||||
defer logger.Close()
|
||||
logger.Info("starting matrix_client_pc", "version", "0.1.0")
|
||||
|
||||
ms := NewMatrixService()
|
||||
|
||||
err := wails.Run(&options.App{
|
||||
err = wails.Run(&options.App{
|
||||
Title: "matrix_client_pc",
|
||||
Width: 1280,
|
||||
Height: 800,
|
||||
@@ -26,12 +33,17 @@ func main() {
|
||||
BackgroundColour: &options.RGBA{R: 26, G: 27, B: 30, A: 1},
|
||||
OnStartup: func(ctx context.Context) {
|
||||
ms.SetContext(ctx)
|
||||
logger.Info("wails ctx ready")
|
||||
},
|
||||
OnShutdown: func(ctx context.Context) {
|
||||
logger.Info("shutdown")
|
||||
},
|
||||
Bind: []interface{}{
|
||||
ms,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
logger.Error("wails error", "err", err)
|
||||
log.Fatalln("Wails error:", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user