+4
-2
appview/pages/pages.go
+4
-2
appview/pages/pages.go
···
74
74
"splitN": func(s, sep string, n int) []string {
75
75
return strings.SplitN(s, sep, n)
76
76
},
77
-
"unescapeHtml": func(s string) template.HTML {
78
-
return template.HTML(s)
77
+
"escapeHtml": func(s string) string {
78
+
return template.HTMLEscapeString(s)
79
79
},
80
80
"nl2br": func(text string) template.HTML {
81
81
return template.HTML(strings.Replace(template.HTMLEscapeString(text), "\n", "<br>", -1))
···
269
269
type RepoCommitParams struct {
270
270
LoggedInUser *auth.User
271
271
RepoInfo RepoInfo
272
+
Active string
272
273
types.RepoCommitResponse
273
274
}
274
275
275
276
func (p *Pages) RepoCommit(w io.Writer, params RepoCommitParams) error {
277
+
params.Active = "overview"
276
278
return p.executeRepo("repo/commit", w, params)
277
279
}
278
280
+5
-5
appview/pages/templates/layouts/base.html
+5
-5
appview/pages/templates/layouts/base.html
···
12
12
<title>{{ block "title" . }}tangled{{ end }}</title>
13
13
</head>
14
14
<body class="container mx-auto px-10">
15
-
<header>
16
-
{{ block "topbar" . }}
17
-
{{ template "layouts/topbar" . }}
18
-
{{ end }}
19
-
</header>
15
+
<header>
16
+
{{ block "topbar" . }}
17
+
{{ template "layouts/topbar" . }}
18
+
{{ end }}
19
+
</header>
20
20
<main class="content">{{ block "content" . }}{{ end }}</main>
21
21
<script src="/static/lucide.min.js"></script>
22
22
<script>
+5
-2
appview/pages/templates/layouts/repobase.html
+5
-2
appview/pages/templates/layouts/repobase.html
···
2
2
3
3
{{ define "content" }}
4
4
<section id="repo-header" class="mb-4">
5
-
<span class="text-xl">{{ .RepoInfo.FullName }}</span>
6
-
<br/>
5
+
<p class="text-xl">
6
+
<a href="/{{ .RepoInfo.OwnerWithAt }}" class="no-underline hover:underline">{{ .RepoInfo.OwnerWithAt }}</a>
7
+
/
8
+
<a href="/{{ .RepoInfo.FullName }}" class="no-underline hover:underline">{{ .RepoInfo.Name }}</a>
9
+
</p>
7
10
<span>
8
11
{{ if .RepoInfo.Description }}
9
12
{{ .RepoInfo.Description }}
+1
-1
appview/pages/templates/repo/blob.html
+1
-1
appview/pages/templates/repo/blob.html
···
18
18
{{ if .IsBinary }}<p class="text-center text-gray-400">This is a binary file and will not be displayed.</p>{{ else }}
19
19
<pre class="font-mono text-sm overflow-auto relative text-ellipsis"><code>{{ range $idx, $line := $lines }}<span class="flex">
20
20
<span class="{{ $code_number_style }}" style="min-width: {{$tot_chars}}ch;">{{ add $idx 1 }}</span>
21
-
<span class="whitespace-pre">{{ unescapeHtml $line }}</span></span>{{ else }}<em class="text-gray-400">this file is empty</em>{{ end }}</code></pre>{{ end}}
21
+
<span class="whitespace-pre">{{ escapeHtml $line }}</span></span>{{ else }}<em class="text-gray-400">this file is empty</em>{{ end }}</code></pre>{{ end}}
22
22
{{ end }}
+33
-33
appview/pages/templates/repo/commit.html
+33
-33
appview/pages/templates/repo/commit.html
···
8
8
{{ $diff := .Diff.Diff }}
9
9
10
10
<section class="commit">
11
-
<pre>{{- $commit.Message -}}</pre>
12
-
<div class="commit-info">
13
-
{{ $commit.Author.Name }} <a href="mailto:{{ $commit.Author.Email }}" class="commit-email">{{ $commit.Author.Email}}</a>
14
-
<div>{{ $commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div>
11
+
<div id="commit-message">
12
+
{{ $messageParts := splitN $commit.Message "\n\n" 2 }}
13
+
<div>
14
+
{{ index $messageParts 0 }}
15
+
{{ if gt (len $messageParts) 1 }}
16
+
<p class="mt-1 cursor-text pb-2">{{ nl2br (unwrapText (index $messageParts 1)) }}</p>
17
+
{{ end }}
18
+
</div>
15
19
</div>
16
20
17
-
<div>
18
-
<strong>commit</strong>
19
-
<p><a href="/{{ $repo }}/commit/{{ $commit.This }}" class="commit-hash">
20
-
{{ slice $commit.This 0 8 }}
21
-
</a>
21
+
<p class="text-sm text-gray-500">
22
+
<a href="mailto:{{ $commit.Author.Email }}" class="no-underline hover:underline text-gray-500">
23
+
{{ $commit.Author.Name }}
24
+
</a>
25
+
·
26
+
{{ timeFmt $commit.Author.When }}
27
+
·
28
+
<span class="font-mono">{{ $stat.FilesChanged }}</span> files <span class="font-mono">(+{{ $stat.Insertions }}, -{{ $stat.Deletions }})</span>
29
+
·
30
+
<a href="/{{ $repo }}/commit/{{ $commit.This }}" class="no-underline hover:underline text-gray-500">
31
+
{{ slice $commit.This 0 8 }}
32
+
</a>
33
+
{{ if $commit.Parent }}
34
+
<--
35
+
<a href="/{{ $repo }}/commit/{{ $commit.Parent }}" class="no-underline hover:underline text-gray-500">
36
+
{{ slice $commit.Parent 0 8 }}
37
+
</a>
38
+
{{ end }}
22
39
</p>
23
-
</div>
24
40
25
-
{{ if $commit.Parent }}
26
-
<div>
27
-
<strong>parent</strong>
28
-
<p><a href="/{{ $repo }}/commit/{{ $commit.Parent }}" class="commit-hash">
29
-
{{ slice $commit.Parent 0 8 }}
30
-
</a></p>
31
-
</div>
32
-
33
-
{{ end }}
34
41
<div class="diff-stat">
35
-
<div>
36
-
{{ $stat.FilesChanged }} files changed,
37
-
{{ $stat.Insertions }} insertions(+),
38
-
{{ $stat.Deletions }} deletions(-)
39
-
</div>
40
-
<div>
41
-
<br>
42
-
<strong>jump to</strong>
43
-
{{ range $diff }}
44
-
<ul>
42
+
<br>
43
+
<strong>jump to</strong>
44
+
{{ range $diff }}
45
+
<ul>
45
46
<li><a href="#{{ .Name.New }}">{{ .Name.New }}</a></li>
46
-
</ul>
47
-
{{ end }}
48
-
</div>
47
+
</ul>
48
+
{{ end }}
49
49
</div>
50
50
</section>
51
51
<section>
···
75
75
{{ if .IsBinary }}
76
76
<p>Not showing binary file.</p>
77
77
{{ else }}
78
-
<pre>
78
+
<pre class="overflow-auto">
79
79
{{- range .TextFragments -}}
80
80
<p>{{- .Header -}}</p>
81
81
{{- range .Lines -}}
+1
-1
appview/pages/templates/repo/index.html
+1
-1
appview/pages/templates/repo/index.html
···
101
101
<div class="text-base cursor-pointer">
102
102
<div>
103
103
<div class="flex items-center gap-1">
104
-
<a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}" class="inline no-underline hover:underline hover:text-sky-400">{{ index $messageParts 0 }}</a>
104
+
<a href="/{{ $.RepoInfo.FullName }}/commit/{{ .Hash.String }}" class="inline no-underline hover:underline">{{ index $messageParts 0 }}</a>
105
105
{{ if gt (len $messageParts) 1 }}
106
106
<button class="text-sm inline rounded-sm bg-gray-300 text-gray-700 px-1 w-fit hover:bg-gray-400"
107
107
hx-on:click="this.parentElement.nextElementSibling.classList.toggle('hidden')">…</button>
+8
-1
jetstream/jetstream.go
+8
-1
jetstream/jetstream.go
···
29
29
}
30
30
31
31
func (j *JetstreamClient) AddDid(did string) {
32
+
if did == "" {
33
+
return
34
+
}
32
35
j.mu.Lock()
33
36
j.cfg.WantedDids = append(j.cfg.WantedDids, did)
34
37
j.mu.Unlock()
···
37
40
38
41
func (j *JetstreamClient) UpdateDids(dids []string) {
39
42
j.mu.Lock()
40
-
j.cfg.WantedDids = dids
43
+
for _, did := range dids {
44
+
if did != "" {
45
+
}
46
+
j.cfg.WantedDids = append(j.cfg.WantedDids, did)
47
+
}
41
48
j.mu.Unlock()
42
49
j.reconnectCh <- struct{}{}
43
50
}