8cb03140Revert "Add trailing slash to always-307 redirecting links"
This reverts commit b6743137da9fc418720b18a17b4c43813404d67c.
Every paths but root are now non-trailing-slash.
Shota FUJI
authored at
Shota FUJI
comitted at
726d130dRedirect to URL without trailing slash
The new router does not care trailing slash. However it's better to
canonicalize to one with trailing slash or without the one for indexing,
caching, and other various reasons.
The change to test file is net/http.Get being "smart" and clean Location
header so it'll be resolved to "/foo" on client side (= test code).
Shota FUJI
authored at
Shota FUJI
comitted at
800b62b9Add "repo.trimDotGitSuffix" option for bare repositories
The ".git" suffix is not only annoying, but also problematic to tools
like Go.
https://github.com/icyphox/legit/issues/34
Shota FUJI
authored at
Shota FUJI
comitted at
74199381Fix URLs including refs with slashes handled incorrectly
Massive refactor.
The net/http.ServeMux is still useless for this level of routing
requirements. I initially tried to encode slash characters but they
decode path components and they say it's not a bug. huh?
Thankfully, URL structure of legit is tidy and organized so I could just
write "mux" using if statement and switch statement. To be honest, I
quit like this approach compared to sprinkling string patterns
everywhere using struct holding mutex for weird usecase.
I'm not including this in a patch release considering the amount of
changes I made.
As a test, I ran cmd/save-commit-pages against Zig repository cloned
under demo/ directory before and after this patch. "diff" command
showed nothing and exited with 0, so at least commit page is not
regressed.
Shota FUJI
authored at
Shota FUJI
comitted at
2b8671d4Load aside section before main section on commit page
Commit page's body can be quite long depends on a commit. If it's
sufficiently long, browser renders aside after long main content. The
problem is that causes reflow thus unnecessary layout calculations.
With this patch, aside allocates its space by appearing before the main
content, so regardless of how long the main content, reflow does not
happen. The only downside is order of tab navigation and screen reader
pronouncing sections is different to other pages, due to HTML/CSS spec
and legacy bullshit a.k.a., accessibility practices is total garbage.
But this is worth the inconvenience given how inefficient and annoying
the reflow is.
Shota FUJI
authored at
Shota FUJI
comitted at
1a250e6fAdd "ui.diff.hideThresholdLines" option
Rendering over 10,000 lines diff is tough for browsers. This option
hides the element to ease layout calculation. This does not change
the page load speed, though.
Shota FUJI
authored at
Shota FUJI
comitted at
74c5502fAdd option to generated diff using system git
go-diff is too slow. As legit parses the generated patch file, we can
simply swap diff generator based on option. This is an opt-in config for
backwards compatibility. The diff generated by git command is different
(more intuitive hunk.)
This is part of https://tangled.org/pocka.jp/legit/issues/25
Shota FUJI
authored at
Shota FUJI
comitted at
b6743137Add trailing slash to always-307 redirecting links
Links this patch touches require a trailing slash, and request without
trailing slash will be 307 redirected to the one with a trailing slash.
This patch eliminates those unnecessary roundtrip.
Shota FUJI
authored at
Shota FUJI
comitted at
fa2cc136Add staticDirRevision option / build flag
Mainly for invalidating browser cache after upgrading legit.
https://tangled.org/pocka.jp/legit/issues/22
Shota FUJI
authored at
Shota FUJI
comitted at
1d9d7675Fix 404/500 pages have broken style and are unhelpful
https://tangled.org/pocka.jp/legit/issues/21
The initial plan was to just fix the broken style. As I editing the
HTML, I started to think this is a great place to put bug report link.
In the past, I put this kind of diagnosis info on an error page in my
work and that greatly helped debugging issues. The info here is just a
four-line text that is obvious in server log (if setup,) but end user
attaching this in complaints or whatever is really helpful, trust me.
UA is for grepping log lines. Even if it was generalized (for privacy
reasons,) it's still useful and time-saver.
Shota FUJI
authored at
Shota FUJI
comitted at
bd275169Fix GET / is 404 when non-git repository exists in scanPath
https://tangled.org/pocka.jp/legit/issues/20
Regression introduced in e31c3f8f4e4271038ef02560da68c6154b2e6121
Shota FUJI
authored at
Shota FUJI
comitted at
f4085cebAdd option to group repositories by category
https://tangled.org/pocka.jp/legit/issues/17
Category grouping is convenient for telling project's state and/or kind
(mirror, fork, demo.) My hosted instance serves 19 repositories yet it's
messy and hard to see an overview.
Shota FUJI
authored at
Shota FUJI
comitted at
8e0d9c46Read description from git config
Align with gitweb's behavior.
Shota FUJI
authored at
Shota FUJI
comitted at
db55fd92Fix test repository shares git directory and worktree
Possible, but not practical.
Shota FUJI
authored at
Shota FUJI
comitted at
e31c3f8fUse os.Root for path checking
os.Root uses system primitive rather than stringy securejoin.
Ideally, git.Open should accept fs.FS (or *os.Root) but go-git in its
current form (even v6) does not expose a function for "smart" open
method that can open both bare and non-bare repositories.
This patch also accidentally fixes following bugs:
* checked out "description" file in a non-bare repository is treated as
a description file.
* ignored repository reveal using URL-encoded slashes (see the second
test added in the parent commit)
Load tests on a minimal setup (nix run .#testing) shows no differences
before and after this patch.
This is not a clean solution, but code is less duplicated and more
correct and secure. I may revisit and refactor in near future.
Shota FUJI
authored at
Shota FUJI
comitted at
b92f7c89Add relative time to commit timestamps' tooltip
At first I tried to put these datetime formatting code into preferences
file. But it didn't work well due to increased load time = content
flashing.
Shota FUJI
authored at
Shota FUJI
comitted at
4059aa1eOverride <select> UA styles
Chromium (Linux) uses insanely low-contrast colors on dark mode.
Shota FUJI
authored at
Shota FUJI
comitted at