Switch from Asuka to MyGo, keeping the API client and the feature set: - servers: saved servers, passwordless and password login, proxy, self-signed certificates, per-server device tokens (Keystore), connect form, instance list sheet with switch/disconnect - sessions: virtualized list, search, new session, rename/archive/delete, running indicator, event stream keeps it live - chat: pushed window with system back bar, streaming Markdown via ui/markdown, reasoning and tool rows with image previews, footer menu (read aloud via a Kotlin TTS plugin, copy, fork), user message menu (copy, revert, fork), context usage ring and detail sheet, attachments (photos/files via the document picker), permissions - release builds allow plain http:// LAN servers (Go's net/http dials directly, no cleartext manifest needed) - a local fork of MyGo (third_party/mygo) lowers the Android host's minSdk to 24 (Android 7.0); Go 1.27.4 via mise Version 0.3.0.
64 lines
1.7 KiB
Go
64 lines
1.7 KiB
Go
//go:build windows && (amd64 || arm64)
|
|
|
|
package windows
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
// Starting at login is a value in the Run key of the user. Task Manager's
|
|
// Startup page turns it off without removing it, in StartupApproved.
|
|
|
|
const (
|
|
runKey = `Software\Microsoft\Windows\CurrentVersion\Run`
|
|
approvedKey = `Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run`
|
|
)
|
|
|
|
func loginCommand(arg string) (string, error) {
|
|
exe, err := os.Executable()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
if real, err := filepath.EvalSymlinks(exe); err == nil {
|
|
exe = real
|
|
}
|
|
return `"` + exe + `" ` + arg, nil
|
|
}
|
|
|
|
func (a appController) SetOpenAtLogin(open bool, id, name, arg string) error {
|
|
if !open {
|
|
if err := regDeleteValue(hkeyCurrentUser, runKey, id); err != nil {
|
|
return err
|
|
}
|
|
return regDeleteValue(hkeyCurrentUser, approvedKey, id)
|
|
}
|
|
cmd, err := loginCommand(arg)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if err := regSet(hkeyCurrentUser, runKey, id, cmd); err != nil {
|
|
return err
|
|
}
|
|
// Turned off in Task Manager earlier: the app asks for it again now.
|
|
return regDeleteValue(hkeyCurrentUser, approvedKey, id)
|
|
}
|
|
|
|
func (a appController) OpenAtLogin(id, name, arg string) bool {
|
|
cmd, err := loginCommand(arg)
|
|
if err != nil {
|
|
return false
|
|
}
|
|
if got, ok := regGet(hkeyCurrentUser, runKey, id); !ok || !strings.EqualFold(got, cmd) {
|
|
return false
|
|
}
|
|
// The first byte is odd when the entry is turned off.
|
|
state, ok := regGetBytes(hkeyCurrentUser, approvedKey, id)
|
|
return !ok || len(state) == 0 || state[0]&1 == 0
|
|
}
|
|
|
|
// OpenedAtLogin reports false: the Run entry passes the login argument
|
|
// instead.
|
|
func (a appController) OpenedAtLogin() bool { return false }
|