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.
70 lines
2.1 KiB
Go
70 lines
2.1 KiB
Go
//go:build js
|
|
|
|
package mygo
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"io"
|
|
"time"
|
|
)
|
|
|
|
// Browsers load the app's newest version with the page: they neither
|
|
// update nor relaunch it, and builds for them leave out the updater, with
|
|
// net/http and the signatures' cryptography.
|
|
|
|
// UpdaterModule installs new versions of the app. In browsers updates are
|
|
// disabled.
|
|
type UpdaterModule struct{}
|
|
|
|
// Updater installs new versions of the app.
|
|
var Updater = &UpdaterModule{}
|
|
|
|
// ErrUpdatesDisabled is returned by Check for builds without updates, as
|
|
// those for browsers.
|
|
var ErrUpdatesDisabled = errors.New("mygo: updates are not enabled for this build")
|
|
|
|
// Update is a newer version of the app, found by Updater.Check.
|
|
type Update struct {
|
|
// Version of the update, and its release notes in Markdown.
|
|
Version string
|
|
Notes string
|
|
// Date is when the update was built.
|
|
Date time.Time
|
|
}
|
|
|
|
// Enabled reports whether the app can update itself: not in browsers.
|
|
func (u *UpdaterModule) Enabled() bool { return false }
|
|
|
|
// Check returns ErrUpdatesDisabled.
|
|
func (u *UpdaterModule) Check(ctx context.Context) (*Update, error) {
|
|
return nil, ErrUpdatesDisabled
|
|
}
|
|
|
|
// UpdateSource is where Updater gets updates from instead of the feed that
|
|
// mygo.config.ts configures. Browsers do not update apps.
|
|
type UpdateSource interface {
|
|
// Manifest returns the manifest of the running platform.
|
|
Manifest(ctx context.Context, prereleases bool) (io.ReadCloser, error)
|
|
// Open returns the file at url, which the manifest names.
|
|
Open(ctx context.Context, url string) (io.ReadCloser, error)
|
|
}
|
|
|
|
// SetSource does nothing: browsers do not update apps.
|
|
func (u *UpdaterModule) SetSource(s UpdateSource) {}
|
|
|
|
// SetPrereleases does nothing: browsers do not update apps.
|
|
func (u *UpdaterModule) SetPrereleases(on bool) {}
|
|
|
|
// Prereleases reports false.
|
|
func (u *UpdaterModule) Prereleases() bool { return false }
|
|
|
|
// Install returns ErrUpdatesDisabled.
|
|
func (up *Update) Install(ctx context.Context, progress func(downloaded, total int64)) error {
|
|
return ErrUpdatesDisabled
|
|
}
|
|
|
|
func relaunchNow() {}
|
|
|
|
func cleanUpdateLeftovers() {}
|