mirror of
https://github.com/D-Modem/bbs.git
synced 2026-11-28 17:38:04 -08:00
What a caller switches on their profile (ANSI, UTF-8, sixel, RIP, a
Commodore's width) is kept with their account as settings (users.prefs,
"key=value" pairs) and applied after the next login: ANSI and UTF-8 as
set, sixel and RIP kept off when turned off and on only where the
terminal has them. An editor setting (full or line) is there for the
full-screen editor.
The API shows them at GET /me and changes them with PATCH /me ("":
forgets one); unknown settings and values are refused.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
36 lines
782 B
Go
36 lines
782 B
Go
package server
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"golang.org/x/crypto/ssh"
|
|
)
|
|
|
|
// TestPrefsKept: what a caller switches on their profile is how the next
|
|
// call begins.
|
|
func TestPrefsKept(t *testing.T) {
|
|
e, addr, _ := startSSH(t, nil)
|
|
call := func() *dialog {
|
|
c, err := sshDial(t, addr, "alice", ssh.Password("alicepass1"))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
d := shell(t, c, "xterm-256color", 100, 40)
|
|
d.expect("Command: ")
|
|
d.send("P")
|
|
return d
|
|
}
|
|
d := call()
|
|
d.expect("Terminal: 100x40, ANSI on, UTF-8 on")
|
|
d.send("8")
|
|
d.expect("Terminal: 100x40, ANSI on, UTF-8 off")
|
|
d.send("Q")
|
|
d.expect("Command: ")
|
|
if u, _ := e.b.Store.UserByName("alice"); u.Prefs != "utf8=off" {
|
|
t.Errorf("kept %q", u.Prefs)
|
|
}
|
|
|
|
d = call()
|
|
d.expect("Terminal: 100x40, ANSI on, UTF-8 off")
|
|
}
|