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.
56 lines
1.8 KiB
Go
56 lines
1.8 KiB
Go
//go:build !js
|
|
|
|
// Command gen compiles the glass's and the blur's shaders ahead of time,
|
|
// so that renderers start without compiling them: the Metal libraries on
|
|
// macOS, with Xcode's metal tools, into shaders_darwin.go, and the
|
|
// Direct3D bytecode on Windows, with the system's d3dcompiler_47.dll, into
|
|
// shaders_windows.go. Run it on each: go generate ./plugins/glass
|
|
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
"go/format"
|
|
"log"
|
|
"os"
|
|
"runtime"
|
|
"strings"
|
|
|
|
"github.com/egoist/mygo/internal/gpu"
|
|
)
|
|
|
|
// shader is a shader to compile, and the variables holding its code and
|
|
// the SHA-256 of what that was compiled from.
|
|
type shader struct{ file, codeVar, sumVar string }
|
|
|
|
func main() {
|
|
file := "shaders_darwin.go"
|
|
shaders := []shader{{"glass.metal", "metalLibrary", "metalSum"}, {"blur.metal", "blurMetalLibrary", "blurMetalSum"}}
|
|
if runtime.GOOS == "windows" {
|
|
file = "shaders_windows.go"
|
|
shaders = []shader{{"glass.hlsl", "hlslBytecode", "hlslSum"}, {"blur.hlsl", "blurBytecode", "blurHLSLSum"}}
|
|
}
|
|
var names []string
|
|
for _, sh := range shaders {
|
|
names = append(names, sh.file)
|
|
}
|
|
var b bytes.Buffer
|
|
fmt.Fprintf(&b, "// Code generated by internal/gen from %s; DO NOT EDIT.\n\n//go:build %s\n\npackage glass\n\n", strings.Join(names, " and "), runtime.GOOS)
|
|
for _, sh := range shaders {
|
|
compiled, code, err := compile(sh.file)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
fmt.Fprintf(&b, "// %s is the SHA-256 of what %s was compiled from: %s\n// within the renderer's head and tail.\nconst %s = %q\n\n", sh.sumVar, sh.codeVar, sh.file, sh.sumVar, gpu.SourceSum(compiled))
|
|
b.WriteString(gpu.GoBytes(sh.codeVar, code))
|
|
b.WriteString("\n")
|
|
}
|
|
out, err := format.Source(b.Bytes())
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
if err := os.WriteFile(file, out, 0o644); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|