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:
1 parent
2fb4a8ea79
commit
6c0ee61750
2538 files changed
+675779
-4792
No files matched your search
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
//go:build windows
|
||||
|
||||
package mygo
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func fileLinks(os.FileInfo) int { return 1 }
|
||||
|
||||
// openShared opens the file at path to read it, sharing its deletion as
|
||||
// Notepad and VS Code do: os.Open shares reading and writing only, so
|
||||
// while the app read a document, another app deleting it, or replacing it
|
||||
// as editors save, was refused ("Access is denied"). Shared, a deletion
|
||||
// or a POSIX-semantics rename (FILE_RENAME_POSIX_SEMANTICS) goes through;
|
||||
// a classic MoveFileEx is refused while any handle is open, and such an
|
||||
// app tries again.
|
||||
func openShared(path string) (*os.File, error) {
|
||||
p, err := syscall.UTF16PtrFromString(path)
|
||||
if err != nil {
|
||||
return nil, &os.PathError{Op: "open", Path: path, Err: err}
|
||||
}
|
||||
h, err := syscall.CreateFile(p, syscall.GENERIC_READ, syscall.FILE_SHARE_READ|syscall.FILE_SHARE_WRITE|syscall.FILE_SHARE_DELETE, nil, syscall.OPEN_EXISTING, syscall.FILE_ATTRIBUTE_NORMAL, 0)
|
||||
if err != nil {
|
||||
return nil, &os.PathError{Op: "open", Path: path, Err: err}
|
||||
}
|
||||
return os.NewFile(uintptr(h), path), nil
|
||||
}
|
||||
|
||||
// fileWritable reports whether the file at path lacks the read-only
|
||||
// attribute, as Notepad checks it.
|
||||
func fileWritable(path string) bool {
|
||||
info, err := os.Stat(path)
|
||||
return err == nil && info.Mode().Perm()&0o200 != 0
|
||||
}
|
||||
|
||||
var procLockFileEx = syscall.NewLazyDLL("kernel32.dll").NewProc("LockFileEx")
|
||||
|
||||
// lockFile takes an exclusive lock on f, which fails while another
|
||||
// process holds it, until f is closed.
|
||||
func lockFile(f *os.File) error {
|
||||
const lockfileFailImmediately, lockfileExclusiveLock = 1, 2
|
||||
var ol syscall.Overlapped
|
||||
r, _, err := procLockFileEx.Call(f.Fd(), lockfileFailImmediately|lockfileExclusiveLock, 0, 1, 0, uintptr(unsafe.Pointer(&ol)))
|
||||
if r == 0 {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// lockBusy reports whether lockFile failed because the lock is held.
|
||||
func lockBusy(err error) bool {
|
||||
return errors.Is(err, syscall.Errno(33)) // ERROR_LOCK_VIOLATION
|
||||
}
|
||||
Reference in new issue
Block a user