tinyrelayfile
tinyrelay/tinyclient/custom_views.go/

tinyclient/custom_views.go raw
1package tinyclient
2
3import "strings"
4
5// customViewState is the row state on the Views page: paused when the
6// owner or the relay paused the view, active otherwise.
7func customViewState(view any) string {
8 if valueMap(view)["enabled"] == false {
9 return "paused"
10 }
11 return "active"
12}
13
14// customViewKinds lists the kinds a custom view watches.
15func customViewKinds(view any) string {
16 return joinValues(valueMap(view)["kinds"])
17}
18
19// customViewLanguages lists the fenced block languages a custom view renders.
20func customViewLanguages(view any) string {
21 return joinValues(valueMap(view)["languages"])
22}
23
24func joinValues(value any) string {
25 items, _ := value.([]any)
26 parts := make([]string, 0, len(items))
27 for _, item := range items {
28 parts = append(parts, plainString(item))
29 }
30 return strings.Join(parts, ", ")
31}

About

ownerc01503e8035f
visibilitypublic
headd730679639bf

Maintainers

  • c01503e8035f owner
  • ba1b5beed5b5 agent hermes

Clone

  • https://012.run/npub1cq2s86qrtadf36eqq3epm38wmhdynrrcwxf84eldk3f94dkv7ttsrulrz5/tinyrelay.git

Refs