~gitpocket/gitpocket

1

feat(basin): source sans 3 for readme and bio text

commit
5cd691cb1f8b0634805c4921a383eeeaae1fad70 browse tree
parent
722b80230615dc2fa7b0ae1356320322ba783814
author
james <j@cpl0.zip>
signature
none
date
2026-10-05 20:22 UTC

11 files changed, +117 −17

.gitignore modified

@@ -1 +1 @@
1-forge
1+basin

README.md modified

@@ -1,9 +1,9 @@
1-forge is a small self hosted git server in Go modelled on the browsing side of sourcehut. It serves repositories over ssh and smart https, renders trees, blobs, logs, diffs, refs and READMEs as server side HTML, and keeps users, profiles, keys, tokens and repository metadata in a single SQLite file. Source is highlighted with chroma, Markdown is rendered with goldmark and sanitised with bluemonday, and LaTeX in Markdown is typeset in the browser by a bundled KaTeX, which is the only JavaScript a reader ever loads.
1+basin is a small self hosted git server in Go modelled on the browsing side of sourcehut. It serves repositories over ssh and smart https, renders trees, blobs, logs, diffs, refs and READMEs as server side HTML, and keeps users, profiles, keys, tokens and repository metadata in a single SQLite file. Source is highlighted with chroma, Markdown is rendered with goldmark and sanitised with bluemonday, and LaTeX in Markdown is typeset in the browser by a bundled KaTeX, which is the only JavaScript a reader ever loads.
22
33 ## Build
44
55 ```
6-CGO_ENABLED=0 go build -trimpath -ldflags='-s -w' -o forge .
6+CGO_ENABLED=0 go build -trimpath -ldflags='-s -w' -o basin .
77 ```
88
99 The SQLite driver is the pure Go modernc port, so the binary is static and copies to the server as one file next to a system `git`.
@@ -11,11 +11,11 @@ The SQLite driver is the pure Go modernc port, so the binary is static and copie
1111 ## Usage
1212
1313 ```
14-forge -root /srv/forge serve -listen 127.0.0.1:3200 -host git.example.org
15-forge -root /srv/forge invite
14+basin -root /srv/basin serve -listen 127.0.0.1:3200 -host git.example.org
15+basin -root /srv/basin invite
1616 ```
1717
18-The data directory holds `forge.db` and a `repos/<user>/<name>.git` tree of bare repositories. Registration needs a single use invite from the second command unless `serve` is given `-open`. Clone URLs take the sourcehut shape `https://host/~user/repo` and `git@host:~user/repo`, with the `.git` suffix optional.
18+The data directory holds `basin.db` and a `repos/<user>/<name>.git` tree of bare repositories. Registration needs a single use invite from the second command unless `serve` is given `-open`. Clone URLs take the sourcehut shape `https://host/~user/repo` and `git@host:~user/repo`, with the `.git` suffix optional.
1919
2020 Every read of git data shells out to the plumbing with a 30 second timeout rather than parsing packfiles in process. Tree listings use `ls-tree -l`, history uses `log` with a NUL separated format, and commit pages parse the unified output of `diff-tree -p --root -M` into hunks for rendering. This keeps the server stateless and lets large repositories inherit git's own performance, at the cost of one process spawn per page section.
2121
@@ -26,10 +26,10 @@ Nothing in the binary refers to a particular host. The public name comes from `-
2626 ```
2727 [Service]
2828 User=git
29-ExecStart=/usr/local/bin/forge -root /srv/forge serve -listen 127.0.0.1:3200 -host git.example.org
29+ExecStart=/usr/local/bin/basin -root /srv/basin serve -listen 127.0.0.1:3200 -host git.example.org
3030 Restart=always
3131 ProtectSystem=strict
32-ReadWritePaths=/srv/forge
32+ReadWritePaths=/srv/basin
3333 ```
3434
3535 Put nginx or caddy in front with TLS, forwarding `Host`, `X-Forwarded-For` and `X-Forwarded-Proto`, and raise the body size limit so large pushes over https get through. The address in `X-Forwarded-For` is what the login rate limiter keys on, so the proxy must set it rather than append to it.
@@ -42,13 +42,13 @@ Pushes over ssh reuse the host sshd. Add a block such as the following, where th
4242 Match User git
4343 AuthenticationMethods publickey
4444 AuthorizedKeysFile none
45- AuthorizedKeysCommand /usr/local/bin/forge -root /srv/forge keys %u %h %t %k
45+ AuthorizedKeysCommand /usr/local/bin/basin -root /srv/basin keys %u %h %t %k
4646 AuthorizedKeysCommandUser root
4747 PermitTTY no
4848 DisableForwarding yes
4949 ```
5050
51-The lookup command finds the presented key by SHA256 fingerprint and answers with a forced command of `forge shell <user>`. That forced command reads `SSH_ORIGINAL_COMMAND`, checks ownership and visibility against the database, and execs `git upload-pack` or `git receive-pack` directly, so nothing stays resident between connections. The lookup opens the database read only and runs as root, while the forced command runs as the `git` user who owns the repositories.
51+The lookup command finds the presented key by SHA256 fingerprint and answers with a forced command of `basin shell <user>`. That forced command reads `SSH_ORIGINAL_COMMAND`, checks ownership and visibility against the database, and execs `git upload-pack` or `git receive-pack` directly, so nothing stays resident between connections. The lookup opens the database read only and runs as root, while the forced command runs as the `git` user who owns the repositories.
5252
5353 ## HTTPS
5454

go.mod modified

@@ -1,4 +1,4 @@
1-module forge
1+module basin
22
33 go 1.27.1
44

main.go modified

@@ -11,9 +11,9 @@ import (
1111 )
1212
1313 func main() {
14- root := flag.String("root", "/srv/forge", "data directory holding forge.db and repos/")
14+ root := flag.String("root", "/srv/basin", "data directory holding basin.db and repos/")
1515 flag.Usage = func() {
16- fmt.Fprintln(os.Stderr, `usage: forge [-root dir] command
16+ fmt.Fprintln(os.Stderr, `usage: basin [-root dir] command
1717
1818 serve [-listen addr] [-host name] [-open] [-ssh-user name] run the web server
1919 keys user home type key sshd AuthorizedKeysCommand
@@ -65,7 +65,7 @@ func mustStore(root string) *Store {
6565 if err := os.MkdirAll(filepath.Join(root, "repos"), 0o755); err != nil {
6666 log.Fatal(err)
6767 }
68- store, err := openStore(filepath.Join(root, "forge.db"), false)
68+ store, err := openStore(filepath.Join(root, "basin.db"), false)
6969 if err != nil {
7070 log.Fatal(err)
7171 }
@@ -85,6 +85,6 @@ func serve(root string, args []string) {
8585 Handler: newServer(store, root, *host, *open, *sshUser).handler(),
8686 ReadHeaderTimeout: 10 * time.Second,
8787 }
88- log.Printf("forge listening on %s for %s", *listen, *host)
88+ log.Printf("basin listening on %s for %s", *listen, *host)
8989 log.Fatal(srv.ListenAndServe())
9090 }

shell.go modified

@@ -13,7 +13,7 @@ func keys(root, binary string, args []string) int {
1313 if len(args) != 4 {
1414 return 1
1515 }
16- store, err := openStore(filepath.Join(root, "forge.db"), true)
16+ store, err := openStore(filepath.Join(root, "basin.db"), true)
1717 if err != nil {
1818 return 1
1919 }
@@ -50,7 +50,7 @@ func shell(root, name string) int {
5050 if !ok || !validName(owner) || !validName(repoName) {
5151 return fail("repository path must be ~owner/repo")
5252 }
53- store, err := openStore(filepath.Join(root, "forge.db"), true)
53+ store, err := openStore(filepath.Join(root, "basin.db"), true)
5454 if err != nil {
5555 return fail("database unavailable")
5656 }

static/fonts/sans-400-italic.woff2 added

Binary file.

static/fonts/sans-400-normal.woff2 added

Binary file.

static/fonts/sans-600-normal.woff2 added

Binary file.

static/fonts/sans-700-normal.woff2 added

Binary file.

static/fonts/sans.txt added

@@ -0,0 +1,93 @@
1+Copyright 2010-2024 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries.
2+
3+This Font Software is licensed under the SIL Open Font License, Version 1.1.
4+
5+This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
6+
7+
8+-----------------------------------------------------------
9+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10+-----------------------------------------------------------
11+
12+PREAMBLE
13+The goals of the Open Font License (OFL) are to stimulate worldwide
14+development of collaborative font projects, to support the font creation
15+efforts of academic and linguistic communities, and to provide a free and
16+open framework in which fonts may be shared and improved in partnership
17+with others.
18+
19+The OFL allows the licensed fonts to be used, studied, modified and
20+redistributed freely as long as they are not sold by themselves. The
21+fonts, including any derivative works, can be bundled, embedded,
22+redistributed and/or sold with any software provided that any reserved
23+names are not used by derivative works. The fonts and derivatives,
24+however, cannot be released under any other type of license. The
25+requirement for fonts to remain under this license does not apply
26+to any document created using the fonts or their derivatives.
27+
28+DEFINITIONS
29+"Font Software" refers to the set of files released by the Copyright
30+Holder(s) under this license and clearly marked as such. This may
31+include source files, build scripts and documentation.
32+
33+"Reserved Font Name" refers to any names specified as such after the
34+copyright statement(s).
35+
36+"Original Version" refers to the collection of Font Software components as
37+distributed by the Copyright Holder(s).
38+
39+"Modified Version" refers to any derivative made by adding to, deleting,
40+or substituting -- in part or in whole -- any of the components of the
41+Original Version, by changing formats or by porting the Font Software to a
42+new environment.
43+
44+"Author" refers to any designer, engineer, programmer, technical
45+writer or other person who contributed to the Font Software.
46+
47+PERMISSION & CONDITIONS
48+Permission is hereby granted, free of charge, to any person obtaining
49+a copy of the Font Software, to use, study, copy, merge, embed, modify,
50+redistribute, and sell modified and unmodified copies of the Font
51+Software, subject to the following conditions:
52+
53+1) Neither the Font Software nor any of its individual components,
54+in Original or Modified Versions, may be sold by itself.
55+
56+2) Original or Modified Versions of the Font Software may be bundled,
57+redistributed and/or sold with any software, provided that each copy
58+contains the above copyright notice and this license. These can be
59+included either as stand-alone text files, human-readable headers or
60+in the appropriate machine-readable metadata fields within text or
61+binary files as long as those fields can be easily viewed by the user.
62+
63+3) No Modified Version of the Font Software may use the Reserved Font
64+Name(s) unless explicit written permission is granted by the corresponding
65+Copyright Holder. This restriction only applies to the primary font name as
66+presented to the users.
67+
68+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69+Software shall not be used to promote, endorse or advertise any
70+Modified Version, except to acknowledge the contribution(s) of the
71+Copyright Holder(s) and the Author(s) or with their explicit written
72+permission.
73+
74+5) The Font Software, modified or unmodified, in part or in whole,
75+must be distributed entirely under this license, and must not be
76+distributed under any other license. The requirement for fonts to
77+remain under this license does not apply to any document created
78+using the Font Software.
79+
80+TERMINATION
81+This license becomes null and void if any of the above conditions are
82+not met.
83+
84+DISCLAIMER
85+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93+OTHER DEALINGS IN THE FONT SOFTWARE.

static/style.css modified

@@ -1,3 +1,7 @@
1+@font-face{font-family:"Source Sans 3";font-style:normal;font-weight:400;font-display:swap;src:url(/static/fonts/sans-400-normal.woff2) format('woff2')}
2+@font-face{font-family:"Source Sans 3";font-style:italic;font-weight:400;font-display:swap;src:url(/static/fonts/sans-400-italic.woff2) format('woff2')}
3+@font-face{font-family:"Source Sans 3";font-style:normal;font-weight:600;font-display:swap;src:url(/static/fonts/sans-600-normal.woff2) format('woff2')}
4+@font-face{font-family:"Source Sans 3";font-style:normal;font-weight:700;font-display:swap;src:url(/static/fonts/sans-700-normal.woff2) format('woff2')}
15 :root{--fg:#212529;--muted:#6c757d;--line:#dee2e6;--soft:#f8f9fa;--bar:#ddd;--link:#0640e0;--primary:#0640e0;--add:#1a7f37;--del:#c0392b;--addbg:#e6ffec;--delbg:#ffebe9;--code:#f8f9fa}
26 *{box-sizing:border-box}
37 html{font:15px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue","Noto Sans","DejaVu Sans",Arial,sans-serif;background:#fff;color:var(--fg)}
@@ -112,6 +116,9 @@ dl.meta dd{margin:0;overflow-wrap:anywhere}
112116 .filebar .crumbs a{color:var(--link);text-decoration:underline}
113117 .filebar .mode{color:var(--muted);font-family:inherit;font-size:inherit}
114118 .filebar .lastcommit{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:40rem}
119+.readme,.bio,.comment .readme{font-family:"Source Sans 3",system-ui,sans-serif;font-size:17px;line-height:1.55}
120+.readme code,.readme pre{font-size:13.5px}
121+.readme p{margin:.6rem 0}
115122 .readme img{max-width:100%}
116123 .readme table{border-collapse:collapse}
117124 .readme td,.readme th{border:1px solid var(--line);padding:.2rem .5rem}