Skip to content

web: remove the server-rendered page layer - #8539

Merged
unknwon merged 2 commits into
mainfrom
ui-cleanup-react-flamego
Nov 16, 2026
Merged

unknwon merged 2 commits into
mainfrom
ui-cleanup-react-flamego

Conversation

@unknwon

@unknwon unknwon commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Describe the pull request

Every page is now rendered by the React app, so this removes the server-rendered page layer that was left behind and cleans up the router.

  • Router: every page route uses one serveWeb handler (route.Home is gone), and the middleware that only set c.Data["PageIs…"] for templates is removed. The route-specific checks, e.g., two-factor state, webhook types and admin lookups, stay as they were.
  • Removed routes: the legacy POST /{user}/action/{action} (follow and unfollow), POST /{owner}/{repo}/action/{action} (watch, star and similar) and POST /{owner}/{repo}/branches/delete/*. The React pages use /api/web/* for these.
  • internal/context: removed the Cache and Flash fields, the template helpers (Title, PageIs, Require*, FormErr, HasValue, HTML, Success, RenderWithErr and others), every c.Data[...] write in the contexter, repository and organization middleware, and the notice banner loader. HasError and GetErrMsg stay because API v1 uses them.
  • Rendering: the Macaron renderer stays with an empty template file system, because API v1, Git HTTP and LFS still answer with c.JSON and c.PlainText. internal/template.FuncMap (with its test) and the template-only helpers in internal/template and internal/tool are removed. Mail templates are untouched.
  • Deleted: internal/route/home.go, internal/route/repo/branch.go, the unused dev.TemplatePreview handler, templates/base, templates/org, templates/repo, public/js, public/css, public/less, and the jQuery, Semantic UI, font-awesome, octicons, dropzone, highlight.js, mermaid and emoji assets. public keeps avatar_default.png, the favicon, the webhook icons and the dompurify, marked, notebookjs and pdf.js plugins the React app loads. The LibreJS page lists only those.
  • Dependencies: go-macaron/cache and its Redis adapter are gone (go mod tidy).
  • Latest release: the sidebar of the repository home shows the newest published release that is not a pre-release under the release count, with a "Latest" badge and its date, like GitHub, and a "+ N releases" link. Without such a release it shows the newest tag. Added repo.release.latest, repo.release.n_more_release and repo.release.n_more_releases.
  • Docs: browser support in the README, local development (no more Less), and custom templates (only mail templates can be overridden).

Behavior changes from legacy

  • The notice banner from custom/notice/banner.md is no longer shown. Only the removed templates rendered it.
  • The removed POST routes and assets, e.g., /js/gogs.js, answer 404.
  • Page template overrides in custom/templates are no longer read. Mail template overrides still work.

Screenshots

Dashboard

Dashboard

Repository home

Repository home

Repository home, dark

Repository home, dark

Pull request

Pull request

Branches

Branches

User settings

User settings

Site administration, as an admin

Site administration, as an admin

Not found

Not found

375px: repository home (dark) and dashboard

Repository home at 375px, dark Dashboard at 375px

Latest release in the sidebar, light, dark, and with tags only

Sidebar with the latest release

Sidebar with the latest release, dark

Sidebar with the newest tag when there is no release

Checklist

  • I agree to follow the Code of Conduct by submitting this pull request.
  • I have read and acknowledge the Contributing guide.
  • I have added test cases to cover the new code and provided the test plan below.
  • I have added an entry to CHANGELOG.

Test plan

  1. go build ./..., moon run gogs:lint (0 issues) and go test for ./cmd/..., internal/context, internal/route/..., internal/tool, internal/email and templates pass. No files under web/ change.
  2. Ran a -tags prod build with SQLite. Every page route returns the app (200), and the dashboard, a repository, a pull request, user settings, site administration and the 404 page render.
  3. API v1 answers JSON, and unknown API v1 routes answer 404. Archive downloads, git clone over HTTP, /healthcheck, avatars, plugins and issue and release attachments work.
  4. Access: signed out redirects to sign in, /admin answers 403 for a non-admin as before, and the removed routes and assets answer 404.
  5. Known and unrelated: /{user}.keys answers 404, the same as on main, because the user middleware looks up a user named {user}.keys.
  6. After the rebase onto main, with a -tags prod build. log: replace clog with charmlog and logx #8529 (logx), web: search repository branches and add GitHub-style branch tabs #8590 (branch tabs) and web: show community files in tabs below the file list #8615 landed since, so the contexter and RepoAssignment take the logger, the /branches/yours, /active and /stale routes stay (on serveWeb), and ToUTF8WithErr and ActionContent2Commits keep their logger. go mod tidy only drops go-macaron/cache and Redis. As alice, 28 page routes return the app (200), including the pull request, compare, branch tabs, Git hooks, settings and admin pages, and an unknown page returns 404. POST /alice/action/follow, POST /alice/alpha/action/star, /js/gogs.js and /css/gogs.css return 404. /healthcheck, /api/v1/repos/alice/alpha (JSON), a zip archive, git clone over HTTP, an issue attachment and the dompurify plugin return 200. The pages render with no failed resource requests at 1280, in dark mode and at 375, where nothing scrolls sideways.
  7. Latest release: with only the tags v1.0.0, v1.1.0 and v2.0.0, the sidebar shows v2.0.0 with no badge and "+ 2 releases". After publishing "Alpha 1.1" on v1.1.0, it shows "Alpha 1.1" with "Latest" and its date. A newer pre-release "Alpha 2.0 beta" on v2.0.0 leaves "Alpha 1.1" as the latest. A repository without tags still shows "No releases published". Checked in dark mode.

unknwon added a commit that referenced this pull request Nov 13, 2026
@unknwon unknwon mentioned this pull request Nov 13, 2026
4 tasks done
@unknwon
unknwon added this pull request to stack #8457 November 13, 2026 15:32
@unknwon
unknwon force-pushed the ui-cleanup-react-flamego branch 2 times, most recently from 89b632d to 78c74f2 Compare November 14, 2026 05:43
@unknwon
unknwon force-pushed the ui-cleanup-react-flamego branch 3 times, most recently from f6e85f6 to e22fd00 Compare November 14, 2026 13:23
@unknwon
unknwon force-pushed the ui-cleanup-react-flamego branch from e22fd00 to 782e3e1 Compare November 14, 2026 16:03
@unknwon
unknwon force-pushed the ui-cleanup-react-flamego branch 4 times, most recently from aeb4e3e to dad12d2 Compare November 14, 2026 19:00
@unknwon
unknwon force-pushed the ui-cleanup-react-flamego branch from dad12d2 to 2719ecb Compare November 14, 2026 19:23
@unknwon
unknwon force-pushed the ui-cleanup-react-flamego branch 5 times, most recently from f77d1d1 to 70661f5 Compare November 14, 2026 21:47
@unknwon
unknwon force-pushed the ui-cleanup-react-flamego branch 3 times, most recently from 69eb0e4 to dff43bb Compare November 14, 2026 23:00
@unknwon
unknwon force-pushed the ui-cleanup-react-flamego branch from dff43bb to 86f22c8 Compare November 14, 2026 23:31
@unknwon
unknwon force-pushed the ui-cleanup-react-flamego branch from b0d3a69 to 722378b Compare November 15, 2026 13:45
@unknwon
unknwon force-pushed the ui-cleanup-react-flamego branch 4 times, most recently from 457dc02 to 99c3dc6 Compare November 15, 2026 22:45
@unknwon
unknwon force-pushed the ui-cleanup-react-flamego branch 3 times, most recently from ffc7985 to a69bb1a Compare November 16, 2026 02:24
@unknwon
unknwon force-pushed the ui-cleanup-react-flamego branch from a69bb1a to 23dfe99 Compare November 16, 2026 03:07
Base automatically changed from new-pull-react-flamego to main November 16, 2026 20:35
@unknwon
unknwon marked this pull request as ready for review November 16, 2026 20:36
@mintlify

mintlify Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
Gogs 🟢 Ready View Preview Nov 16, 2026, 9:48 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@mintlify

mintlify Bot commented Nov 16, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
Gogs 🟡 Building – Nov 16, 2026, 8:36 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

The sidebar of the repository home shows the newest published release that
is not a pre-release, with a "Latest" badge and its date, like GitHub, or the
newest tag when there is none, and links to the rest.
@unknwon
unknwon force-pushed the ui-cleanup-react-flamego branch from f5b6568 to 70b16bd Compare November 16, 2026 21:48
@unknwon
unknwon merged commit c413106 into main Nov 16, 2026
15 checks passed
@unknwon
unknwon deleted the ui-cleanup-react-flamego branch November 16, 2026 22:25

This branch was successfully deployed

1 active deployment
staging - docs — 70b16bd3 Deployed Nov 16, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant