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

+57
View File
@@ -0,0 +1,57 @@
package platform
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/x509"
"crypto/x509/pkix"
"math/big"
"testing"
"time"
)
func TestCertificateIssuer(t *testing.T) {
key, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
if err != nil {
t.Fatal(err)
}
for _, tc := range []struct {
name string
issuer pkix.Name
from, to time.Time
want string
}{
{"common name", pkix.Name{CommonName: "mygo test client CA", Organization: []string{"MyGo"}}, time.Date(2026, 11, 10, 8, 0, 0, 0, time.UTC), time.Date(2027, 11, 10, 8, 0, 0, 0, time.UTC), "mygo test client CA"},
{"organization", pkix.Name{Organization: []string{"MyGo"}, Country: []string{"US"}}, time.Date(1999, 1, 2, 3, 4, 5, 0, time.UTC), time.Date(2049, 12, 31, 23, 59, 59, 0, time.UTC), "MyGo"},
// Years from 2050 are GeneralizedTime.
{"generalized time", pkix.Name{CommonName: "长期 CA"}, time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC), time.Date(2100, 1, 1, 0, 0, 0, 0, time.UTC), "长期 CA"},
} {
t.Run(tc.name, func(t *testing.T) {
tmpl := &x509.Certificate{
SerialNumber: big.NewInt(1234567),
Subject: pkix.Name{CommonName: "mygo test client"},
Issuer: tc.issuer,
NotBefore: tc.from,
NotAfter: tc.to,
}
parent := &x509.Certificate{SerialNumber: big.NewInt(1), Subject: tc.issuer, NotBefore: tc.from, NotAfter: tc.to}
der, err := x509.CreateCertificate(rand.Reader, tmpl, parent, &key.PublicKey, key)
if err != nil {
t.Fatal(err)
}
issuer, from, to, ok := CertificateIssuer(der)
if !ok || issuer != tc.want || from != tc.from.Unix() || to != tc.to.Unix() {
t.Errorf("CertificateIssuer = %q, %d, %d, %v; want %q, %d, %d, true", issuer, from, to, ok, tc.want, tc.from.Unix(), tc.to.Unix())
}
for n := range der {
if _, _, _, ok := CertificateIssuer(der[:n]); ok {
t.Fatalf("CertificateIssuer of %d of %d bytes is ok", n, len(der))
}
}
})
}
if _, _, _, ok := CertificateIssuer(nil); ok {
t.Error("CertificateIssuer(nil) is ok")
}
}