feat: port the client to MyGo native UI (0.3.0)

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.
This commit is contained in:
OpenChamber committed 2026-11-18 13:22:59 +08:00
1 parent 2fb4a8ea79
commit 6c0ee61750
2538 files changed
+675779 -4792

No files matched your search

+94
View File
@@ -0,0 +1,94 @@
//go:build darwin && !ios
package darwin
import (
"os"
"path/filepath"
"strings"
"github.com/egoist/mygo/internal/platform"
)
// appDirs are the folders apps are installed in, as Spotlight and Launchpad
// find them: apps in a folder of their own one level down too.
func appDirs() []string {
dirs := []string{
"/Applications",
"/System/Applications",
"/System/Library/CoreServices/Applications",
}
if home, err := os.UserHomeDir(); err == nil {
dirs = append(dirs, filepath.Join(home, "Applications"))
}
return dirs
}
// Applications finds the .app bundles in the folders apps are installed in
// and those one level down (Utilities, an app's folder), without looking
// inside bundles, and Finder (which is in CoreServices), each once: an app
// a symbolic link points to, as /Applications/Safari.app does, is listed
// at the link, which FileIcon draws without the badge of links. Each has the
// name Finder shows (localized, without .app) and its bundle identifier,
// or its path without one.
func (b *Backend) Applications() ([]platform.Application, error) {
var paths []string
seen := map[string]bool{}
add := func(p string) {
real := p
if r, err := filepath.EvalSymlinks(p); err == nil {
real = r
}
if !seen[real] {
seen[real] = true
paths = append(paths, p)
}
}
for _, dir := range appDirs() {
entries, _ := os.ReadDir(dir)
for _, e := range entries {
p := filepath.Join(dir, e.Name())
if strings.HasSuffix(e.Name(), ".app") {
add(p)
continue
}
if info, err := os.Stat(p); err != nil || !info.IsDir() {
continue
}
sub, _ := os.ReadDir(p)
for _, s := range sub {
if strings.HasSuffix(s.Name(), ".app") {
add(filepath.Join(p, s.Name()))
}
}
}
}
add("/System/Library/CoreServices/Finder.app")
apps := make([]platform.Application, 0, len(paths))
withPool(func() {
fm := send(class("NSFileManager"), "defaultManager")
for _, p := range paths {
ns := nsString(p)
bundle := send(class("NSBundle"), "bundleWithPath:", uintptr(ns))
if bundle == 0 {
continue
}
a := platform.Application{
// Finder shows .app where the user has it show all
// extensions; Launchpad and Spotlight never do.
Name: strings.TrimSuffix(goString(send(fm, "displayNameAtPath:", uintptr(ns))), ".app"),
ID: goString(send(bundle, "bundleIdentifier")),
Path: p,
}
if a.ID == "" {
a.ID = p // as Steam's shortcuts to games, which have none
}
apps = append(apps, a)
}
})
return apps, nil
}
// OpenApplication starts an app, or brings it to the front.
func (s shell) OpenApplication(path string) error { return s.OpenPath(path) }