Compare commits

...

7 Commits

4 changed files with 108 additions and 0 deletions

View File

@ -1,5 +1,7 @@
# gitea-selfhost # gitea-selfhost
Hosted instance: **https://gitea.seamtro.ai** (open sign-up). This kit is the same setup for your own machine.
Run your own [Gitea](https://about.gitea.com/) code host, set up the way the new internet's Run your own [Gitea](https://about.gitea.com/) code host, set up the way the new internet's
hosted Gitea is: public repos browsable without an account, open sign-up behind a captcha, hosted Gitea is: public repos browsable without an account, open sign-up behind a captcha,
`main` protected so every change lands through a pull request, and one Gitea user plus one `main` protected so every change lands through a pull request, and one Gitea user plus one
@ -171,9 +173,32 @@ rejected (even for the admin) while a PR merges, create an agent token (own repo
check the new-user defaults (no org creation, 10-repo limit), migrations off, captcha on sign-up, check the new-user defaults (no org creation, 10-repo limit), migrations off, captcha on sign-up,
backup. Then it stops Gitea and deletes everything. backup. Then it stops Gitea and deletes everything.
## Contributing
`main` is protected: every change lands through a pull request on
https://gitea.seamtro.ai/leora/gitea-selfhost. Run the kit tests (above) first.
## Licenses ## Licenses
- **Gitea** is free software under the MIT License, copyright the Gitea authors - **Gitea** is free software under the MIT License, copyright the Gitea authors
(<https://github.com/go-gitea/gitea>). This kit does not include or modify Gitea: it downloads the (<https://github.com/go-gitea/gitea>). This kit does not include or modify Gitea: it downloads the
official binary or image. official binary or image.
- **This kit** (scripts, templates, docs) is MIT-licensed too; see [LICENSE](LICENSE). - **This kit** (scripts, templates, docs) is MIT-licensed too; see [LICENSE](LICENSE).
## Optional: list `.profile` repos last
`config/custom/templates/explore/repo_list.tmpl` (plus `repo_list_item.tmpl`, the shared row markup)
overrides Gitea 1.23.x's repo list so `.profile` contact-card repos (any case) render after the
other repos. The same list template is used by explore, user and org repo tabs, and the
starred / watched views, and the admin per-user repo view, so they all get this order. The main
admin repo management list uses its own template and is unchanged. Organisations' private profile
repos (`.profile-private`) are out of scope and are not moved.
To install, copy both files to `$GITEA_CUSTOM/templates/explore/` and restart Gitea.
The reorder happens within each page. To keep whole lists in order, `config/app.ini.template`
sets `[ui] EXPLORE_PAGING_NUM = 100` and `[ui.user] REPO_PAGING_NUM = 100` (defaults are 20 and 15).
If an instance grows past 100 repos, raise these settings.
On every Gitea upgrade, diff `templates/explore/repo_list.tmpl` in the new version against these
files and port any changes. Gitea refuses to start when a template has an error.

View File

@ -97,3 +97,10 @@ LEVEL = Info
[other] [other]
SHOW_FOOTER_VERSION = false SHOW_FOOTER_VERSION = false
SHOW_FOOTER_TEMPLATE_LOAD_TIME = false SHOW_FOOTER_TEMPLATE_LOAD_TIME = false
; Large pages so the .profile-last template override orders whole lists, not just one page
[ui]
EXPLORE_PAGING_NUM = 100
[ui.user]
REPO_PAGING_NUM = 100

View File

@ -0,0 +1,10 @@
<div class="flex-list">
{{/* seamtro: .profile contact-card repos (any case) listed last; row markup in explore/repo_list_item.tmpl */}}
{{range .Repos}}{{if ne .LowerName ".profile"}}{{template "explore/repo_list_item" (dict "Repo" . "Root" $)}}{{end}}{{end}}
{{range .Repos}}{{if eq .LowerName ".profile"}}{{template "explore/repo_list_item" (dict "Repo" . "Root" $)}}{{end}}{{end}}
{{if not .Repos}}
<div>
{{ctx.Locale.Tr "search.no_results"}}
</div>
{{end}}
</div>

View File

@ -0,0 +1,66 @@
{{/* seamtro: one repo row, from Gitea 1.23.8 explore/repo_list.tmpl. Called with (dict "Repo" <repo> "Root" $) */}}
{{with .Repo}}
<div class="flex-item">
<div class="flex-item-leading">
{{template "repo/icon" .}}
</div>
<div class="flex-item-main">
<div class="flex-item-header">
<div class="flex-item-title">
{{if and (or $.Root.PageIsExplore $.Root.PageIsProfileStarList) .Owner}}
<a class="text primary name" href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>/
{{end}}
<a class="text primary name" href="{{.Link}}">{{.Name}}</a>
<span class="label-list">
{{if .IsArchived}}
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.archived"}}</span>
{{end}}
{{if .IsPrivate}}
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.private"}}</span>
{{else}}
{{if .Owner.Visibility.IsPrivate}}
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.internal"}}</span>
{{end}}
{{end}}
{{if .IsTemplate}}
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.template"}}</span>
{{end}}
{{if eq .ObjectFormatName "sha256"}}
<span class="ui basic label">{{ctx.Locale.Tr "repo.desc.sha256"}}</span>
{{end}}
</span>
</div>
<div class="flex-item-trailing muted-links">
{{if .PrimaryLanguage}}
<a class="flex-text-inline" href="?q={{$.Root.Keyword}}&sort={{$.Root.SortType}}&language={{.PrimaryLanguage.Language}}{{if $.Root.TabName}}&tab={{$.Root.TabName}}{{end}}">
<i class="color-icon tw-mr-2" style="background-color: {{.PrimaryLanguage.Color}}"></i>
{{.PrimaryLanguage.Language}}
</a>
{{end}}
{{if not $.Root.DisableStars}}
<a class="flex-text-inline" href="{{.Link}}/stars">
<span aria-label="{{ctx.Locale.Tr "repo.stars"}}">{{svg "octicon-star" 16}}</span>
<span {{if ge .NumStars 1000}}data-tooltip-content="{{.NumStars}}"{{end}}>{{CountFmt .NumStars}}</span>
</a>
{{end}}
<a class="flex-text-inline" href="{{.Link}}/forks">
<span aria-label="{{ctx.Locale.Tr "repo.forks"}}">{{svg "octicon-git-branch" 16}}</span>
<span {{if ge .NumForks 1000}}data-tooltip-content="{{.NumForks}}"{{end}}>{{CountFmt .NumForks}}</span>
</a>
</div>
</div>
{{$description := .DescriptionHTML ctx}}
{{if $description}}
<div class="flex-item-body">{{$description}}</div>
{{end}}
{{if .Topics}}
<div class="label-list">
{{range .Topics}}
{{if ne . ""}}<a class="ui label" href="{{AppSubUrl}}/explore/repos?q={{.}}&topic=1">{{.}}</a>{{end}}
{{end}}
</div>
{{end}}
<div class="flex-item-body">{{ctx.Locale.Tr "org.repo_updated"}} {{DateUtils.TimeSince .UpdatedUnix}}</div>
</div>
</div>
{{end}}