feat(basin): source sans 3 for readme and bio text
11 files changed, +117 −17
- .gitignore modified +1 −1
- README.md modified +9 −9
- go.mod modified +1 −1
- main.go modified +4 −4
- shell.go modified +2 −2
- static/fonts/sans-400-italic.woff2 added +0 −0
- static/fonts/sans-400-normal.woff2 added +0 −0
- static/fonts/sans-600-normal.woff2 added +0 −0
- static/fonts/sans-700-normal.woff2 added +0 −0
- static/fonts/sans.txt added +93 −0
- static/style.css modified +7 −0
.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. | |
| 2 | 2 | |
| 3 | 3 | ## Build |
| 4 | 4 | |
| 5 | 5 | ``` |
| 6 | -CGO_ENABLED=0 go build -trimpath -ldflags='-s -w' -o forge . | |
| 6 | +CGO_ENABLED=0 go build -trimpath -ldflags='-s -w' -o basin . | |
| 7 | 7 | ``` |
| 8 | 8 | |
| 9 | 9 | 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 | ||
| 11 | 11 | ## Usage |
| 12 | 12 | |
| 13 | 13 | ``` |
| 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 | |
| 16 | 16 | ``` |
| 17 | 17 | |
| 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. | |
| 19 | 19 | |
| 20 | 20 | 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. |
| 21 | 21 | |
| @@ -26,10 +26,10 @@ Nothing in the binary refers to a particular host. The public name comes from `- | ||
| 26 | 26 | ``` |
| 27 | 27 | [Service] |
| 28 | 28 | 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 | |
| 30 | 30 | Restart=always |
| 31 | 31 | ProtectSystem=strict |
| 32 | -ReadWritePaths=/srv/forge | |
| 32 | +ReadWritePaths=/srv/basin | |
| 33 | 33 | ``` |
| 34 | 34 | |
| 35 | 35 | 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 | ||
| 42 | 42 | Match User git |
| 43 | 43 | AuthenticationMethods publickey |
| 44 | 44 | 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 | |
| 46 | 46 | AuthorizedKeysCommandUser root |
| 47 | 47 | PermitTTY no |
| 48 | 48 | DisableForwarding yes |
| 49 | 49 | ``` |
| 50 | 50 | |
| 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. | |
| 52 | 52 | |
| 53 | 53 | ## HTTPS |
| 54 | 54 | |
go.mod modified
| @@ -1,4 +1,4 @@ | ||
| 1 | -module forge | |
| 1 | +module basin | |
| 2 | 2 | |
| 3 | 3 | go 1.27.1 |
| 4 | 4 | |
main.go modified
| @@ -11,9 +11,9 @@ import ( | ||
| 11 | 11 | ) |
| 12 | 12 | |
| 13 | 13 | 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/") | |
| 15 | 15 | flag.Usage = func() { |
| 16 | - fmt.Fprintln(os.Stderr, `usage: forge [-root dir] command | |
| 16 | + fmt.Fprintln(os.Stderr, `usage: basin [-root dir] command | |
| 17 | 17 | |
| 18 | 18 | serve [-listen addr] [-host name] [-open] [-ssh-user name] run the web server |
| 19 | 19 | keys user home type key sshd AuthorizedKeysCommand |
| @@ -65,7 +65,7 @@ func mustStore(root string) *Store { | ||
| 65 | 65 | if err := os.MkdirAll(filepath.Join(root, "repos"), 0o755); err != nil { |
| 66 | 66 | log.Fatal(err) |
| 67 | 67 | } |
| 68 | - store, err := openStore(filepath.Join(root, "forge.db"), false) | |
| 68 | + store, err := openStore(filepath.Join(root, "basin.db"), false) | |
| 69 | 69 | if err != nil { |
| 70 | 70 | log.Fatal(err) |
| 71 | 71 | } |
| @@ -85,6 +85,6 @@ func serve(root string, args []string) { | ||
| 85 | 85 | Handler: newServer(store, root, *host, *open, *sshUser).handler(), |
| 86 | 86 | ReadHeaderTimeout: 10 * time.Second, |
| 87 | 87 | } |
| 88 | - log.Printf("forge listening on %s for %s", *listen, *host) | |
| 88 | + log.Printf("basin listening on %s for %s", *listen, *host) | |
| 89 | 89 | log.Fatal(srv.ListenAndServe()) |
| 90 | 90 | } |
shell.go modified
| @@ -13,7 +13,7 @@ func keys(root, binary string, args []string) int { | ||
| 13 | 13 | if len(args) != 4 { |
| 14 | 14 | return 1 |
| 15 | 15 | } |
| 16 | - store, err := openStore(filepath.Join(root, "forge.db"), true) | |
| 16 | + store, err := openStore(filepath.Join(root, "basin.db"), true) | |
| 17 | 17 | if err != nil { |
| 18 | 18 | return 1 |
| 19 | 19 | } |
| @@ -50,7 +50,7 @@ func shell(root, name string) int { | ||
| 50 | 50 | if !ok || !validName(owner) || !validName(repoName) { |
| 51 | 51 | return fail("repository path must be ~owner/repo") |
| 52 | 52 | } |
| 53 | - store, err := openStore(filepath.Join(root, "forge.db"), true) | |
| 53 | + store, err := openStore(filepath.Join(root, "basin.db"), true) | |
| 54 | 54 | if err != nil { |
| 55 | 55 | return fail("database unavailable") |
| 56 | 56 | } |
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')} | |
| 1 | 5 | :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} |
| 2 | 6 | *{box-sizing:border-box} |
| 3 | 7 | 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} | ||
| 112 | 116 | .filebar .crumbs a{color:var(--link);text-decoration:underline} |
| 113 | 117 | .filebar .mode{color:var(--muted);font-family:inherit;font-size:inherit} |
| 114 | 118 | .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} | |
| 115 | 122 | .readme img{max-width:100%} |
| 116 | 123 | .readme table{border-collapse:collapse} |
| 117 | 124 | .readme td,.readme th{border:1px solid var(--line);padding:.2rem .5rem} |