From 5cb75c1af0a0418974e1b20368e4fbf940912f9e Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Fri, 14 Jun 2024 08:00:00 +0800 Subject: Fork init --- .gitignore | 1 + LICENSE | 23 ++++++++++++++ README.md | 67 +++++++++++++++++++++++++++++++++++++++ config.yaml | 10 +++--- contrib/legit.service | 8 ++--- license | 23 -------------- readme | 87 --------------------------------------------------- templates/404.html | 1 + templates/500.html | 1 + templates/commit.html | 1 + templates/file.html | 1 + templates/index.html | 1 + templates/log.html | 1 + templates/refs.html | 1 + templates/repo.html | 1 + templates/tree.html | 1 + 16 files changed, 109 insertions(+), 119 deletions(-) create mode 100644 LICENSE create mode 100644 README.md delete mode 100644 license delete mode 100644 readme diff --git a/.gitignore b/.gitignore index 46ecc00..12a68f2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ legit result +legitrx diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fc9152a --- /dev/null +++ b/LICENSE @@ -0,0 +1,23 @@ +The MIT License (MIT) + +Copyright (c) Anirudh Oppiliappan + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/README.md b/README.md new file mode 100644 index 0000000..fdcd067 --- /dev/null +++ b/README.md @@ -0,0 +1,67 @@ +# Legitrx + +This is [Runxi Yu](https://runxiyu.org)'s fork of +[icyphox](https://icyphox.sh/)'s [legit](https://git.icyphox.sh/legit/) +project. It aims to replace the use of +[cgit](https://git.zx2c4.com/cgit/about/) Runxi's servers. + +At its current state, you should not use this fork. Use upstream instead. + +## Features + +- Customizable templates and stylesheets. +- Cloning over HTTPS. +- Not CGI. + +## Building + +```sh +git clone https://git.sr.ht/~runxiyu/legitrx +go build +``` + +## Configuration + +If no filename is specified via the `--config` option, it looks for `config.yaml` in the current working directory. + +```yaml +repo: + scanPath: /srv/git + readme: + - README + - README.md + mainBranch: + - master + - main + ignore: + - repo-to-hide +dirs: + templates: ./templates + static: ./static +meta: + title: Legitrx + description: Testing +server: + name: git.runxiyu.org + host: 127.0.0.1 + port: 5555 + ``` + +`server.name` is used for `go import` meta tags and clone URLs. + +## Notes + +- Run legitrx behind a TLS terminating proxy like + [relayd(8)](https://man.openbsd.org/relayd.8) or nginx. +- Cloning only works in bare repos. +- Pushing over https, while supported, is disabled because auth is a pain. Use + ssh or [Gitolite](https://gitolite.com/gitolite/). +- Paths are [unveil(2)](https://man.openbsd.org/unveil.2)'d on OpenBSD. + +## Ideas + +- Code highlighting support. + +## License + +Legitrx is licensed under the MIT license. diff --git a/config.yaml b/config.yaml index 7a6066f..909509f 100644 --- a/config.yaml +++ b/config.yaml @@ -1,5 +1,5 @@ repo: - scanPath: /var/www/git + scanPath: /srv/git readme: - readme - README @@ -12,9 +12,9 @@ dirs: templates: ./templates static: ./static meta: - title: icy does git - description: come get your free software + title: legitrx + description: no description yet server: - name: git.icyphox.sh - host: 0.0.0.0 + name: git.runxiyu.org + host: 127.0.0.1 port: 5555 diff --git a/contrib/legit.service b/contrib/legit.service index e0193ed..a17fd4c 100644 --- a/contrib/legit.service +++ b/contrib/legit.service @@ -1,12 +1,12 @@ [Unit] -Description=legit Server +Description=legitrx After=network-online.target Requires=network-online.target [Service] -User=git -Group=git -ExecStart=/usr/bin/legit -config /etc/legit/config.yaml +User=legitrx +Group=legitrx +ExecStart=/usr/local/bin/legitrx -config /etc/legitrx.yaml ProtectSystem=strict ProtectHome=strict NoNewPrivileges=true diff --git a/license b/license deleted file mode 100644 index fc9152a..0000000 --- a/license +++ /dev/null @@ -1,23 +0,0 @@ -The MIT License (MIT) - -Copyright (c) Anirudh Oppiliappan - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/readme b/readme deleted file mode 100644 index d242cd4..0000000 --- a/readme +++ /dev/null @@ -1,87 +0,0 @@ -legit ------ - -A git web frontend written in Go. - -Pronounced however you like; I prefer channeling my inner beret-wearing -Frenchman, and saying "Oui, il est le git!" - -But yeah it's pretty legit, no cap on god fr fr. - - -FEATURES - -• Fully customizable templates and stylesheets. -• Cloning over http(s). -• Less archaic HTML. -• Not CGI. - - -INSTALLING - -Clone it, 'go build' it. - - -CONFIG - -Uses yaml for configuration. Looks for a 'config.yaml' in the current -directory by default; pass the '--config' flag to point it elsewhere. - -Example config.yaml: - - repo: - scanPath: /var/www/git - readme: - - readme - - README - - readme.md - - README.md - mainBranch: - - master - - main - ignore: - - foo - - bar - dirs: - templates: ./templates - static: ./static - meta: - title: git good - description: i think it's a skill issue - server: - name: git.icyphox.sh - host: 127.0.0.1 - port: 5555 - -These options are fairly self-explanatory, but of note are: - -• repo.scanPath: where all your git repos live (or die). legit doesn't - traverse subdirs yet. -• dirs: use this to override the default templates and static assets. -• repo.readme: readme files to look for. -• repo.mainBranch: main branch names to look for. -• repo.ignore: repos to ignore, relative to scanPath. -• server.name: used for go-import meta tags and clone URLs. - - -NOTES - -• Run legit behind a TLS terminating proxy like relayd(8) or nginx. -• Cloning only works in bare repos -- this is a limitation inherent to git. You - can still view non-bare repos just fine in legit. -• The default head.html template uses my CDN to fetch fonts -- you may - or may not want this. -• Pushing over https, while supported, is disabled because auth is a - pain. Use ssh. -• Paths are unveil(2)'d on OpenBSD. - - -IDEAS - -• "Private" repos only available over Tailscale. -• Support or cgit-like filters (for readmes etc.). - - -LICENSE - -legit is licensed under MIT. diff --git a/templates/404.html b/templates/404.html index 8c40cd1..bca9d35 100644 --- a/templates/404.html +++ b/templates/404.html @@ -1,4 +1,5 @@ {{ define "404" }} + 404 {{ template "head" . }} diff --git a/templates/500.html b/templates/500.html index 53c605f..164700c 100644 --- a/templates/500.html +++ b/templates/500.html @@ -1,4 +1,5 @@ {{ define "500" }} + 500 {{ template "head" . }} diff --git a/templates/commit.html b/templates/commit.html index c1def17..49f4574 100644 --- a/templates/commit.html +++ b/templates/commit.html @@ -1,4 +1,5 @@ {{ define "commit" }} + {{ template "head" . }} diff --git a/templates/file.html b/templates/file.html index 23187ec..d18340a 100644 --- a/templates/file.html +++ b/templates/file.html @@ -1,4 +1,5 @@ {{ define "file" }} + {{ template "head" . }} {{ template "repoheader" . }} diff --git a/templates/index.html b/templates/index.html index 7a77aec..740d2b3 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,4 +1,5 @@ {{ define "index" }} + {{ template "head" . }} diff --git a/templates/log.html b/templates/log.html index 7d74cb3..d097990 100644 --- a/templates/log.html +++ b/templates/log.html @@ -1,4 +1,5 @@ {{ define "log" }} + {{ template "head" . }} diff --git a/templates/refs.html b/templates/refs.html index 00058d5..f0e591f 100644 --- a/templates/refs.html +++ b/templates/refs.html @@ -1,4 +1,5 @@ {{ define "refs" }} + {{ template "head" . }} diff --git a/templates/repo.html b/templates/repo.html index 1cd9b5c..68ab269 100644 --- a/templates/repo.html +++ b/templates/repo.html @@ -1,4 +1,5 @@ {{ define "repo" }} + {{ template "head" . }} diff --git a/templates/tree.html b/templates/tree.html index c4b7e4f..7ba065b 100644 --- a/templates/tree.html +++ b/templates/tree.html @@ -1,4 +1,5 @@ {{ define "tree" }} + {{ template "head" . }} -- cgit v1.2.3