diff --git a/README.md b/README.md index 3df0582..a466d9b 100644 --- a/README.md +++ b/README.md @@ -223,6 +223,14 @@ or the [Telegram group](https://t.me/+6UwIu9F4gZQxNjM0). - **Scheduled backups** (off until you turn them on): a systemd timer on the server dumps the database by itself (`/matrix/interzone-backups`, keeping the newest N); download them for Restore. + - **Alerts** (off until you turn them on): a systemd timer on the + server checks it every few minutes, even when your computer is off, + for failed `matrix-*` services, the homeserver not answering, a + certificate expiring within 14 days and a disk over 90% full, and + sends a message when that changes (once when something breaks, once + when it's fixed) to an ntfy topic, or as `{"text": …}` to a webhook + such as a Hookshot room, Slack, Discord or Mattermost. Applying sends + a test message. - **Users** (Synapse): totals at the top (people, active in the last 30 days, admins, new, rooms, media), then everyone with how recently they were seen; the one selected opens into a card with when they diff --git a/internal/config/config.go b/internal/config/config.go index 8015ef5..ed20c59 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -90,11 +90,21 @@ type Config struct { PlaybookDir string Backups BackupSchedule + Alerts Alerts // PinnedCommit holds the playbook at this commit after a rollback, until // the next update. PinnedCommit string } +// Alerts configures the checks the server runs on itself, sending a +// message when something breaks and when it's fine again. +type Alerts struct { + Enabled bool + URL string // where messages are POSTed + JSON bool // {"text": …} for webhooks (Hookshot, Slack, Discord), else plain text (ntfy) + Every string // systemd OnCalendar, e.g. "*:0/5" +} + // BackupSchedule configures the database backups the server makes itself. type BackupSchedule struct { Enabled bool diff --git a/internal/deploy/alerts.go b/internal/deploy/alerts.go new file mode 100644 index 0000000..993d3c7 --- /dev/null +++ b/internal/deploy/alerts.go @@ -0,0 +1,212 @@ +package deploy + +import ( + "context" + "encoding/json" + "fmt" + "net/url" + "os" + "path/filepath" +) + +// The server checks itself on a timer, as scheduled backups do, so alerts +// come even when this computer is off: failed matrix-* services, the +// homeserver not answering, a certificate close to expiring, a disk +// nearly full. It sends a message when the set of problems changes, so a +// problem is told once and so is its end. + +const alertsScript = `#!/bin/bash +# Written by interzone: checks this Matrix server and sends a message when +# what's wrong changes. "interzone-alerts test" sends a test message. +set -uo pipefail +. "${IZ_ENV:-/etc/interzone-alerts.env}" +state=${IZ_STATE:-/var/lib/interzone-alerts.state} + +send() { + if [ "$IZ_JSON" = true ]; then + printf '%s' "$1" | python3 -c 'import json, sys; m = sys.stdin.read(); print(json.dumps({"text": m, "body": m, "content": m}))' | + curl -fsS -m 20 -o /dev/null -H 'Content-Type: application/json' --data-binary @- "$IZ_URL" + else + curl -fsS -m 20 -o /dev/null -H "Title: Matrix $IZ_DOMAIN" --data-binary "$1" "$IZ_URL" + fi +} + +if [ "${1:-}" = test ]; then + send "interzone alerts are on for $IZ_DOMAIN: you'll hear here when something breaks, and when it's fixed." + exit +fi + +problems=() +while read -r unit _; do + problems+=("$unit has failed") +done < <(systemctl list-units 'matrix-*.service' --state=failed --no-legend --plain 2>/dev/null) +if ! curl -ksS -m 15 -o /dev/null -f --resolve "$IZ_HOST:$IZ_PORT:127.0.0.1" "$IZ_SCHEME://$IZ_HOST:$IZ_PORT/_matrix/client/versions" 2>/dev/null; then + problems+=("$IZ_SCHEME://$IZ_HOST doesn't answer") +fi +if [ "$IZ_SCHEME" = https ] && command -v openssl >/dev/null; then + if ! openssl s_client -connect 127.0.0.1:443 -servername "$IZ_HOST" /dev/null | openssl x509 -noout -checkend 1209600 >/dev/null 2>&1; then + problems+=("the certificate of $IZ_HOST expires within 14 days, or can't be read") + fi +fi +while read -r use mount; do + if [ "${use%?}" -ge 90 ]; then + problems+=("$mount is $use full") + fi +done < <(df -P / /matrix 2>/dev/null | awk 'NR > 1 && !seen[$6]++ { print $5, $6 }') + +now=$(printf '%s\n' "${problems[@]+"${problems[@]}"}") +before=$(cat "$state" 2>/dev/null || true) +[ "$now" = "$before" ] && exit 0 +if [ -z "$now" ]; then + send "✓ $IZ_DOMAIN: everything is fine again." || exit 1 +else + msg="✗ $IZ_DOMAIN:" + for p in "${problems[@]}"; do msg+=$'\n'"• $p"; done + send "$msg" || exit 1 +fi +printf '%s' "$now" > "$state" +` + +const alertsPlay = `- name: Set up alerts + hosts: matrix_servers + become: true + gather_facts: false + tasks: + - name: Check the schedule + ansible.builtin.command: + argv: [systemd-analyze, calendar, "{{ interzone_every }}"] + changed_when: false + when: interzone_enabled | bool + + - name: Install curl and openssl + ansible.builtin.package: + name: [curl, openssl] + state: present + when: interzone_enabled | bool + + - name: Write the settings + ansible.builtin.copy: + dest: /etc/interzone-alerts.env + mode: "0600" + content: | + IZ_DOMAIN={{ interzone_domain | quote }} + IZ_HOST={{ interzone_host | quote }} + IZ_SCHEME={{ interzone_scheme | quote }} + IZ_PORT={{ interzone_port | quote }} + IZ_URL={{ interzone_url | quote }} + IZ_JSON={{ interzone_json | bool | lower }} + no_log: true + when: interzone_enabled | bool + + - name: Install the check + ansible.builtin.copy: + dest: /usr/local/bin/interzone-alerts + mode: "0755" + content: "{{ interzone_script }}" + when: interzone_enabled | bool + + - name: Install the service and timer + ansible.builtin.copy: + dest: "/etc/systemd/system/{{ item.name }}" + mode: "0644" + content: "{{ item.content }}" + loop: + - name: interzone-alerts.service + content: | + [Unit] + Description=Check the Matrix server and send alerts (interzone) + + [Service] + Type=oneshot + ExecStart=/usr/local/bin/interzone-alerts + - name: interzone-alerts.timer + content: | + [Unit] + Description=Check the Matrix server (interzone) + + [Timer] + OnCalendar={{ interzone_every }} + Persistent=true + + [Install] + WantedBy=timers.target + loop_control: + label: "{{ item.name }}" + when: interzone_enabled | bool + + - name: Send a test message + ansible.builtin.command: /usr/local/bin/interzone-alerts test + changed_when: false + when: interzone_enabled | bool + + - name: Start the timer + ansible.builtin.systemd: + name: interzone-alerts.timer + enabled: true + state: restarted + daemon_reload: true + when: interzone_enabled | bool + + - name: Stop the timer + ansible.builtin.systemd: + name: interzone-alerts.timer + enabled: false + state: stopped + failed_when: false + when: not interzone_enabled | bool + + - name: Remove the timer, service and check + ansible.builtin.file: + path: "{{ item }}" + state: absent + loop: + - /etc/systemd/system/interzone-alerts.timer + - /etc/systemd/system/interzone-alerts.service + - /usr/local/bin/interzone-alerts + - /etc/interzone-alerts.env + - /var/lib/interzone-alerts.state + when: not interzone_enabled | bool +` + +// AlertsURLProblem says what's wrong with an alerts URL, or "". +func AlertsURLProblem(u string) string { + p, err := url.Parse(u) + if err != nil || (p.Scheme != "https" && p.Scheme != "http") || p.Host == "" { + return "The alerts address must be an http(s):// URL, e.g. https://ntfy.sh/a-long-random-topic." + } + return "" +} + +func (r *Runner) alerts(ctx context.Context) error { + r.begin(StepAlerts) + a := r.cfg.Alerts + if a.Enabled { + if !calendarSafe.MatchString(a.Every) { + return fmt.Errorf("%q isn't a schedule systemd understands (try *:0/5 for every 5 minutes)", a.Every) + } + if p := AlertsURLProblem(a.URL); p != "" { + return fmt.Errorf("%s", p) + } + } + scheme, port := "https", "443" + if r.cfg.SSL.Mode == "none" { + scheme, port = "http", "80" + } + // The URL may hold a secret topic or token, so it goes in a file, not + // on the command line. + vars, _ := json.Marshal(map[string]any{"interzone_enabled": a.Enabled, "interzone_every": a.Every, + "interzone_url": a.URL, "interzone_json": a.JSON, "interzone_domain": r.cfg.Domain, + "interzone_host": r.cfg.HostName(), "interzone_scheme": scheme, "interzone_port": port, + "interzone_script": alertsScript}) + dir := filepath.Join(r.cfg.PlaybookDir, "inventory") + varsFile := filepath.Join(dir, "interzone-alerts-vars.json") + if err := os.WriteFile(varsFile, vars, 0o600); err != nil { + return err + } + defer os.Remove(varsFile) + play := filepath.Join(dir, "interzone-alerts.yml") + if err := os.WriteFile(play, []byte(alertsPlay), 0o644); err != nil { + return err + } + return r.exec(ctx, StepAlerts, r.cfg.PlaybookDir, "ansible-playbook", "-i", "inventory/hosts", play, "-e", "@"+varsFile) +} diff --git a/internal/deploy/alerts_test.go b/internal/deploy/alerts_test.go new file mode 100644 index 0000000..8990e94 --- /dev/null +++ b/internal/deploy/alerts_test.go @@ -0,0 +1,70 @@ +package deploy + +import ( + "os" + "os/exec" + "path/filepath" + "strings" + "testing" +) + +// The alert script sends once when problems appear, nothing while they +// stay the same, and once when they're gone. +func TestAlertsScript(t *testing.T) { + if strings.Contains(alertsScript, "{{") || strings.Contains(alertsScript, "{%") || strings.Contains(alertsScript, "{#") { + t.Fatal("the script has Jinja markers Ansible would template") + } + for _, bin := range []string{"bash", "python3"} { + if _, err := exec.LookPath(bin); err != nil { + t.Skip(bin + " isn't installed") + } + } + dir := t.TempDir() + stub := func(name, body string) { + if err := os.WriteFile(filepath.Join(dir, "bin", name), []byte("#!/bin/bash\n"+body), 0o755); err != nil { + t.Fatal(err) + } + } + _ = os.MkdirAll(filepath.Join(dir, "bin"), 0o755) + sent := filepath.Join(dir, "sent") + stub("systemctl", `[ -f "$IZ_DIR/failing" ] && echo "matrix-synapse.service loaded failed failed Synapse"; true`) + stub("df", `echo "Filesystem 1024-blocks Used Available Capacity Mounted"; echo "/dev/sda 100 50 50 50% /"`) + stub("curl", `for a; do [ "$a" = --resolve ] && { [ -f "$IZ_DIR/failing" ] && exit 22; exit 0; }; done +for a; do [ "$a" = @- ] && { cat >> "$IZ_DIR/sent"; echo >> "$IZ_DIR/sent"; exit 0; }; done +printf '%s\n' "${@: -2:1}" >> "$IZ_DIR/sent"`) + env := filepath.Join(dir, "env") + _ = os.WriteFile(env, []byte("IZ_DOMAIN=example.org\nIZ_HOST=matrix.example.org\nIZ_SCHEME=http\nIZ_PORT=80\nIZ_URL=https://ntfy.example/t\nIZ_JSON=false\n"), 0o600) + script := filepath.Join(dir, "interzone-alerts") + _ = os.WriteFile(script, []byte(alertsScript), 0o755) + + run := func(args ...string) string { + cmd := exec.Command("bash", append([]string{script}, args...)...) + cmd.Env = append(os.Environ(), "PATH="+filepath.Join(dir, "bin")+":"+os.Getenv("PATH"), "IZ_DIR="+dir, + "IZ_ENV="+env, "IZ_STATE="+filepath.Join(dir, "state")) + if out, err := cmd.CombinedOutput(); err != nil { + t.Fatalf("%v: %s", err, out) + } + b, _ := os.ReadFile(sent) + _ = os.Remove(sent) + return string(b) + } + if got := run(); got != "" { + t.Errorf("all fine at first, yet sent %q", got) + } + _ = os.WriteFile(filepath.Join(dir, "failing"), nil, 0o644) + got := run() + if !strings.Contains(got, "matrix-synapse.service has failed") || !strings.Contains(got, "http://matrix.example.org doesn't answer") { + t.Errorf("problems sent as %q", got) + } + if got := run(); got != "" { + t.Errorf("the same problems were sent again: %q", got) + } + _ = os.Remove(filepath.Join(dir, "failing")) + if got := run(); !strings.Contains(got, "fine again") { + t.Errorf("recovery sent as %q", got) + } + _ = os.WriteFile(env, []byte("IZ_DOMAIN=example.org\nIZ_HOST=matrix.example.org\nIZ_SCHEME=http\nIZ_PORT=80\nIZ_URL=https://hook.example/x\nIZ_JSON=true\n"), 0o600) + if got := run("test"); !strings.Contains(got, `"text": "interzone alerts are on for example.org`) { + t.Errorf("JSON test message sent as %q", got) + } +} diff --git a/internal/deploy/deploy.go b/internal/deploy/deploy.go index e9d0df2..9802294 100644 --- a/internal/deploy/deploy.go +++ b/internal/deploy/deploy.go @@ -49,6 +49,7 @@ const ( StepTags StepUninstall StepDisk + StepAlerts ) var stepNames = map[Step]string{ @@ -76,6 +77,7 @@ var stepNames = map[Step]string{ StepTags: "Run the playbook", StepUninstall: "Remove everything", StepDisk: "Measure the disk", + StepAlerts: "Set up alerts", } func (s Step) String() string { return stepNames[s] } @@ -102,6 +104,7 @@ const ( ActionTags // run Options.Tags (docs/playbook-tags.md) ActionUninstall // the playbook's remove-all (docs/uninstalling.md) ActionDisk // what takes the server's disk space + ActionAlerts // the server's own checks and alerts (Config.Alerts) ) // Plan lists the steps an action runs, in order. @@ -139,6 +142,8 @@ func Plan(a Action) []Step { return []Step{StepAnsible, StepInventory, StepUninstall} case ActionDisk: return []Step{StepAnsible, StepInventory, StepDisk} + case ActionAlerts: + return []Step{StepAnsible, StepInventory, StepAlerts} case ActionMigrate: return []Step{StepAnsible, StepPlaybook, StepInventory, StepRoles, StepStopOld, StepCopyData, StepMirrors, StepInstall, StepSelfCheck} } @@ -311,6 +316,7 @@ func (r *Runner) run(ctx context.Context) error { StepTags: r.tags, StepUninstall: r.uninstall, StepDisk: r.disk, + StepAlerts: r.alerts, } plan := Plan(r.opts.Action) r.emit(Event{Plan: plan}) diff --git a/internal/ui/alerts.go b/internal/ui/alerts.go new file mode 100644 index 0000000..de255f3 --- /dev/null +++ b/internal/ui/alerts.go @@ -0,0 +1,96 @@ +package ui + +import ( + "strings" + + tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/lipgloss" + + "interzone/internal/config" + "interzone/internal/deploy" +) + +// ── Alerts ───────────────────────────────────────────────────────── +// +// The server checks itself on a timer and sends a message to ntfy or a +// webhook when something breaks and when it's fixed (deploy/alerts.go). + +type alertsScreen struct { + cfg *config.Config + form *form + err string +} + +func newAlertsScreen() *alertsScreen { return &alertsScreen{} } + +func (s *alertsScreen) tool() {} +func (s *alertsScreen) name() string { return "Alerts" } +func (s *alertsScreen) title() string { return "Alerts" } +func (s *alertsScreen) typing() bool { return s.form.typing() } +func (s *alertsScreen) leave(*config.Config) {} +func (s *alertsScreen) activeForm() *form { return s.form } +func (s *alertsScreen) keys() [][2]string { + return [][2]string{{"↑↓", "move"}, {"space", "toggle"}, {"enter", "apply on the server"}} +} + +func (s *alertsScreen) enter(c *config.Config) tea.Cmd { + s.cfg, s.err = c, "" + a := c.Alerts + if a.Every == "" { + a.Every = "*:0/5" + } + example := "https://ntfy.sh/a-long-random-topic" + if c.Components["ntfy"] { + example = "https://ntfy." + c.Domain + "/a-long-random-topic" + } + format := "text" + if a.JSON { + format = "json" + } + s.form = newForm( + toggleField("on", "Send alerts", a.Enabled, + "The server checks itself, even when this computer is off: failed services, the homeserver not answering, a certificate expiring within 14 days, a disk over 90% full."), + textField("url", "Send them to", a.URL, example, + "An ntfy topic (subscribe to it in the ntfy app), or a webhook: a Hookshot room webhook, Slack, Discord or Mattermost. Anyone who knows an ntfy topic can read it, so make it long and random."), + choiceField("format", "Message format", []string{"text", "json"}, + []string{"Plain text (ntfy)", `JSON {"text": …} (webhooks)`}, format, ""), + textField("every", "Check", a.Every, "*:0/5", "A systemd calendar time: *:0/5 is every 5 minutes, hourly, daily …"), + ) + off := func() bool { return !s.form.get("on").on } + s.form.get("url").hidden, s.form.get("format").hidden, s.form.get("every").hidden = off, off, off + return nil +} + +func (s *alertsScreen) update(msg tea.Msg) tea.Cmd { + if _, ok := msg.(formDoneMsg); ok { + return s.apply() + } + if _, ok := msg.(tea.KeyMsg); ok { + s.err = "" + } + return s.form.Update(msg) +} + +func (s *alertsScreen) apply() tea.Cmd { + a := config.Alerts{Enabled: s.form.get("on").on, URL: strings.TrimSpace(s.form.value("url")), + JSON: s.form.value("format") == "json", Every: strings.TrimSpace(s.form.value("every"))} + if a.Enabled { + if p := deploy.AlertsURLProblem(a.URL); p != "" { + s.err = p + return nil + } + } + s.cfg.Alerts = a + _ = s.cfg.Save() + return run(deploy.Options{Action: deploy.ActionAlerts}) +} + +func (s *alertsScreen) view(w, h int) string { + info := sSub.Render("A message is sent when what's wrong changes: once when something breaks, once when it's fixed. Applying sends a test message first.") + panel := sPanel.Padding(0, 2).Width(min(w, maxFormWidth) - 2).Render(info) + out := s.form.View(w, h-lipgloss.Height(panel)-3) + "\n\n" + panel + if s.err != "" { + out += "\n" + sBad.Render("✗ "+s.err) + } + return out +} diff --git a/internal/ui/alerts_test.go b/internal/ui/alerts_test.go new file mode 100644 index 0000000..ae76d67 --- /dev/null +++ b/internal/ui/alerts_test.go @@ -0,0 +1,28 @@ +package ui + +import ( + "testing" + + "interzone/internal/config" +) + +func TestAlerts(t *testing.T) { + a := demoApp(t, 120, 36) + a.jump(a.index("Alerts")) + s, ok := a.cur().(*alertsScreen) + if !ok { + t.Fatalf("on %s", a.cur().name()) + } + s.form.get("on").on = true + s.form.get("url").input.SetValue("ntfy.sh/topic") + deliver(a, formDoneMsg{}) + if s.err == "" || a.cfg.Alerts.Enabled { + t.Errorf("a URL without https:// was taken") + } + s.form.get("url").input.SetValue("https://ntfy.sh/a-long-random-topic") + deliver(a, formDoneMsg{}) + want := config.Alerts{Enabled: true, URL: "https://ntfy.sh/a-long-random-topic", Every: "*:0/5"} + if a.cfg.Alerts != want { + t.Errorf("saved %+v", a.cfg.Alerts) + } +} diff --git a/internal/ui/app.go b/internal/ui/app.go index 5f30115..8d6b556 100644 --- a/internal/ui/app.go +++ b/internal/ui/app.go @@ -88,6 +88,7 @@ func New(cfg *config.Config, loaded bool) *App { newHistoryScreen(), newRestoreScreen(), newBackupsScreen(), + newAlertsScreen(), newUsersScreen(), newTokensScreen(), newDashboardScreen(), diff --git a/internal/ui/screens_deploy.go b/internal/ui/screens_deploy.go index ebbb514..337d4f1 100644 --- a/internal/ui/screens_deploy.go +++ b/internal/ui/screens_deploy.go @@ -523,6 +523,7 @@ var actionTitles = map[deploy.Action][3]string{ // running, done, failed deploy.ActionMigrate: {"Moving the server…", "Moved to the new server ✨", "The move stopped"}, deploy.ActionUninstall: {"Removing everything…", "Everything was removed", "The removal stopped"}, deploy.ActionDisk: {"Measuring the disk…", "Disk usage", "Couldn't measure the disk"}, + deploy.ActionAlerts: {"Setting up alerts…", "Alerts set", "Couldn't set up alerts"}, } func (s *deployScreen) name() string { return "Deploy" } @@ -920,6 +921,12 @@ func (s *deployScreen) resultView(w int) string { return panel(cMint, sGood.Render("✓ The server backs up its database ")+sTitle.Render(c.Backups.When)+ sGood.Render(fmt.Sprintf(", keeping %d.", c.Backups.Keep)), sMuted.Render("Dumps go to "+deploy.ServerBackupDir+"; download them from Manage › Restore with d.")) + case deploy.ActionAlerts: + if !c.Alerts.Enabled { + return panel(cMint, sGood.Render("✓ Alerts are off; the server no longer checks itself.")) + } + return panel(cMint, sGood.Render("✓ The server checks itself ")+sTitle.Render(c.Alerts.Every)+sGood.Render(" and a test message was sent."), + sMuted.Render("If it didn't arrive, check the address on Manage › Alerts.")) case deploy.ActionFetchBackups: n := len(deploy.ListBackups(c.Domain)) return panel(cMint, sGood.Render("✓ The server's backups are in ")+sTitle.Render(res.File), diff --git a/internal/ui/screens_manage.go b/internal/ui/screens_manage.go index 1a846c3..c92f970 100644 --- a/internal/ui/screens_manage.go +++ b/internal/ui/screens_manage.go @@ -50,7 +50,7 @@ type manageAction struct { var manageGroups = []string{"Keep it running", "People", "Data", "Look closer", "Change things"} var actionGroup = map[string]int{ - "update": 0, "check": 0, "restart": 0, "services": 0, "changes": 0, "images": 0, "selfupdate": 0, + "update": 0, "check": 0, "alerts": 0, "restart": 0, "services": 0, "changes": 0, "images": 0, "selfupdate": 0, "user": 1, "registration": 1, "users": 1, "tokens": 1, "backup": 2, "schedule": 2, "restore": 2, "rollback": 2, "disk": 2, "vacuum": 2, "pgupgrade": 2, "compress": 2, "dashboard": 3, "logs": 3, "tuning": 3, "psql": 3, "tags": 3, @@ -58,7 +58,7 @@ var actionGroup = map[string]int{ } var actionIcons = map[string]string{ - "update": "↻", "check": "✓", "restart": "↯", "changes": "±", "images": "▣", "selfupdate": "⇪", + "update": "↻", "check": "✓", "alerts": "⚑", "restart": "↯", "changes": "±", "images": "▣", "selfupdate": "⇪", "user": "+", "registration": "⊕", "users": "@", "tokens": "⚿", "backup": "⇩", "schedule": "◷", "restore": "↺", "rollback": "↶", "dashboard": "▦", "logs": "≡", "tuning": "✎", @@ -198,6 +198,8 @@ func (s *manageScreen) actions() []manageAction { desc: "Copy everything in /matrix to a new machine and install there; the old one is stopped."}, manageAction{id: "servers", title: "Other servers", desc: "Switch between the servers interzone manages, or add another."}, + manageAction{id: "alerts", title: "Alerts", + desc: "Have the server tell you, through ntfy or a webhook, when a service fails, it stops answering, its certificate is about to expire or its disk fills up."}, manageAction{id: "services", title: "Start, stop or reinstall services", desc: "Every service or one group of them. Reinstalling everything also removes the components you've turned off."}, manageAction{id: "disk", title: "Disk space", @@ -361,8 +363,8 @@ func (s *manageScreen) choose(id string) tea.Cmd { return run(deploy.Options{Action: deploy.ActionImages}) case "selfupdate": return run(deploy.Options{Action: deploy.ActionSelfUpdate}) - case "users", "tokens", "dashboard", "changes", "schedule", "restore", "rollback", "tuning", "servers", "migrate": - screen := map[string]string{"users": "Users", "tokens": "Tokens", "dashboard": "Dashboard", "changes": "Updates", "schedule": "Backups", + case "users", "tokens", "dashboard", "changes", "schedule", "restore", "rollback", "tuning", "servers", "migrate", "alerts": + screen := map[string]string{"alerts": "Alerts", "users": "Users", "tokens": "Tokens", "dashboard": "Dashboard", "changes": "Updates", "schedule": "Backups", "restore": "Restore", "rollback": "Rollback", "tuning": "Tuning", "servers": "Servers", "migrate": "Move"}[id] return func() tea.Msg { return gotoMsg(screen) } case "psql": diff --git a/internal/ui/sidebar.go b/internal/ui/sidebar.go index 87fa880..bdcf50c 100644 --- a/internal/ui/sidebar.go +++ b/internal/ui/sidebar.go @@ -92,6 +92,7 @@ var manageMenu = []struct{ screen, label, icon string }{ {"Dashboard", "Dashboard", "▦"}, {"Updates", "Updates", "↻"}, {"Backups", "Backups", "◷"}, + {"Alerts", "Alerts", "⚑"}, {"Restore", "Restore", "↺"}, {"Rollback", "Rollback", "↶"}, {"Tuning", "Fine-tune", "✎"}, diff --git a/internal/ui/testdata/layout/dashboard-120x36.txt b/internal/ui/testdata/layout/dashboard-120x36.txt index a780e48..3337ab2 100644 --- a/internal/ui/testdata/layout/dashboard-120x36.txt +++ b/internal/ui/testdata/layout/dashboard-120x36.txt @@ -8,18 +8,18 @@ │ ▌ ▦ Dashboard ││ ● live · every 5s · last at 00:00:00 │ │ ↻ Updates ││ ╭────────────────────────────────────────╮ ╭─────────────────────────────────────────╮ │ │ ◷ Backups ││ │ CPU │ │ Memory │ │ -│ ↺ Restore ││ │ 30% load 1.20 on 4 cores │ │ 62% 5.0 GB of 8.0 GB │ │ -│ ↶ Rollback ││ │ ███████████░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ │ ████████████████████████░░░░░░░░░░░░░░░ │ │ -│ ✎ Fine-tune ││ ╰────────────────────────────────────────╯ ╰─────────────────────────────────────────╯ │ -│ ⚒ Maintenance ││ ╭────────────────────────────────────────╮ ╭─────────────────────────────────────────╮ │ -│ ⇢ Move server ││ │ Disk / │ │ Containers │ │ -│ ▤ Servers ││ │ 78% 18.0 GB free │ │ 3/4 1 stopped, 1 unhealthy │ │ -│ ││ │ █████████████████████████████░░░░░░░░░ │ │ ████████████████████░░░░░░░░░░░░░░░░░░░ │ │ -│ ▸ Mirrors ││ ╰────────────────────────────────────────╯ ╰─────────────────────────────────────────╯ │ -│ ││ ╭────────────────────────────────────────────────────────────────────────────────────╮ │ -│ ▾ Servers ││ │ System │ │ -│ ● example.org ││ │ Load 1.20 0.90 0.70 1, 5, 15 min │ │ -│ ││ │ Memory ███████████████░░░░░░░░░ 5.0 GB / 8.0 GB │ │ +│ ⚑ Alerts ││ │ 30% load 1.20 on 4 cores │ │ 62% 5.0 GB of 8.0 GB │ │ +│ ↺ Restore ││ │ ███████████░░░░░░░░░░░░░░░░░░░░░░░░░░░ │ │ ████████████████████████░░░░░░░░░░░░░░░ │ │ +│ ↶ Rollback ││ ╰────────────────────────────────────────╯ ╰─────────────────────────────────────────╯ │ +│ ✎ Fine-tune ││ ╭────────────────────────────────────────╮ ╭─────────────────────────────────────────╮ │ +│ ⚒ Maintenance ││ │ Disk / │ │ Containers │ │ +│ ⇢ Move server ││ │ 78% 18.0 GB free │ │ 3/4 1 stopped, 1 unhealthy │ │ +│ ▤ Servers ││ │ █████████████████████████████░░░░░░░░░ │ │ ████████████████████░░░░░░░░░░░░░░░░░░░ │ │ +│ ││ ╰────────────────────────────────────────╯ ╰─────────────────────────────────────────╯ │ +│ ▸ Mirrors ││ ╭────────────────────────────────────────────────────────────────────────────────────╮ │ +│ ││ │ System │ │ +│ ▾ Servers ││ │ Load 1.20 0.90 0.70 1, 5, 15 min │ │ +│ ● example.org ││ │ Memory ███████████████░░░░░░░░░ 5.0 GB / 8.0 GB │ │ │ ││ │ Swap ████████████░░░░░░░░░░░░ 1.0 GB / 2.0 GB │ │ │ ││ │ Disk / ███████████████████░░░░░ 18.0 GB free / 80.0 GB │ │ │ ││ │ Next backup Tue 0000-00-00 00:00:00 UTC │ │ diff --git a/internal/ui/testdata/layout/dashboard-180x50.txt b/internal/ui/testdata/layout/dashboard-180x50.txt index 2386ff8..7a9d059 100644 --- a/internal/ui/testdata/layout/dashboard-180x50.txt +++ b/internal/ui/testdata/layout/dashboard-180x50.txt @@ -8,18 +8,18 @@ │ ▌ ▦ Dashboard ││ ╭─────────────────────────────────╮ ╭─────────────────────────────────╮ ╭─────────────────────────────────╮ ╭────────────────────────────────────╮ │ │ ↻ Updates ││ │ CPU │ │ Memory │ │ Disk / │ │ Containers │ │ │ ◷ Backups ││ │ 30% load 1.20 on 4 cores │ │ 62% 5.0 GB of 8.0 GB │ │ 78% 18.0 GB free │ │ 3/4 1 stopped, 1 unhealthy │ │ -│ ↺ Restore ││ │ █████████░░░░░░░░░░░░░░░░░░░░░░ │ │ ███████████████████░░░░░░░░░░░░ │ │ ████████████████████████░░░░░░░ │ │ █████████████████░░░░░░░░░░░░░░░░░ │ │ -│ ↶ Rollback ││ ╰─────────────────────────────────╯ ╰─────────────────────────────────╯ ╰─────────────────────────────────╯ ╰────────────────────────────────────╯ │ -│ ✎ Fine-tune ││ ╭──────────────────────────────────────────────────────────────────────╮ ╭───────────────────────────────────────────────────────────────────────╮ │ -│ ⚒ Maintenance ││ │ System │ │ Heaviest containers use 5% of 4 cores │ │ -│ ⇢ Move server ││ │ Load 1.20 0.90 0.70 1, 5, 15 min │ │ mem cpu │ │ -│ ▤ Servers ││ │ Memory ███████████████░░░░░░░░░ 5.0 GB / 8.0 GB │ │ synapse ██████████████ 7.6% 4.10% │ │ -│ ││ │ Swap ████████████░░░░░░░░░░░░ 1.0 GB / 2.0 GB │ │ postgres █████░░░░░░░░░ 2.7% 0.80% │ │ -│ ▸ Mirrors ││ │ Disk / ███████████████████░░░░░ 18.0 GB free / 80.0 GB │ │ traefik █░░░░░░░░░░░░░ 0.7% 0.20% │ │ -│ ││ │ Next backup Tue 0000-00-00 00:00:00 UTC │ │ │ │ -│ ▾ Servers ││ ╰──────────────────────────────────────────────────────────────────────╯ ╰───────────────────────────────────────────────────────────────────────╯ │ -│ ● example.org ││ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ -│ ││ │ Certificates │ │ +│ ⚑ Alerts ││ │ █████████░░░░░░░░░░░░░░░░░░░░░░ │ │ ███████████████████░░░░░░░░░░░░ │ │ ████████████████████████░░░░░░░ │ │ █████████████████░░░░░░░░░░░░░░░░░ │ │ +│ ↺ Restore ││ ╰─────────────────────────────────╯ ╰─────────────────────────────────╯ ╰─────────────────────────────────╯ ╰────────────────────────────────────╯ │ +│ ↶ Rollback ││ ╭──────────────────────────────────────────────────────────────────────╮ ╭───────────────────────────────────────────────────────────────────────╮ │ +│ ✎ Fine-tune ││ │ System │ │ Heaviest containers use 5% of 4 cores │ │ +│ ⚒ Maintenance ││ │ Load 1.20 0.90 0.70 1, 5, 15 min │ │ mem cpu │ │ +│ ⇢ Move server ││ │ Memory ███████████████░░░░░░░░░ 5.0 GB / 8.0 GB │ │ synapse ██████████████ 7.6% 4.10% │ │ +│ ▤ Servers ││ │ Swap ████████████░░░░░░░░░░░░ 1.0 GB / 2.0 GB │ │ postgres █████░░░░░░░░░ 2.7% 0.80% │ │ +│ ││ │ Disk / ███████████████████░░░░░ 18.0 GB free / 80.0 GB │ │ traefik █░░░░░░░░░░░░░ 0.7% 0.20% │ │ +│ ▸ Mirrors ││ │ Next backup Tue 0000-00-00 00:00:00 UTC │ │ │ │ +│ ││ ╰──────────────────────────────────────────────────────────────────────╯ ╰───────────────────────────────────────────────────────────────────────╯ │ +│ ▾ Servers ││ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ +│ ● example.org ││ │ Certificates │ │ │ ││ │ ✓ Synapse matrix.example.org 60 days until 0000-00-00 · R11 │ │ │ ││ │ ! Element Web element.example.org 12 days until 0000-00-00 · R11 │ │ │ ││ │ ✗ Cinny chat.other.net connection refused │ │ diff --git a/internal/ui/testdata/layout/maintenance-120x36.txt b/internal/ui/testdata/layout/maintenance-120x36.txt index f42e903..1b35ba4 100644 --- a/internal/ui/testdata/layout/maintenance-120x36.txt +++ b/internal/ui/testdata/layout/maintenance-120x36.txt @@ -8,11 +8,12 @@ │ ▦ Dashboard ││ ▌ Uninstall │ │ ↻ Updates ││ ▌ Give the disk space of deleted rows back (Postgres VACUUM). Do it after deleting │ │ ◷ Backups ││ ▌ a lot, e.g. after compressing Synapse's state. │ -│ ↺ Restore ││ │ -│ ↶ Rollback ││ Kind of vacuum │ -│ ✎ Fine-tune ││ Complete (FULL, ANALYZE; services stop) Full (services stop) │ -│ ▌ ⚒ Maintenance ││ Plain (services keep running) Plain + ANALYZE (services keep running) │ -│ ⇢ Move server ││ ANALYZE only (fastest) │ +│ ⚑ Alerts ││ │ +│ ↺ Restore ││ Kind of vacuum │ +│ ↶ Rollback ││ Complete (FULL, ANALYZE; services stop) Full (services stop) │ +│ ✎ Fine-tune ││ Plain (services keep running) Plain + ANALYZE (services keep running) │ +│ ▌ ⚒ Maintenance ││ ANALYZE only (fastest) │ +│ ⇢ Move server ││ │ │ ▤ Servers ││ │ │ ││ │ │ ▸ Mirrors ││ │ @@ -28,7 +29,6 @@ │ ││ │ │ ││ │ │ ││ │ -│ ││ │ │ ◫ auto (wide) ctrl+l ││ │ │ ◐ interzone ctrl+y ││ │ │ ◂ fold ctrl+b menu ││ │ diff --git a/internal/ui/testdata/layout/manage-120x36.txt b/internal/ui/testdata/layout/manage-120x36.txt index 56eb9e6..f263633 100644 --- a/internal/ui/testdata/layout/manage-120x36.txt +++ b/internal/ui/testdata/layout/manage-120x36.txt @@ -8,11 +8,12 @@ │ ▦ Dashboard ││ │ ↻ Update the server u │ │ │ ↻ Updates ││ │ Pull the latest playbook and roles, then re-run the install with your saved │ │ │ ◷ Backups ││ │ answers. Also applies any changes you made in the setup. │ │ -│ ↺ Restore ││ ╰────────────────────────────────────────────────────────────────────────────────────╯ │ -│ ↶ Rollback ││ ✓ Check services c │ -│ ✎ Fine-tune ││ ↯ Restart all services r │ -│ ⚒ Maintenance ││ ± See what an update brings n │ -│ ⇢ Move server ││ ▣ Check container images i │ +│ ⚑ Alerts ││ ╰────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ↺ Restore ││ ✓ Check services c │ +│ ↶ Rollback ││ ↯ Restart all services r │ +│ ✎ Fine-tune ││ ± See what an update brings n │ +│ ⚒ Maintenance ││ ▣ Check container images i │ +│ ⇢ Move server ││ ⚑ Alerts │ │ ▤ Servers ││ ⏻ Start, stop or reinstall services p │ │ ││ ⇪ Update interzone │ │ ▸ Mirrors ││ │ @@ -28,8 +29,7 @@ │ ││ ◔ Disk space │ │ ││ ⌫ Vacuum the database │ │ ││ ⇡ Upgrade Postgres │ -│ ││ ⇲ Compress Synapse's state │ -│ ◫ auto (wide) ctrl+l ││ │ +│ ◫ auto (wide) ctrl+l ││ ⇲ Compress Synapse's state │ │ ◐ interzone ctrl+y ││ ▼ more below │ │ ◂ fold ctrl+b menu ││ │ ╰────────────────────────╯╰────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/internal/ui/testdata/layout/manage-46x40.txt b/internal/ui/testdata/layout/manage-46x40.txt index 849da73..c3d0373 100644 --- a/internal/ui/testdata/layout/manage-46x40.txt +++ b/internal/ui/testdata/layout/manage-46x40.txt @@ -13,6 +13,7 @@ ↯ Restart all services r ± See what an update brings n ▣ Check container images i + ⚑ Alerts ⏻ Start, stop or reinstall servic… p ⇪ Update interzone @@ -35,6 +36,5 @@ ≡ View logs l ✎ Fine-tune the roles f $ Database shell - # Run playbook tags x ▼ more below ‹ back ≡ menu run › ⋯ \ No newline at end of file diff --git a/internal/ui/testdata/layout/manage-48x20.txt b/internal/ui/testdata/layout/manage-48x20.txt index ea98f16..cd1a196 100644 --- a/internal/ui/testdata/layout/manage-48x20.txt +++ b/internal/ui/testdata/layout/manage-48x20.txt @@ -9,12 +9,12 @@ ↯ Restart all services r ± See what an update brings n ▣ Check container images i + ⚑ Alerts ⏻ Start, stop or reinstall services p ⇪ Update interzone People ─────────────────────────────────────── + Add a user a @ Manage users m Data ───────────────────────────────────────── - ⇩ Back up the database b ▼ more below ‹ back ≡ menu run › ⋯ \ No newline at end of file diff --git a/internal/ui/testdata/layout/manage-armed-120x36.txt b/internal/ui/testdata/layout/manage-armed-120x36.txt index 9c27f66..468d473 100644 --- a/internal/ui/testdata/layout/manage-armed-120x36.txt +++ b/internal/ui/testdata/layout/manage-armed-120x36.txt @@ -8,10 +8,11 @@ │ ▦ Dashboard ││ ✓ Check services c │ │ ↻ Updates ││ ╭────────────────────────────────────────────────────────────────────────────────────╮ │ │ ◷ Backups ││ │ ↯ Restart all services r │ │ -│ ↺ Restore ││ │ press r again to run │ │ -│ ↶ Rollback ││ ╰────────────────────────────────────────────────────────────────────────────────────╯ │ -│ ✎ Fine-tune ││ ± See what an update brings n │ -│ ⚒ Maintenance ││ ▣ Check container images i │ +│ ⚑ Alerts ││ │ press r again to run │ │ +│ ↺ Restore ││ ╰────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ↶ Rollback ││ ± See what an update brings n │ +│ ✎ Fine-tune ││ ▣ Check container images i │ +│ ⚒ Maintenance ││ ⚑ Alerts │ │ ⇢ Move server ││ ⏻ Start, stop or reinstall services p │ │ ▤ Servers ││ ⇪ Update interzone │ │ ││ │ @@ -28,8 +29,7 @@ │ ││ ⌫ Vacuum the database │ │ ││ ⇡ Upgrade Postgres │ │ ││ ⇲ Compress Synapse's state │ -│ ││ │ -│ ◫ auto (wide) ctrl+l ││ Look closer ────────────────────────────────────────────────────────────────────────── │ +│ ◫ auto (wide) ctrl+l ││ │ │ ◐ interzone ctrl+y ││ ▼ more below │ │ ◂ fold ctrl+b menu ││ │ ╰────────────────────────╯╰────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/internal/ui/testdata/layout/manage-armed-46x40.txt b/internal/ui/testdata/layout/manage-armed-46x40.txt index 2102b3c..8c93267 100644 --- a/internal/ui/testdata/layout/manage-armed-46x40.txt +++ b/internal/ui/testdata/layout/manage-armed-46x40.txt @@ -10,6 +10,7 @@ ╰──────────────────────────────────────────╯ ± See what an update brings n ▣ Check container images i + ⚑ Alerts ⏻ Start, stop or reinstall servic… p ⇪ Update interzone @@ -35,6 +36,5 @@ # Run playbook tags x Change things ────────────────────────────── - ◇ Change the setup w ▼ more below ‹ back ≡ menu run › ⋯ \ No newline at end of file diff --git a/internal/ui/testdata/layout/manage-armed-48x20.txt b/internal/ui/testdata/layout/manage-armed-48x20.txt index d1563b5..802c353 100644 --- a/internal/ui/testdata/layout/manage-armed-48x20.txt +++ b/internal/ui/testdata/layout/manage-armed-48x20.txt @@ -9,12 +9,12 @@ ╰────────────────────────────────────────────╯ ± See what an update brings n ▣ Check container images i + ⚑ Alerts ⏻ Start, stop or reinstall services p ⇪ Update interzone People ─────────────────────────────────────── + Add a user a @ Manage users m Data ───────────────────────────────────────── - ⇩ Back up the database b ▼ more below ‹ back ≡ menu run › ⋯ \ No newline at end of file diff --git a/internal/ui/testdata/layout/menu-120x36.txt b/internal/ui/testdata/layout/menu-120x36.txt index e0cba65..eda1032 100644 --- a/internal/ui/testdata/layout/menu-120x36.txt +++ b/internal/ui/testdata/layout/menu-120x36.txt @@ -8,11 +8,12 @@ │ ▦ Dashboard ││ │ ↻ Update the server u │ │ │ ↻ Updates ││ │ Pull the latest playbook and roles, then re-run the install with your saved │ │ │ ◷ Backups ││ │ answers. Also applies any changes you made in the setup. │ │ -│ ↺ Restore ││ ╰────────────────────────────────────────────────────────────────────────────────────╯ │ -│ ↶ Rollback ││ ✓ Check services c │ -│ ✎ Fine-tune ││ ↯ Restart all services r │ -│ ⚒ Maintenance ││ ± See what an update brings n │ -│ ⇢ Move server ││ ▣ Check container images i │ +│ ⚑ Alerts ││ ╰────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ↺ Restore ││ ✓ Check services c │ +│ ↶ Rollback ││ ↯ Restart all services r │ +│ ✎ Fine-tune ││ ± See what an update brings n │ +│ ⚒ Maintenance ││ ▣ Check container images i │ +│ ⇢ Move server ││ ⚑ Alerts │ │ ▤ Servers ││ ⏻ Start, stop or reinstall services p │ │ ││ ⇪ Update interzone │ │ ▸ Mirrors ││ │ @@ -28,8 +29,7 @@ │ ││ ◔ Disk space │ │ ││ ⌫ Vacuum the database │ │ ││ ⇡ Upgrade Postgres │ -│ ││ ⇲ Compress Synapse's state │ -│ ◫ auto (wide) ctrl+l ││ │ +│ ◫ auto (wide) ctrl+l ││ ⇲ Compress Synapse's state │ │ ◐ interzone ctrl+y ││ ▼ more below │ │ ◂ fold ctrl+b menu ││ │ ╰────────────────────────╯╰────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/internal/ui/testdata/layout/menu-46x40.txt b/internal/ui/testdata/layout/menu-46x40.txt index 9ab8780..119988f 100644 --- a/internal/ui/testdata/layout/menu-46x40.txt +++ b/internal/ui/testdata/layout/menu-46x40.txt @@ -8,17 +8,17 @@ │ ▦ Dashboard │ │ ↻ Updates │ ╰───────────────────╯ ╰────────────────────╯ ╭───────────────────╮ ╭────────────────────╮ - │ ◷ Backups │ │ ↺ Restore │ + │ ◷ Backups │ │ ⚑ Alerts │ ╰───────────────────╯ ╰────────────────────╯ ╭───────────────────╮ ╭────────────────────╮ - │ ↶ Rollback │ │ ✎ Fine-tune │ + │ ↺ Restore │ │ ↶ Rollback │ ╰───────────────────╯ ╰────────────────────╯ ╭───────────────────╮ ╭────────────────────╮ - │ ⚒ Maintenance │ │ ⇢ Move server │ + │ ✎ Fine-tune │ │ ⚒ Maintenance │ + ╰───────────────────╯ ╰────────────────────╯ + ╭───────────────────╮ ╭────────────────────╮ + │ ⇢ Move server │ │ ▤ Servers │ ╰───────────────────╯ ╰────────────────────╯ - ╭───────────────────╮ - │ ▤ Servers │ - ╰───────────────────╯ ⇅ Mirrors ▸ ▤ Servers ▾ diff --git a/internal/ui/testdata/layout/menu-48x20.txt b/internal/ui/testdata/layout/menu-48x20.txt index 893be89..fa8d1d9 100644 --- a/internal/ui/testdata/layout/menu-48x20.txt +++ b/internal/ui/testdata/layout/menu-48x20.txt @@ -8,13 +8,13 @@ │ ▦ Dashboard │ │ ↻ Updates │ ╰────────────────────╯ ╰─────────────────────╯ ╭────────────────────╮ ╭─────────────────────╮ - │ ◷ Backups │ │ ↺ Restore │ + │ ◷ Backups │ │ ⚑ Alerts │ ╰────────────────────╯ ╰─────────────────────╯ ╭────────────────────╮ ╭─────────────────────╮ - │ ↶ Rollback │ │ ✎ Fine-tune │ + │ ↺ Restore │ │ ↶ Rollback │ ╰────────────────────╯ ╰─────────────────────╯ ╭────────────────────╮ ╭─────────────────────╮ - │ ⚒ Maintenance │ │ ⇢ Move server │ + │ ✎ Fine-tune │ │ ⚒ Maintenance │ ╰────────────────────╯ ╰─────────────────────╯ ▼ more below ✕ close \ No newline at end of file diff --git a/internal/ui/testdata/layout/sheet-120x36.txt b/internal/ui/testdata/layout/sheet-120x36.txt index e0cba65..eda1032 100644 --- a/internal/ui/testdata/layout/sheet-120x36.txt +++ b/internal/ui/testdata/layout/sheet-120x36.txt @@ -8,11 +8,12 @@ │ ▦ Dashboard ││ │ ↻ Update the server u │ │ │ ↻ Updates ││ │ Pull the latest playbook and roles, then re-run the install with your saved │ │ │ ◷ Backups ││ │ answers. Also applies any changes you made in the setup. │ │ -│ ↺ Restore ││ ╰────────────────────────────────────────────────────────────────────────────────────╯ │ -│ ↶ Rollback ││ ✓ Check services c │ -│ ✎ Fine-tune ││ ↯ Restart all services r │ -│ ⚒ Maintenance ││ ± See what an update brings n │ -│ ⇢ Move server ││ ▣ Check container images i │ +│ ⚑ Alerts ││ ╰────────────────────────────────────────────────────────────────────────────────────╯ │ +│ ↺ Restore ││ ✓ Check services c │ +│ ↶ Rollback ││ ↯ Restart all services r │ +│ ✎ Fine-tune ││ ± See what an update brings n │ +│ ⚒ Maintenance ││ ▣ Check container images i │ +│ ⇢ Move server ││ ⚑ Alerts │ │ ▤ Servers ││ ⏻ Start, stop or reinstall services p │ │ ││ ⇪ Update interzone │ │ ▸ Mirrors ││ │ @@ -28,8 +29,7 @@ │ ││ ◔ Disk space │ │ ││ ⌫ Vacuum the database │ │ ││ ⇡ Upgrade Postgres │ -│ ││ ⇲ Compress Synapse's state │ -│ ◫ auto (wide) ctrl+l ││ │ +│ ◫ auto (wide) ctrl+l ││ ⇲ Compress Synapse's state │ │ ◐ interzone ctrl+y ││ ▼ more below │ │ ◂ fold ctrl+b menu ││ │ ╰────────────────────────╯╰────────────────────────────────────────────────────────────────────────────────────────────╯ diff --git a/internal/ui/testdata/layout/tokens-120x36.txt b/internal/ui/testdata/layout/tokens-120x36.txt index 23d063d..ea927fa 100644 --- a/internal/ui/testdata/layout/tokens-120x36.txt +++ b/internal/ui/testdata/layout/tokens-120x36.txt @@ -9,13 +9,14 @@ │ ▦ Dashboard ││ ● book-club 4/10 used │ ● q7KzR2mWx9PtL4vNb8Hc │ │ │ ↻ Updates ││ ⊘ family2025 used up │ the token interzone made for sign-up │ │ │ ◷ Backups ││ ⊘ old-link revoked │ │ │ -│ ↺ Restore ││ │ Used 14 no limit │ │ -│ ↶ Rollback ││ │ Last used 3h ago │ │ -│ ✎ Fine-tune ││ │ Made 0000-00-00 40d ago │ │ -│ ⚒ Maintenance ││ │ Expires never │ │ -│ ⇢ Move server ││ │ │ │ -│ ▤ Servers ││ │ x revoke n new token │ │ -│ ││ ╰────────────────────────────────────────────╯ │ +│ ⚑ Alerts ││ │ Used 14 no limit │ │ +│ ↺ Restore ││ │ Last used 3h ago │ │ +│ ↶ Rollback ││ │ Made 0000-00-00 40d ago │ │ +│ ✎ Fine-tune ││ │ Expires never │ │ +│ ⚒ Maintenance ││ │ │ │ +│ ⇢ Move server ││ │ x revoke n new token │ │ +│ ▤ Servers ││ ╰────────────────────────────────────────────╯ │ +│ ││ │ │ ▸ Mirrors ││ │ │ ││ │ │ ▾ Servers ││ │ @@ -28,7 +29,6 @@ │ ││ │ │ ││ │ │ ││ │ -│ ││ │ │ ◫ auto (wide) ctrl+l ││ │ │ ◐ interzone ctrl+y ││ │ │ ◂ fold ctrl+b menu ││ │ diff --git a/internal/ui/testdata/layout/users-120x36.txt b/internal/ui/testdata/layout/users-120x36.txt index 9389bd5..d4fd8f6 100644 --- a/internal/ui/testdata/layout/users-120x36.txt +++ b/internal/ui/testdata/layout/users-120x36.txt @@ -8,18 +8,18 @@ │ ▦ Dashboard ││ │ people │ │ active │ │ admin │ │ new │ │ rooms │ │ media │ │ bridged │ │ │ ↻ Updates ││ ╰─────────╯ ╰─────────╯ ╰─────────╯ ╰─────────╯ ╰─────────╯ ╰─────────╯ ╰────────────╯ │ │ ◷ Backups ││ / search f everyone o by last seen │ -│ ↺ Restore ││ │ -│ ↶ Rollback ││ ▌ ● Alice Liddell admin 2h ago ╭────────────────────────────────────────────╮ │ -│ ✎ Fine-tune ││ ● Bob 3d ago │ ● Alice Liddell admin │ │ -│ ⚒ Maintenance ││ ● Carol 45d ago │ @alice:example.org │ │ -│ ⇢ Move server ││ ○ eve never │ │ │ -│ ▤ Servers ││ ⊘ dave deactivated │ Last seen 2h ago 0000-00-00 00:00 │ │ -│ ││ ⇄ Telegram 3 accounts ▸ │ Joined 0000-00-00 1y ago │ │ -│ ▸ Mirrors ││ ⇄ WhatsApp 1 account ▸ │ Sessions 3 devices │ │ -│ ││ │ Rooms 27 │ │ -│ ▾ Servers ││ │ Media 380 MB 142 files │ │ -│ ● example.org ││ │ Email alice@example.org │ │ -│ ││ │ Picture set │ │ +│ ⚑ Alerts ││ │ +│ ↺ Restore ││ ▌ ● Alice Liddell admin 2h ago ╭────────────────────────────────────────────╮ │ +│ ↶ Rollback ││ ● Bob 3d ago │ ● Alice Liddell admin │ │ +│ ✎ Fine-tune ││ ● Carol 45d ago │ @alice:example.org │ │ +│ ⚒ Maintenance ││ ○ eve never │ │ │ +│ ⇢ Move server ││ ⊘ dave deactivated │ Last seen 2h ago 0000-00-00 00:00 │ │ +│ ▤ Servers ││ ⇄ Telegram 3 accounts ▸ │ Joined 0000-00-00 1y ago │ │ +│ ││ ⇄ WhatsApp 1 account ▸ │ Sessions 3 devices │ │ +│ ▸ Mirrors ││ │ Rooms 27 │ │ +│ ││ │ Media 380 MB 142 files │ │ +│ ▾ Servers ││ │ Email alice@example.org │ │ +│ ● example.org ││ │ Picture set │ │ │ ││ │ │ │ │ ││ │ p new password a remove admin │ │ │ ││ │ s sign out everywhere d deactivate │ │ diff --git a/internal/ui/testdata/layout/users-180x50.txt b/internal/ui/testdata/layout/users-180x50.txt index 7ddb2df..a5f91c0 100644 --- a/internal/ui/testdata/layout/users-180x50.txt +++ b/internal/ui/testdata/layout/users-180x50.txt @@ -8,18 +8,18 @@ │ ▦ Dashboard ││ │ people │ │ active (30 days) │ │ admin │ │ new (30 days) │ │ rooms │ │ media │ │ bridged │ │ │ ↻ Updates ││ ╰──────────────────╯ ╰──────────────────╯ ╰──────────────────╯ ╰──────────────────╯ ╰──────────────────╯ ╰──────────────────╯ ╰──────────────────╯ │ │ ◷ Backups ││ / search f everyone o by last seen │ -│ ↺ Restore ││ │ -│ ↶ Rollback ││ ▌ ● Alice Liddell admin 2h ago ╭──────────────────────────────────────────────────────────────────────────────────────╮ │ -│ ✎ Fine-tune ││ ● Bob 3d ago │ ● Alice Liddell admin │ │ -│ ⚒ Maintenance ││ ● Carol 45d ago │ @alice:example.org │ │ -│ ⇢ Move server ││ ○ eve never │ │ │ -│ ▤ Servers ││ ⊘ dave deactivated │ Last seen 2h ago 0000-00-00 00:00 │ │ -│ ││ ⇄ Telegram 3 accounts ▸ │ Joined 0000-00-00 1y ago │ │ -│ ▸ Mirrors ││ ⇄ WhatsApp 1 account ▸ │ Sessions 3 devices │ │ -│ ││ │ Rooms 27 │ │ -│ ▾ Servers ││ │ Media 380 MB 142 files │ │ -│ ● example.org ││ │ Email alice@example.org │ │ -│ ││ │ Picture set │ │ +│ ⚑ Alerts ││ │ +│ ↺ Restore ││ ▌ ● Alice Liddell admin 2h ago ╭──────────────────────────────────────────────────────────────────────────────────────╮ │ +│ ↶ Rollback ││ ● Bob 3d ago │ ● Alice Liddell admin │ │ +│ ✎ Fine-tune ││ ● Carol 45d ago │ @alice:example.org │ │ +│ ⚒ Maintenance ││ ○ eve never │ │ │ +│ ⇢ Move server ││ ⊘ dave deactivated │ Last seen 2h ago 0000-00-00 00:00 │ │ +│ ▤ Servers ││ ⇄ Telegram 3 accounts ▸ │ Joined 0000-00-00 1y ago │ │ +│ ││ ⇄ WhatsApp 1 account ▸ │ Sessions 3 devices │ │ +│ ▸ Mirrors ││ │ Rooms 27 │ │ +│ ││ │ Media 380 MB 142 files │ │ +│ ▾ Servers ││ │ Email alice@example.org │ │ +│ ● example.org ││ │ Picture set │ │ │ ││ │ │ │ │ ││ │ p new password a remove admin s sign out everywhere d deactivate │ │ │ ││ ╰──────────────────────────────────────────────────────────────────────────────────────╯ │ diff --git a/internal/ui/testdata/layout/users-bridge-120x36.txt b/internal/ui/testdata/layout/users-bridge-120x36.txt index bd065c8..24abe0d 100644 --- a/internal/ui/testdata/layout/users-bridge-120x36.txt +++ b/internal/ui/testdata/layout/users-bridge-120x36.txt @@ -8,18 +8,18 @@ │ ▦ Dashboard ││ │ people │ │ active │ │ admin │ │ new │ │ rooms │ │ media │ │ bridged │ │ │ ↻ Updates ││ ╰─────────╯ ╰─────────╯ ╰─────────╯ ╰─────────╯ ╰─────────╯ ╰─────────╯ ╰────────────╯ │ │ ◷ Backups ││ / search f everyone o by last seen │ -│ ↺ Restore ││ │ -│ ↶ Rollback ││ ● Alice Liddell admin 2h ago ╭────────────────────────────────────────────╮ │ -│ ✎ Fine-tune ││ ● Bob 3d ago │ ⇄ Telegram bridge │ │ -│ ⚒ Maintenance ││ ● Carol 45d ago │ │ │ -│ ⇢ Move server ││ ○ eve never │ Accounts 3 1 active this month │ │ -│ ▤ Servers ││ ⊘ dave deactivated │ Bot @telegrambot:example.org │ │ -│ ││ ▌ ⇄ Telegram 3 accounts ▾ │ Media 4.0 MB │ │ -│ ▸ Mirrors ││ ● Telegram bridge… bot 1h ago │ │ │ -│ ││ ○ Nikolai (Telegram) never │ Puppets stand in for people on the other n │ │ -│ ▾ Servers ││ ○ Pavel (Telegram) never │ the bridge creates and manages them. │ │ -│ ● example.org ││ ⇄ WhatsApp 1 account ▸ ╰────────────────────────────────────────────╯ │ -│ ││ │ +│ ⚑ Alerts ││ │ +│ ↺ Restore ││ ● Alice Liddell admin 2h ago ╭────────────────────────────────────────────╮ │ +│ ↶ Rollback ││ ● Bob 3d ago │ ⇄ Telegram bridge │ │ +│ ✎ Fine-tune ││ ● Carol 45d ago │ │ │ +│ ⚒ Maintenance ││ ○ eve never │ Accounts 3 1 active this month │ │ +│ ⇢ Move server ││ ⊘ dave deactivated │ Bot @telegrambot:example.org │ │ +│ ▤ Servers ││ ▌ ⇄ Telegram 3 accounts ▾ │ Media 4.0 MB │ │ +│ ││ ● Telegram bridge… bot 1h ago │ │ │ +│ ▸ Mirrors ││ ○ Nikolai (Telegram) never │ Puppets stand in for people on the other n │ │ +│ ││ ○ Pavel (Telegram) never │ the bridge creates and manages them. │ │ +│ ▾ Servers ││ ⇄ WhatsApp 1 account ▸ ╰────────────────────────────────────────────╯ │ +│ ● example.org ││ │ │ ││ │ │ ││ │ │ ││ │