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
+52
@@ -0,0 +1,52 @@
|
||||
package update
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"maps"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFileList(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
if err := WriteFileList(dir, []string{"b", FileList, "a", "../up", "sub/x", `sub\x`, "", ".", "b"}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b, err := os.ReadFile(filepath.Join(dir, FileList))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if string(b) != "a\nb\n" {
|
||||
t.Errorf("the list holds %q", b)
|
||||
}
|
||||
if entries, _ := os.ReadDir(dir); len(entries) != 1 {
|
||||
t.Errorf("writing the list left %v", entries)
|
||||
}
|
||||
// What is not an entry of the directory itself is never removed.
|
||||
got := ParseFileList([]byte("a\r\nb\n\n../up\n..\n.\nsub/x\nsub\\x\n" + FileList + "\nc"))
|
||||
if want := []string{"a", "b", "c"}; !slices.Equal(got, want) {
|
||||
t.Errorf("ParseFileList = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
// The updater rewrites the installed app's list, so deltas never make the
|
||||
// new one from it.
|
||||
func TestDeltaFileList(t *testing.T) {
|
||||
list := "app.exe\nold.dll\nresources\n"
|
||||
oldDir := writeTree(t, map[string]string{"app.exe": "code", "old.dll": "old", FileList: list})
|
||||
newDir := writeTree(t, map[string]string{"app.exe": "new code", FileList: list})
|
||||
var delta bytes.Buffer
|
||||
if err := WriteDelta(&delta, "1.0.0", "1.1.0", oldDir, newDir, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
installed := writeTree(t, map[string]string{"app.exe": "code", "old.dll": "old", FileList: "app.exe\n"})
|
||||
out := filepath.Join(t.TempDir(), "app")
|
||||
if err := ApplyDelta(bytes.NewReader(delta.Bytes()), int64(delta.Len()), "1.0.0", "1.1.0", installed, out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got, want := readTree(t, out), readTree(t, newDir); !maps.Equal(got, want) {
|
||||
t.Errorf("applying the delta made %v, want %v", got, want)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user