+5
appview/pages/pages.go
+5
appview/pages/pages.go
···
50
50
return pairs, nil
51
51
},
52
52
"timeFmt": humanize.Time,
53
+
"length": func(v []string) int {
54
+
return len(v)
55
+
},
53
56
}
54
57
}
55
58
···
255
258
type RepoBlobParams struct {
256
259
LoggedInUser *auth.User
257
260
RepoInfo RepoInfo
261
+
Active string
258
262
types.RepoBlobResponse
259
263
}
260
264
261
265
func (p *Pages) RepoBlob(w io.Writer, params RepoBlobParams) error {
266
+
params.Active = "overview"
262
267
return p.executeRepo("repo/blob", w, params)
263
268
}
264
269
+8
-11
appview/pages/templates/repo/blob.html
+8
-11
appview/pages/templates/repo/blob.html
···
1
1
{{ define "repoContent" }}
2
-
<table>
3
-
<tbody><tr>
4
-
<td class="line-numbers">
5
-
{{ range $i, $x := split .Contents }}
6
-
{{ add $i 1 }} {{ $x }} <br>
7
-
{{ end }}
8
-
</td>
9
-
<td class="file-content"></td>
10
-
</tbody></tr>
11
-
</table>
12
-
{{end}}
2
+
{{ $lines := split .Contents }}
3
+
{{ $tot_lines := len $lines }}
4
+
{{ $tot_chars := len (printf "%d" $tot_lines) }}
5
+
{{ $code_number_style := "code-line-num text-gray-400 mr-2 px-1 sticky left-0 bg-white border-r border-black text-right w-[{{$tot_chars}}rem]" }}
6
+
<pre class="font-mono text-sm overflow-auto relative text-ellipsis"><code>{{ range $idx, $line := $lines }}<span class="flex">
7
+
<span class="{{ $code_number_style }}">{{ add $idx 1 }}</span>
8
+
<span class="whitespace-pre">{{ $line }}</span></span>{{ else }}<em class="text-gray-400">this file is empty</em>{{ end }}</code></pre>
9
+
{{ end }}
+9
-17
flake.nix
+9
-17
flake.nix
···
54
54
${pkgs.tailwindcss}/bin/tailwindcss -i input.css -o appview/pages/static/tw.css
55
55
'';
56
56
subPackages = ["cmd/appview"];
57
-
vendorHash = "sha256-QgUPTOgAdKUTg+ztfs194G7pt3/qDtqTMkDRmMECxSo=";
57
+
vendorHash = "sha256-t7lWrCyFWCI7zjUcC6XNWzCrUPSCFnFu9gTmRTsYrz0=";
58
58
env.CGO_ENABLED = 1;
59
59
stdenv = pkgsStatic.stdenv;
60
60
};
61
-
62
-
knotserver = with final;
61
+
knotserver = with final;
63
62
final.pkgsStatic.buildGoModule {
64
-
pname = "knotserver";
65
-
version = "0.1.0";
66
-
src = gitignoreSource ./.;
67
-
subPackages = ["cmd/knotserver"];
68
-
vendorHash = "sha256-QgUPTOgAdKUTg+ztfs194G7pt3/qDtqTMkDRmMECxSo=";
69
-
env.CGO_ENABLED = 1;
70
-
nativeBuildInputs = with pkgsMusl; [ pkg-config ];
71
-
72
-
# Add these ldflags for static compilation
73
-
ldflags = [ "-s" "-w" "-linkmode external" ''-extldflags "-static -L${pkgsStatic.musl}/lib"'' ];
74
-
75
-
# Use static stdenv
76
-
stdenv = pkgMusl.stdenv;
77
-
};
63
+
pname = "knotserver";
64
+
version = "0.1.0";
65
+
src = gitignoreSource ./.;
66
+
subPackages = ["cmd/knotserver"];
67
+
vendorHash = "sha256-t7lWrCyFWCI7zjUcC6XNWzCrUPSCFnFu9gTmRTsYrz0=";
68
+
env.CGO_ENABLED = 1;
69
+
};
78
70
};
79
71
packages = forAllSystems (system: {
80
72
inherit (nixpkgsFor."${system}") indigo-lexgen appview knotserver;
+1
-1
go.mod
+1
-1
go.mod
···
10
10
github.com/bluesky-social/indigo v0.0.0-20250123072624-9e3b84fdbb20
11
11
github.com/bluesky-social/jetstream v0.0.0-20241210005130-ea96859b93d1
12
12
github.com/casbin/casbin/v2 v2.103.0
13
+
github.com/dustin/go-humanize v1.0.1
13
14
github.com/gliderlabs/ssh v0.3.5
14
15
github.com/go-chi/chi/v5 v5.2.0
15
16
github.com/go-git/go-git/v5 v5.12.0
···
37
38
github.com/cloudflare/circl v1.4.0 // indirect
38
39
github.com/cyphar/filepath-securejoin v0.3.3 // indirect
39
40
github.com/davecgh/go-spew v1.1.1 // indirect
40
-
github.com/dustin/go-humanize v1.0.1 // indirect
41
41
github.com/emirpasic/gods v1.18.1 // indirect
42
42
github.com/felixge/httpsnoop v1.0.4 // indirect
43
43
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect