App-Icon „Phosphor“ für Windows, macOS, Linux und die Webseite
- assets/icon: grünes >_ mit Matrix-Regen, alle Größen als PNG, .ico, .icns; 16–64 px als vereinfachte Fassung, damit sie lesbar bleibt - Windows: Icon als Ressource in sshtermy.exe (rsrc_windows_*.syso, eigenes Werkzeug tools/icon/winres ohne Fremdabhängigkeit) - macOS: sshTermy.app bekommt das Icon; das Programm legt es selbst in die .app, so erhalten auch bestehende Installationen es nach dem Update - Linux: .deb mit hicolor-Icons und Startmenü-Eintrag - Webseite: Favicon, Apple-Touch-Icon, Logo in der Kopfzeile; README - make icon erzeugt alles neu Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUhyZeAnaXMQzGXmQU3
No files matched your search
@@ -6,7 +6,7 @@ PKG := github.com/db9979/sshtermy/internal/version
|
||||
LDFLAGS := -s -w -X $(PKG).Version=$(VERSION) -X $(PKG).Commit=$(COMMIT) -X $(PKG).Date=$(DATE) -X $(PKG).UpdatePubKey=$(UPDATE_PUBKEY)
|
||||
TARGETS := windows/arm64 windows/386 windows/amd64 darwin/arm64 darwin/amd64 linux/amd64 linux/arm64 linux/arm linux/riscv64
|
||||
|
||||
.PHONY: build test bench loadtest dist clean run golden handout fuzz vuln
|
||||
.PHONY: build test bench loadtest dist clean run golden handout fuzz vuln icon
|
||||
build:
|
||||
CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o bin/sshtermy ./cmd/sshtermy
|
||||
|
||||
@@ -40,6 +40,13 @@ handout:
|
||||
node tools/handout/render.mjs
|
||||
HANDOUT_STAMP=1 go test ./internal/ui -run TestHandoutKeysCurrent -count=1
|
||||
|
||||
# App-Icon neu erzeugen (assets/icon, site/*.png, Windows-.syso), braucht Python+Pillow und Node+Playwright
|
||||
icon:
|
||||
python3 tools/icon/gen.py
|
||||
node tools/icon/render.mjs
|
||||
python3 tools/icon/pack.py
|
||||
go run ./tools/icon/winres
|
||||
|
||||
dist: test
|
||||
@mkdir -p dist
|
||||
@for t in $(TARGETS); do \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# sshTermy
|
||||
# <img src="assets/icon/sshtermy-128.png" alt="sshTermy-Icon" width="48" height="48" align="top"> sshTermy
|
||||
|
||||
🇬🇧 [English version](README.md) · 🇩🇪 Deutsch
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# sshTermy
|
||||
# <img src="assets/icon/sshtermy-128.png" alt="sshTermy icon" width="48" height="48" align="top"> sshTermy
|
||||
|
||||
🇬🇧 English · 🇩🇪 [Deutsche Version](README.de.md)
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// Package icon enthält das App-Icon für die macOS-App (sshTermy.app).
|
||||
// Quelle und Neuerzeugung: tools/icon (make icon).
|
||||
package icon
|
||||
|
||||
import _ "embed"
|
||||
|
||||
// ICNS ist das Mac-Icon, das sshTermy beim Start in seine .app legt.
|
||||
//
|
||||
//go:embed sshtermy.icns
|
||||
var ICNS []byte
|
||||
|
After Width: | Height: | Size: 316 KiB |
|
After Width: | Height: | Size: 378 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 640 B |
|
After Width: | Height: | Size: 1017 B |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 137 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024"><g transform="translate(512 512) scale(1.1650485436893203) translate(-512 -512)"><defs>
|
||||
<filter id="sh" x="-20%" y="-20%" width="140%" height="140%"><feDropShadow dx="0" dy="14" stdDeviation="18" flood-color="#000" flood-opacity=".45"/></filter>
|
||||
<filter id="g" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="18" result="b"/><feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge></filter>
|
||||
<radialGradient id="crt" cx=".5" cy=".45" r=".7"><stop offset="0" stop-color="#0c2a0c"/><stop offset="1" stop-color="#020702"/></radialGradient>
|
||||
<clipPath id="c"><rect x="100" y="100" width="824" height="824" rx="185"/></clipPath>
|
||||
</defs><g><rect x="100" y="100" width="824" height="824" rx="185" fill="url(#crt)"/><rect x="104" y="104" width="816" height="816" rx="181" fill="none" stroke="#1f5c1a" stroke-width="8"/></g><g clip-path="url(#c)"><text x="140" y="275" fill="#1f9e10" fill-opacity="0.13" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">#</text><text x="140" y="333" fill="#1f9e10" fill-opacity="0.27" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">7</text><text x="140" y="391" fill="#1f9e10" fill-opacity="0.40" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">0</text><text x="140" y="449" fill="#1f9e10" fill-opacity="0.53" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">1</text><text x="140" y="507" fill="#1f9e10" fill-opacity="0.67" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">ツ</text><text x="140" y="565" fill="#b8ffb0" fill-opacity="0.80" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">1</text><text x="200" y="297" fill="#1f9e10" fill-opacity="0.09" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">0</text><text x="200" y="355" fill="#1f9e10" fill-opacity="0.18" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">ツ</text><text x="200" y="413" fill="#1f9e10" fill-opacity="0.27" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">></text><text x="200" y="471" fill="#1f9e10" fill-opacity="0.36" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">0</text><text x="200" y="529" fill="#1f9e10" fill-opacity="0.44" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">1</text><text x="200" y="587" fill="#1f9e10" fill-opacity="0.53" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">#</text><text x="200" y="645" fill="#1f9e10" fill-opacity="0.62" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">#</text><text x="200" y="703" fill="#1f9e10" fill-opacity="0.71" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">1</text><text x="200" y="761" fill="#b8ffb0" fill-opacity="0.80" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">></text><text x="260" y="156" fill="#1f9e10" fill-opacity="0.09" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">#</text><text x="260" y="214" fill="#1f9e10" fill-opacity="0.18" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">0</text><text x="260" y="272" fill="#1f9e10" fill-opacity="0.27" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">テ</text><text x="260" y="330" fill="#1f9e10" fill-opacity="0.36" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">1</text><text x="260" y="388" fill="#1f9e10" fill-opacity="0.44" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">></text><text x="260" y="446" fill="#1f9e10" fill-opacity="0.53" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">7</text><text x="260" y="504" fill="#1f9e10" fill-opacity="0.62" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">7</text><text x="260" y="562" fill="#1f9e10" fill-opacity="0.71" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">テ</text><text x="260" y="620" fill="#b8ffb0" fill-opacity="0.80" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">0</text><text x="320" y="405" fill="#1f9e10" fill-opacity="0.09" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">#</text><text x="320" y="463" fill="#1f9e10" fill-opacity="0.18" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">0</text><text x="320" y="521" fill="#1f9e10" fill-opacity="0.27" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">></text><text x="320" y="579" fill="#1f9e10" fill-opacity="0.36" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">0</text><text x="320" y="637" fill="#1f9e10" fill-opacity="0.44" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">ツ</text><text x="320" y="695" fill="#1f9e10" fill-opacity="0.53" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">ア</text><text x="320" y="753" fill="#1f9e10" fill-opacity="0.62" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">_</text><text x="320" y="811" fill="#1f9e10" fill-opacity="0.71" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">#</text><text x="320" y="869" fill="#b8ffb0" fill-opacity="0.80" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">ア</text><text x="380" y="386" fill="#1f9e10" fill-opacity="0.16" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">テ</text><text x="Line truncated
|
||||
|
After Width: | Height: | Size: 22 KiB |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024"><g transform="translate(512 512) scale(1.2378640776699028) translate(-512 -512)"><defs>
|
||||
<filter id="sh" x="-20%" y="-20%" width="140%" height="140%"><feDropShadow dx="0" dy="14" stdDeviation="18" flood-color="#000" flood-opacity=".45"/></filter>
|
||||
<filter id="g" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="10" result="b"/><feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge></filter>
|
||||
<radialGradient id="crt" cx=".5" cy=".45" r=".7"><stop offset="0" stop-color="#0c2a0c"/><stop offset="1" stop-color="#020702"/></radialGradient>
|
||||
<clipPath id="c"><rect x="100" y="100" width="824" height="824" rx="185"/></clipPath>
|
||||
</defs><g><rect x="100" y="100" width="824" height="824" rx="185" fill="url(#crt)"/><rect x="104" y="104" width="816" height="816" rx="181" fill="none" stroke="#1f5c1a" stroke-width="8"/></g><g clip-path="url(#c)"><g transform="translate(512 600) scale(1.25) translate(-516 -590)"><g filter="url(#g)" fill="#39ff14"><path d="M262 430 L452 590 L262 750" fill="none" stroke="#39ff14" stroke-width="110" stroke-linecap="square" stroke-linejoin="miter"/><rect x="520" y="672" width="250" height="110"/></g></g></g></g></svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 70 KiB |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024"><g><defs>
|
||||
<filter id="sh" x="-20%" y="-20%" width="140%" height="140%"><feDropShadow dx="0" dy="14" stdDeviation="18" flood-color="#000" flood-opacity=".45"/></filter>
|
||||
<filter id="g" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="18" result="b"/><feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge></filter>
|
||||
<radialGradient id="crt" cx=".5" cy=".45" r=".7"><stop offset="0" stop-color="#0c2a0c"/><stop offset="1" stop-color="#020702"/></radialGradient>
|
||||
<clipPath id="c"><rect x="100" y="100" width="824" height="824" rx="185"/></clipPath>
|
||||
</defs><g filter="url(#sh)"><rect x="100" y="100" width="824" height="824" rx="185" fill="url(#crt)"/><rect x="104" y="104" width="816" height="816" rx="181" fill="none" stroke="#1f5c1a" stroke-width="8"/></g><g clip-path="url(#c)"><text x="140" y="275" fill="#1f9e10" fill-opacity="0.13" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">#</text><text x="140" y="333" fill="#1f9e10" fill-opacity="0.27" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">7</text><text x="140" y="391" fill="#1f9e10" fill-opacity="0.40" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">0</text><text x="140" y="449" fill="#1f9e10" fill-opacity="0.53" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">1</text><text x="140" y="507" fill="#1f9e10" fill-opacity="0.67" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">ツ</text><text x="140" y="565" fill="#b8ffb0" fill-opacity="0.80" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">1</text><text x="200" y="297" fill="#1f9e10" fill-opacity="0.09" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">0</text><text x="200" y="355" fill="#1f9e10" fill-opacity="0.18" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">ツ</text><text x="200" y="413" fill="#1f9e10" fill-opacity="0.27" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">></text><text x="200" y="471" fill="#1f9e10" fill-opacity="0.36" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">0</text><text x="200" y="529" fill="#1f9e10" fill-opacity="0.44" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">1</text><text x="200" y="587" fill="#1f9e10" fill-opacity="0.53" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">#</text><text x="200" y="645" fill="#1f9e10" fill-opacity="0.62" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">#</text><text x="200" y="703" fill="#1f9e10" fill-opacity="0.71" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">1</text><text x="200" y="761" fill="#b8ffb0" fill-opacity="0.80" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">></text><text x="260" y="156" fill="#1f9e10" fill-opacity="0.09" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">#</text><text x="260" y="214" fill="#1f9e10" fill-opacity="0.18" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">0</text><text x="260" y="272" fill="#1f9e10" fill-opacity="0.27" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">テ</text><text x="260" y="330" fill="#1f9e10" fill-opacity="0.36" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">1</text><text x="260" y="388" fill="#1f9e10" fill-opacity="0.44" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">></text><text x="260" y="446" fill="#1f9e10" fill-opacity="0.53" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">7</text><text x="260" y="504" fill="#1f9e10" fill-opacity="0.62" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">7</text><text x="260" y="562" fill="#1f9e10" fill-opacity="0.71" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">テ</text><text x="260" y="620" fill="#b8ffb0" fill-opacity="0.80" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">0</text><text x="320" y="405" fill="#1f9e10" fill-opacity="0.09" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">#</text><text x="320" y="463" fill="#1f9e10" fill-opacity="0.18" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">0</text><text x="320" y="521" fill="#1f9e10" fill-opacity="0.27" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">></text><text x="320" y="579" fill="#1f9e10" fill-opacity="0.36" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">0</text><text x="320" y="637" fill="#1f9e10" fill-opacity="0.44" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">ツ</text><text x="320" y="695" fill="#1f9e10" fill-opacity="0.53" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">ア</text><text x="320" y="753" fill="#1f9e10" fill-opacity="0.62" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">_</text><text x="320" y="811" fill="#1f9e10" fill-opacity="0.71" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">#</text><text x="320" y="869" fill="#b8ffb0" fill-opacity="0.80" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">ア</text><text x="380" y="386" fill="#1f9e10" fill-opacity="0.16" font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">Line truncated
|
||||
|
After Width: | Height: | Size: 22 KiB |
@@ -0,0 +1,43 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// installMacIcon legt icns nach <App>.app/Contents/Resources/sshtermy.icns und
|
||||
// trägt CFBundleIconFile in Info.plist ein, wenn exe in einer .app liegt
|
||||
// (install.sh: Contents/Resources/sshtermy). Meldet, ob sich etwas geändert hat.
|
||||
func installMacIcon(exe string, icns []byte) bool {
|
||||
if r, err := filepath.EvalSymlinks(exe); err == nil {
|
||||
exe = r
|
||||
}
|
||||
res := filepath.Dir(exe)
|
||||
contents := filepath.Dir(res)
|
||||
app := filepath.Dir(contents)
|
||||
if filepath.Base(res) != "Resources" || filepath.Base(contents) != "Contents" || !strings.HasSuffix(app, ".app") {
|
||||
return false
|
||||
}
|
||||
changed := false
|
||||
dst := filepath.Join(res, "sshtermy.icns")
|
||||
if old, err := os.ReadFile(dst); err != nil || !bytes.Equal(old, icns) {
|
||||
if os.WriteFile(dst, icns, 0o644) == nil {
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
plist := filepath.Join(contents, "Info.plist")
|
||||
if b, err := os.ReadFile(plist); err == nil && !bytes.Contains(b, []byte("CFBundleIconFile")) {
|
||||
s := strings.Replace(string(b), "</dict>", "\t<key>CFBundleIconFile</key><string>sshtermy</string>\n</dict>", 1)
|
||||
if os.WriteFile(plist, []byte(s), 0o644) == nil {
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
if changed { // Finder liest das Icon neu, wenn sich die App ändert
|
||||
now := time.Now()
|
||||
os.Chtimes(app, now, now)
|
||||
}
|
||||
return changed
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/db9979/sshtermy/assets/icon"
|
||||
)
|
||||
|
||||
// fixMacAppIcon gibt einer per install.sh angelegten sshTermy.app ihr Icon,
|
||||
// auch wenn sie vor dem Icon installiert wurde (Auto-Update tauscht nur die
|
||||
// Programmdatei). Fehler sind egal: dann bleibt das Standard-Icon.
|
||||
func fixMacAppIcon() {
|
||||
if exe, err := os.Executable(); err == nil {
|
||||
installMacIcon(exe, icon.ICNS)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
//go:build !darwin
|
||||
|
||||
package main
|
||||
|
||||
func fixMacAppIcon() {}
|
||||
@@ -0,0 +1,44 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestInstallMacIcon(t *testing.T) {
|
||||
d := t.TempDir()
|
||||
c := filepath.Join(d, "sshTermy.app", "Contents")
|
||||
res := filepath.Join(c, "Resources")
|
||||
if err := os.MkdirAll(res, 0o755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
exe := filepath.Join(res, "sshtermy")
|
||||
os.WriteFile(exe, nil, 0o755)
|
||||
plist := "<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleName</key><string>sshTermy</string>\n</dict>\n</plist>\n"
|
||||
os.WriteFile(filepath.Join(c, "Info.plist"), []byte(plist), 0o644)
|
||||
|
||||
if !installMacIcon(exe, []byte("ICNS")) {
|
||||
t.Fatal("erster Aufruf soll das Icon eintragen")
|
||||
}
|
||||
if b, _ := os.ReadFile(filepath.Join(res, "sshtermy.icns")); string(b) != "ICNS" {
|
||||
t.Fatalf("icns = %q", b)
|
||||
}
|
||||
b, _ := os.ReadFile(filepath.Join(c, "Info.plist"))
|
||||
if strings.Count(string(b), "CFBundleIconFile") != 1 || !strings.Contains(string(b), "<string>sshtermy</string>\n</dict>") {
|
||||
t.Fatalf("Info.plist:\n%s", b)
|
||||
}
|
||||
if installMacIcon(exe, []byte("ICNS")) {
|
||||
t.Fatal("zweiter Aufruf soll nichts ändern")
|
||||
}
|
||||
if !installMacIcon(exe, []byte("NEU")) {
|
||||
t.Fatal("neues Icon nach Update soll geschrieben werden")
|
||||
}
|
||||
|
||||
// außerhalb einer .app: nichts anfassen
|
||||
other := filepath.Join(d, "bin", "sshtermy")
|
||||
if installMacIcon(other, []byte("ICNS")) {
|
||||
t.Fatal("ohne .app darf nichts passieren")
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,7 @@ func main() {
|
||||
forceTUI := flag.Bool("tui", false, i18n.T("im Terminal starten, auch ohne Terminal kein eigenes Fenster öffnen"))
|
||||
crashTest := flag.String("crash-test", "", i18n.T("nur zum Ausprobieren des Absturzberichts: ui, cmd oder fatal"))
|
||||
flag.Parse()
|
||||
fixMacAppIcon() // auch bei -version: so legt install.sh das Icon in die .app
|
||||
|
||||
if *showVersion {
|
||||
fmt.Println(version.Long())
|
||||
|
||||
@@ -79,6 +79,7 @@ EOF
|
||||
<key>CFBundleDisplayName</key><string>sshTermy</string>
|
||||
<key>CFBundleIdentifier</key><string>com.github.db9979.sshtermy</string>
|
||||
<key>CFBundleExecutable</key><string>sshTermy</string>
|
||||
<key>CFBundleIconFile</key><string>sshtermy</string>
|
||||
<key>CFBundlePackageType</key><string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key><string>1.0</string>
|
||||
<key>LSMinimumSystemVersion</key><string>11.0</string>
|
||||
@@ -86,6 +87,8 @@ EOF
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
# Das Programm legt sein Icon selbst nach Resources/sshtermy.icns.
|
||||
"$bin" -version >/dev/null 2>&1 || true
|
||||
xattr -dr com.apple.quarantine "$app" 2>/dev/null || true
|
||||
# Finder/Launchpad sollen die neue App gleich sehen.
|
||||
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f "$app" >/dev/null 2>&1 || true
|
||||
|
||||
@@ -10,6 +10,25 @@ trap 'rm -rf "$root"' EXIT INT TERM
|
||||
chmod 755 "$root"
|
||||
install -Dm755 "$bin" "$root/usr/bin/sshtermy"
|
||||
install -d "$root/usr/share/doc/sshtermy" "$root/DEBIAN"
|
||||
# Icon + Startmenü-Eintrag (öffnet sshTermy im Standard-Terminal)
|
||||
icons="$(dirname "$0")/../assets/icon"
|
||||
for s in 16 24 32 48 64 128 256 512; do
|
||||
install -Dm644 "$icons/sshtermy-$s.png" "$root/usr/share/icons/hicolor/${s}x$s/apps/sshtermy.png"
|
||||
done
|
||||
install -d "$root/usr/share/applications"
|
||||
cat >"$root/usr/share/applications/sshtermy.desktop" <<'TXT'
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=sshTermy
|
||||
GenericName=SSH Terminal
|
||||
Comment=SSH terminal with an AI copilot
|
||||
Comment[de]=SSH-Terminal mit KI-Kopilot
|
||||
Exec=sshtermy
|
||||
Icon=sshtermy
|
||||
Terminal=true
|
||||
Categories=Network;RemoteAccess;
|
||||
Keywords=ssh;sftp;telnet;serial;terminal;
|
||||
TXT
|
||||
cat >"$root/usr/share/doc/sshtermy/copyright" <<'TXT'
|
||||
sshTermy – SSH terminal with an AI copilot
|
||||
Idea: Dominik Bornhäußer
|
||||
|
||||
|
After Width: | Height: | Size: 28 KiB |
@@ -7,12 +7,13 @@
|
||||
<meta name="description" content="Handbuch zu sshTermy: Einrichtung, Verbindungen, Terminal, KI, Netzwerkgeräte, Sicherheit, Sync, Umzug, MCP und häufige Fragen.">
|
||||
<link rel="alternate" hreflang="en" href="../manual.html">
|
||||
<link rel="stylesheet" href="../style.css">
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><text y='13' font-size='14' fill='%23bb9af7'>◆</text></svg>">
|
||||
<link rel="icon" type="image/png" href="../favicon.png">
|
||||
<link rel="apple-touch-icon" href="../apple-touch-icon.png">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="bar">
|
||||
<a class="logo" href="./"><span>◆</span> sshTermy</a>
|
||||
<a class="logo" href="./"><img src="../logo.png" alt="" width="28" height="28"> sshTermy</a>
|
||||
<nav>
|
||||
<a href="./#installieren">Installation</a>
|
||||
<a href="./#funktionen">Funktionen</a>
|
||||
|
||||
@@ -7,12 +7,13 @@
|
||||
<meta name="description" content="sshTermy ist ein SSH-Terminal (TUI) mit KI-Copilot für Windows, macOS und Linux: Verbindungsmanager, Ziel- und Agent-Modus, Ghost-Text, geteilte Ansicht, SFTP, Tunnel, Broadcast. Idee: Dominik Bornhäußer.">
|
||||
<link rel="alternate" hreflang="en" href="../">
|
||||
<link rel="stylesheet" href="../style.css">
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><text y='13' font-size='14' fill='%23bb9af7'>◆</text></svg>">
|
||||
<link rel="icon" type="image/png" href="../favicon.png">
|
||||
<link rel="apple-touch-icon" href="../apple-touch-icon.png">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="bar">
|
||||
<a class="logo" href="./"><span>◆</span> sshTermy</a>
|
||||
<a class="logo" href="./"><img src="../logo.png" alt="" width="28" height="28"> sshTermy</a>
|
||||
<nav>
|
||||
<a href="#installieren">Installieren</a>
|
||||
<a href="#rundgang">Rundgang</a>
|
||||
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -7,12 +7,13 @@
|
||||
<meta name="description" content="sshTermy is an SSH terminal (TUI) with an AI copilot for Windows, macOS and Linux: connection manager, goal and agent mode, ghost text, split view, SFTP, tunnels, broadcast. Idea: Dominik Bornhäußer.">
|
||||
<link rel="alternate" hreflang="de" href="de/">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><text y='13' font-size='14' fill='%23bb9af7'>◆</text></svg>">
|
||||
<link rel="icon" type="image/png" href="favicon.png">
|
||||
<link rel="apple-touch-icon" href="apple-touch-icon.png">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="bar">
|
||||
<a class="logo" href="./"><span>◆</span> sshTermy</a>
|
||||
<a class="logo" href="./"><img src="logo.png" alt="" width="28" height="28"> sshTermy</a>
|
||||
<nav>
|
||||
<a href="#install">Install</a>
|
||||
<a href="#tour">Tour</a>
|
||||
|
||||
|
After Width: | Height: | Size: 3.9 KiB |
@@ -7,12 +7,13 @@
|
||||
<meta name="description" content="sshTermy manual: setup, connections, terminal, AI, network devices, security, sync, moving to a new computer, MCP and frequently asked questions.">
|
||||
<link rel="alternate" hreflang="de" href="de/handbuch.html">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><text y='13' font-size='14' fill='%23bb9af7'>◆</text></svg>">
|
||||
<link rel="icon" type="image/png" href="favicon.png">
|
||||
<link rel="apple-touch-icon" href="apple-touch-icon.png">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="bar">
|
||||
<a class="logo" href="./"><span>◆</span> sshTermy</a>
|
||||
<a class="logo" href="./"><img src="logo.png" alt="" width="28" height="28"> sshTermy</a>
|
||||
<nav>
|
||||
<a href="./#install">Install</a>
|
||||
<a href="./#features">Features</a>
|
||||
|
||||
@@ -16,7 +16,8 @@ kbd { background: #1f2430; border: 1px solid var(--line); border-bottom-width: 2
|
||||
header { position: sticky; top: 0; z-index: 10; background: rgba(13,17,23,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
|
||||
.bar { max-width: 1100px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 22px; }
|
||||
.logo { font-family: var(--mono); font-weight: 700; color: var(--fg); font-size: 18px; }
|
||||
.logo span { color: var(--violet); }
|
||||
.logo { display: inline-flex; align-items: center; gap: 8px; }
|
||||
.logo img { display: block; border-radius: 6px; }
|
||||
nav { display: flex; gap: 18px; flex: 1; overflow-x: auto; white-space: nowrap; }
|
||||
nav a { color: var(--dim); font-size: 15px; }
|
||||
nav a:hover { color: var(--fg); text-decoration: none; }
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
#!/usr/bin/env python3
|
||||
"""App-Icon „Phosphor“: schreibt die SVG-Vorlagen nach assets/icon/.
|
||||
|
||||
sshtermy.svg Mac-Fassung (Körper 824 px in 1024, Apple-Raster)
|
||||
sshtermy-full.svg Windows/Linux/Web (Körper fast randlos)
|
||||
sshtermy-small.svg 16–64 px: ohne Regen und Zeilen, dickere Striche
|
||||
|
||||
Danach render.mjs (PNG, Playwright) und pack.py (.ico, .icns). Alles: make icon
|
||||
"""
|
||||
import os, random
|
||||
|
||||
OUT = os.path.join(os.path.dirname(__file__), "..", "..", "assets", "icon")
|
||||
GREEN, DIM, HEAD = "#39ff14", "#1f9e10", "#b8ffb0"
|
||||
|
||||
|
||||
def defs(glow):
|
||||
return f'''<defs>
|
||||
<filter id="sh" x="-20%" y="-20%" width="140%" height="140%"><feDropShadow dx="0" dy="14" stdDeviation="18" flood-color="#000" flood-opacity=".45"/></filter>
|
||||
<filter id="g" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="{glow}" result="b"/><feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge></filter>
|
||||
<radialGradient id="crt" cx=".5" cy=".45" r=".7"><stop offset="0" stop-color="#0c2a0c"/><stop offset="1" stop-color="#020702"/></radialGradient>
|
||||
<clipPath id="c"><rect x="100" y="100" width="824" height="824" rx="185"/></clipPath>
|
||||
</defs>'''
|
||||
|
||||
|
||||
def body(shadow=True):
|
||||
s = ' filter="url(#sh)"' if shadow else ""
|
||||
return (f'<g{s}><rect x="100" y="100" width="824" height="824" rx="185" fill="url(#crt)"/>'
|
||||
'<rect x="104" y="104" width="816" height="816" rx="181" fill="none" stroke="#1f5c1a" stroke-width="8"/></g>')
|
||||
|
||||
|
||||
def rain():
|
||||
random.seed(7)
|
||||
out = []
|
||||
for col in range(13):
|
||||
x, top, n = 140 + col * 60, random.randint(110, 600), random.randint(5, 11)
|
||||
for k in range(n):
|
||||
y = top + k * 58
|
||||
if y > 900:
|
||||
break
|
||||
ch = random.choice("01ア>_$#シツテ7")
|
||||
fill = HEAD if k == n - 1 else DIM
|
||||
out.append(f'<text x="{x}" y="{y}" fill="{fill}" fill-opacity="{(k + 1) / n * .8:.2f}" '
|
||||
f'font-family="DejaVu Sans Mono,monospace" font-size="48" font-weight="bold">{ch}</text>')
|
||||
return "".join(out)
|
||||
|
||||
|
||||
def scanlines():
|
||||
return "".join(f'<rect x="100" y="{y}" width="824" height="3" fill="#000" fill-opacity=".35"/>' for y in range(104, 924, 9))
|
||||
|
||||
|
||||
def prompt(w=80):
|
||||
return (f'<g filter="url(#g)" fill="{GREEN}"><path d="M262 430 L452 590 L262 750" fill="none" stroke="{GREEN}" '
|
||||
f'stroke-width="{w}" stroke-linecap="square" stroke-linejoin="miter"/>'
|
||||
f'<rect x="520" y="{782 - w}" width="250" height="{w}"/></g>')
|
||||
|
||||
|
||||
def svg(inner, scale=1.0):
|
||||
t = f' transform="translate(512 512) scale({scale}) translate(-512 -512)"' if scale != 1 else ""
|
||||
return f'<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024"><g{t}>{inner}</g></svg>\n'
|
||||
|
||||
|
||||
def big(shadow):
|
||||
return defs(18) + body(shadow) + f'<g clip-path="url(#c)">{rain()}<rect x="100" y="100" width="824" height="824" fill="url(#crt)" fill-opacity=".35"/>{prompt()}{scanlines()}</g>'
|
||||
# klein: Körper randlos, Zeichen größer und kräftiger, damit 16 px lesbar bleibt
|
||||
small = defs(10) + body(False) + ('<g clip-path="url(#c)"><g transform="translate(512 600) scale(1.25) translate(-516 -590)">'
|
||||
+ prompt(110) + '</g></g>')
|
||||
|
||||
# randlose Fassung ohne Schatten (würde am Bildrand abgeschnitten)
|
||||
for name, s in (("sshtermy.svg", svg(big(True))), ("sshtermy-full.svg", svg(big(False), 960 / 824)),
|
||||
("sshtermy-small.svg", svg(small, 1020 / 824))):
|
||||
with open(os.path.join(OUT, name), "w") as f:
|
||||
f.write(s)
|
||||
print(name)
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python3
|
||||
"""PNGs → sshtermy.ico (Windows) und sshtermy.icns (macOS), braucht Pillow."""
|
||||
import os
|
||||
from PIL import Image
|
||||
|
||||
D = os.path.join(os.path.dirname(__file__), "..", "..", "assets", "icon")
|
||||
img = lambda n: Image.open(os.path.join(D, n)).convert("RGBA")
|
||||
|
||||
# .ico: jede Größe aus ihrer eigenen PNG (16–64 kleine Fassung)
|
||||
sizes = [16, 24, 32, 48, 64, 128, 256]
|
||||
# Pillow nimmt nur Größen ≤ erstes Bild, darum die größte zuerst
|
||||
first, rest = img(f"sshtermy-{sizes[-1]}.png"), [img(f"sshtermy-{s}.png") for s in sizes[:-1]]
|
||||
first.save(os.path.join(D, "sshtermy.ico"), sizes=[(s, s) for s in sizes], append_images=rest)
|
||||
|
||||
# .icns: Mac-Fassung, Pillow erzeugt alle Retina-Stufen aus 1024
|
||||
img("mac-1024.png").save(os.path.join(D, "sshtermy.icns"))
|
||||
print("sshtermy.ico sshtermy.icns")
|
||||
|
||||
# Webseite (site/ wird so wie es ist auf GitHub Pages kopiert)
|
||||
S = os.path.join(os.path.dirname(__file__), "..", "..", "site")
|
||||
img("sshtermy-32.png").save(os.path.join(S, "favicon.png"))
|
||||
img("sshtermy-64.png").save(os.path.join(S, "logo.png"))
|
||||
img("sshtermy-1024.png").resize((180, 180), Image.LANCZOS).save(os.path.join(S, "apple-touch-icon.png"))
|
||||
print("site/favicon.png site/logo.png site/apple-touch-icon.png")
|
||||
@@ -0,0 +1,24 @@
|
||||
// SVG → PNG mit Chromium (Playwright), transparenter Hintergrund.
|
||||
import { createRequire } from 'module';
|
||||
import { readFileSync } from 'fs';
|
||||
const { chromium } = createRequire(import.meta.url)('playwright');
|
||||
import { join, dirname } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
const dir = join(dirname(fileURLToPath(import.meta.url)), '..', '..', 'assets', 'icon');
|
||||
const jobs = [
|
||||
['sshtermy.svg', 'mac', [1024]],
|
||||
['sshtermy-full.svg', 'sshtermy', [128, 256, 512, 1024]],
|
||||
['sshtermy-small.svg', 'sshtermy', [16, 24, 32, 48, 64]],
|
||||
];
|
||||
const b = await chromium.launch();
|
||||
const p = await b.newPage({ viewport: { width: 1024, height: 1024 } });
|
||||
for (const [svg, prefix, sizes] of jobs) {
|
||||
await p.setContent(`<body style="margin:0;background:transparent">${readFileSync(join(dir, svg), 'utf8')}</body>`);
|
||||
for (const s of sizes) {
|
||||
// Chromium verkleinert selbst (bessere Glut als Nachskalieren); 1024 als Ausgangsgröße
|
||||
await p.setViewportSize({ width: s, height: s });
|
||||
await p.evaluate(s => { const e = document.querySelector('svg'); e.setAttribute('width', s); e.setAttribute('height', s); }, s);
|
||||
await p.screenshot({ path: join(dir, `${prefix}-${s}.png`), omitBackground: true });
|
||||
}
|
||||
}
|
||||
await b.close();
|
||||
@@ -0,0 +1,240 @@
|
||||
// Command winres schreibt das App-Icon als Windows-Ressource (.syso) neben
|
||||
// main.go, damit Explorer, Taskleiste und Startmenü sshtermy.exe mit Icon
|
||||
// zeigen. go build nimmt rsrc_windows_<arch>.syso automatisch mit; andere
|
||||
// Systeme ignorieren die Dateien.
|
||||
//
|
||||
// go run ./tools/icon/winres (aus assets/icon/sshtermy.ico)
|
||||
//
|
||||
// Ohne Fremdwerkzeug: die .ico-Bilder werden als RT_ICON + RT_GROUP_ICON in
|
||||
// eine COFF-Objektdatei mit einer .rsrc-Sektion gepackt.
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
const (
|
||||
rtIcon = 3
|
||||
rtGroupIcon = 14
|
||||
langNeutral = 0
|
||||
groupID = 1
|
||||
)
|
||||
|
||||
type icoImage struct {
|
||||
w, h, colors, planes, bits uint16
|
||||
data []byte
|
||||
}
|
||||
|
||||
func readICO(path string) ([]icoImage, error) {
|
||||
b, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
le := binary.LittleEndian
|
||||
if len(b) < 6 || le.Uint16(b[0:]) != 0 || le.Uint16(b[2:]) != 1 {
|
||||
return nil, fmt.Errorf("%s: keine .ico-Datei", path)
|
||||
}
|
||||
n := int(le.Uint16(b[4:]))
|
||||
var out []icoImage
|
||||
for i := 0; i < n; i++ {
|
||||
e := b[6+16*i:]
|
||||
if len(e) < 16 {
|
||||
return nil, fmt.Errorf("%s: Eintrag %d abgeschnitten", path, i)
|
||||
}
|
||||
size, off := le.Uint32(e[8:]), le.Uint32(e[12:])
|
||||
if int(off)+int(size) > len(b) {
|
||||
return nil, fmt.Errorf("%s: Bild %d außerhalb der Datei", path, i)
|
||||
}
|
||||
out = append(out, icoImage{
|
||||
w: uint16(e[0]), h: uint16(e[1]), colors: uint16(e[2]),
|
||||
planes: le.Uint16(e[4:]), bits: le.Uint16(e[6:]),
|
||||
data: b[off : off+size],
|
||||
})
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// leaf ist ein Ressourcen-Eintrag Typ/ID/Sprache → Daten.
|
||||
type leaf struct {
|
||||
typ, id uint16
|
||||
data []byte
|
||||
}
|
||||
|
||||
// buildRsrc baut den Inhalt der .rsrc-Sektion und liefert die Offsets der
|
||||
// OffsetToData-Felder, die der Linker auf RVAs umrechnen muss.
|
||||
func buildRsrc(leaves []leaf) ([]byte, []uint32) {
|
||||
// Gruppen nach Typ (aufsteigend, wie Windows es verlangt)
|
||||
var types []uint16
|
||||
byType := map[uint16][]leaf{}
|
||||
for _, l := range leaves {
|
||||
if _, ok := byType[l.typ]; !ok {
|
||||
types = append(types, l.typ)
|
||||
}
|
||||
byType[l.typ] = append(byType[l.typ], l)
|
||||
}
|
||||
for i := range types { // kleine Listen: einfaches Sortieren
|
||||
for j := i + 1; j < len(types); j++ {
|
||||
if types[j] < types[i] {
|
||||
types[i], types[j] = types[j], types[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dirSize := func(n int) int { return 16 + 8*n }
|
||||
// Layout: Wurzel, Typ-Verzeichnisse, Sprach-Verzeichnisse, Daten-Einträge, Daten
|
||||
off := dirSize(len(types))
|
||||
typeOff := map[uint16]int{}
|
||||
for _, t := range types {
|
||||
typeOff[t] = off
|
||||
off += dirSize(len(byType[t]))
|
||||
}
|
||||
langOff := make([]int, len(leaves))
|
||||
ordered := make([]leaf, 0, len(leaves))
|
||||
for _, t := range types {
|
||||
ordered = append(ordered, byType[t]...)
|
||||
}
|
||||
for i := range ordered {
|
||||
langOff[i] = off
|
||||
off += dirSize(1)
|
||||
}
|
||||
entryOff := make([]int, len(ordered))
|
||||
for i := range ordered {
|
||||
entryOff[i] = off
|
||||
off += 16
|
||||
}
|
||||
dataOff := make([]int, len(ordered))
|
||||
for i, l := range ordered {
|
||||
off = (off + 7) &^ 7
|
||||
dataOff[i] = off
|
||||
off += len(l.data)
|
||||
}
|
||||
buf := make([]byte, (off+7)&^7)
|
||||
le := binary.LittleEndian
|
||||
dir := func(at, n int) {
|
||||
le.PutUint16(buf[at+14:], uint16(n)) // nur ID-Einträge
|
||||
}
|
||||
ent := func(at int, id uint16, target int, sub bool) {
|
||||
le.PutUint32(buf[at:], uint32(id))
|
||||
v := uint32(target)
|
||||
if sub {
|
||||
v |= 0x80000000
|
||||
}
|
||||
le.PutUint32(buf[at+4:], v)
|
||||
}
|
||||
|
||||
dir(0, len(types))
|
||||
for i, t := range types {
|
||||
ent(16+8*i, t, typeOff[t], true)
|
||||
}
|
||||
k := 0
|
||||
for _, t := range types {
|
||||
dir(typeOff[t], len(byType[t]))
|
||||
for j, l := range byType[t] {
|
||||
ent(typeOff[t]+16+8*j, l.id, langOff[k], true)
|
||||
k++
|
||||
}
|
||||
}
|
||||
var relocs []uint32
|
||||
for i, l := range ordered {
|
||||
dir(langOff[i], 1)
|
||||
ent(langOff[i]+16, langNeutral, entryOff[i], false)
|
||||
le.PutUint32(buf[entryOff[i]:], uint32(dataOff[i])) // + RVA der Sektion (Relokation)
|
||||
le.PutUint32(buf[entryOff[i]+4:], uint32(len(l.data)))
|
||||
relocs = append(relocs, uint32(entryOff[i]))
|
||||
copy(buf[dataOff[i]:], l.data)
|
||||
}
|
||||
return buf, relocs
|
||||
}
|
||||
|
||||
// coff verpackt die Sektion als Objektdatei für den Go-Linker.
|
||||
func coff(machine, relType uint16, sect []byte, relocs []uint32) []byte {
|
||||
var b bytes.Buffer
|
||||
le := binary.LittleEndian
|
||||
w := func(v any) { binary.Write(&b, le, v) }
|
||||
const hdr, shdr = 20, 40
|
||||
rawOff := hdr + shdr
|
||||
relOff := rawOff + len(sect)
|
||||
symOff := relOff + 10*len(relocs)
|
||||
|
||||
w(machine)
|
||||
w(uint16(1)) // Sektionen
|
||||
w(uint32(0)) // Zeitstempel: reproduzierbar
|
||||
w(uint32(symOff))
|
||||
w(uint32(1)) // Symbole
|
||||
w(uint16(0)) // optionaler Header
|
||||
w(uint16(0))
|
||||
|
||||
b.WriteString(".rsrc\x00\x00\x00")
|
||||
w(uint32(0)) // VirtualSize
|
||||
w(uint32(0)) // VirtualAddress
|
||||
w(uint32(len(sect)))
|
||||
w(uint32(rawOff))
|
||||
w(uint32(relOff))
|
||||
w(uint32(0))
|
||||
w(uint16(len(relocs)))
|
||||
w(uint16(0))
|
||||
w(uint32(0x40000040)) // INITIALIZED_DATA | MEM_READ
|
||||
|
||||
b.Write(sect)
|
||||
for _, r := range relocs {
|
||||
w(r)
|
||||
w(uint32(0)) // Symbol .rsrc
|
||||
w(relType)
|
||||
}
|
||||
b.WriteString(".rsrc\x00\x00\x00")
|
||||
w(uint32(0)) // Wert
|
||||
w(uint16(1)) // Sektion 1
|
||||
w(uint16(0)) // Typ
|
||||
w(uint8(3)) // IMAGE_SYM_CLASS_STATIC
|
||||
w(uint8(0)) // keine Hilfssymbole
|
||||
w(uint32(4)) // leere String-Tabelle
|
||||
return b.Bytes()
|
||||
}
|
||||
|
||||
func main() {
|
||||
ico := flag.String("ico", "assets/icon/sshtermy.ico", "Icon-Datei")
|
||||
out := flag.String("out", "cmd/sshtermy", "Zielordner der .syso-Dateien")
|
||||
flag.Parse()
|
||||
|
||||
imgs, err := readICO(*ico)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
var leaves []leaf
|
||||
grp := new(bytes.Buffer)
|
||||
le := binary.LittleEndian
|
||||
binary.Write(grp, le, [3]uint16{0, 1, uint16(len(imgs))})
|
||||
for i, im := range imgs {
|
||||
id := uint16(i + 1)
|
||||
leaves = append(leaves, leaf{rtIcon, id, im.data})
|
||||
grp.Write([]byte{byte(im.w), byte(im.h), byte(im.colors), 0})
|
||||
binary.Write(grp, le, im.planes)
|
||||
binary.Write(grp, le, im.bits)
|
||||
binary.Write(grp, le, uint32(len(im.data)))
|
||||
binary.Write(grp, le, id)
|
||||
}
|
||||
leaves = append(leaves, leaf{rtGroupIcon, groupID, grp.Bytes()})
|
||||
sect, relocs := buildRsrc(leaves)
|
||||
|
||||
for _, a := range []struct {
|
||||
arch string
|
||||
machine, relType uint16
|
||||
}{
|
||||
{"amd64", 0x8664, 3}, // IMAGE_REL_AMD64_ADDR32NB
|
||||
{"386", 0x14c, 7}, // IMAGE_REL_I386_DIR32NB
|
||||
{"arm64", 0xaa64, 2}, // IMAGE_REL_ARM64_ADDR32NB
|
||||
} {
|
||||
p := filepath.Join(*out, "rsrc_windows_"+a.arch+".syso")
|
||||
if err := os.WriteFile(p, coff(a.machine, a.relType, sect, relocs), 0o644); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Println(p)
|
||||
}
|
||||
}
|
||||