Documentation
¶
Overview ¶
Package fe mounts the Githome web front: the human-facing, server-rendered HTML surface that sits beside the REST and GraphQL APIs in the same binary. It owns no domain logic. It resolves data through the domain services, builds view models with fe/view, and renders them with fe/render; its middleware live in fe/webmw and its URL rules in fe/route. The front never calls the public API over HTTP: it shares the process and the domain layer directly. See implementation/00 and implementation/02.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Mount ¶
Mount registers the web front's dynamic routes on root and returns the servable handler: the asset tree peeled off in front of root. It does not touch the global middleware or the error handler the API surface installed: it registers its routes through scoped subrouters, so the web middleware chain applies to web routes only and the API keeps its own. The page chain carries recovery, the session, the color mode, the CSRF guard and the flash reader; the asset chain carries only recovery, so a static file does not pay for a session lookup.
The returned handler, not root, is what the server must serve when the web front is enabled. The static asset tree cannot share root's net/http mux: it is served under a greedy /assets/{file...} pattern, and that overlaps the front's own /{owner}/{repo}/... wildcards (an owner could be named "assets") in a way the Go 1.22 mux refuses to register. So assets live on their own router and are dispatched ahead of root by path prefix. See implementation/02.
Types ¶
type Deps ¶
type Deps struct {
Render *render.Set
View *view.Builder
Repos *domain.RepoService
Hooks *domain.HookService
Checks *domain.ChecksService
Issues *domain.IssueService
Pulls *domain.PRService
Reviews *domain.ReviewService
Search *domain.SearchService
Users *domain.UserService
Events *domain.EventService
URLs *presenter.URLBuilder
Markup *markup.Renderer
Sessions *webmw.Sessions
CSRF *webmw.CSRF
Flash *webmw.Flash
Logger *slog.Logger
}
Deps are the web front's dependencies. F0 needs the render set, the view builder, and the three stateful middleware (session, CSRF, flash) plus a logger. F1 adds the domain repo service and the presenter URL builder its code-browsing handlers read; a zero service leaves its routes unmounted, mirroring how the REST surface mounts. F2 adds the shared markup renderer the README and Markdown blob views render through; a nil renderer falls back to the escaped-source view, so the front still serves with markup unconfigured.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package assets owns the Githome web front's built static assets: the content-hashed CSS and JS bundles, the manifest that maps a logical name to its hashed file, and the Octicon-equivalent icon registry the render layer inlines.
|
Package assets owns the Githome web front's built static assets: the content-hashed CSS and JS bundles, the manifest that maps a logical name to its hashed file, and the Octicon-equivalent icon registry the render layer inlines. |
|
build
command
Command build compiles the Githome web front assets.
|
Command build compiles the Githome web front assets. |
|
Package render is the Githome web front's html/template engine.
|
Package render is the Githome web front's html/template engine. |
|
Package route holds the Githome web front's URL-space rules: the reserved top-level names that a user or organization login may not take, and the ref-versus-path split that the tree and blob URLs need.
|
Package route holds the Githome web front's URL-space rules: the reserved top-level names that a user or organization login may not take, and the ref-versus-path split that the tree and blob URLs need. |
|
Package view builds the view models the render layer turns into HTML.
|
Package view builds the view models the render layer turns into HTML. |
|
web
|
|
|
checks
Package checks holds the Githome web front's commit-checks surface: the page at /{owner}/{repo}/checks/{ref} that shows the status-check rollup for a ref, its check-run rows, and its commit-status rows.
|
Package checks holds the Githome web front's commit-checks surface: the page at /{owner}/{repo}/checks/{ref} that shows the status-check rollup for a ref, its check-run rows, and its commit-status rows. |
|
issues
Package issues holds the Githome web front's issues handlers: the index with its search-and-filter bar, the detail page with its comment timeline and sidebar, the comment composer, the reactions, and the new-issue form.
|
Package issues holds the Githome web front's issues handlers: the index with its search-and-filter bar, the detail page with its comment timeline and sidebar, the comment composer, the reactions, and the new-issue form. |
|
profile
Package profile holds the Githome web front's profile handlers: the user and organization overview at /{owner} and its repositories tab.
|
Package profile holds the Githome web front's profile handlers: the user and organization overview at /{owner} and its repositories tab. |
|
pulls
Package pulls holds the Githome web front's pull-request handlers: the index with its state tabs, the PR shell the four tabs hang off, the Conversation timeline, the Commits tab, the read-only Files-changed diff, and the merge box with its poll fragment and merge mutation.
|
Package pulls holds the Githome web front's pull-request handlers: the index with its state tabs, the PR shell the four tabs hang off, the Conversation timeline, the Commits tab, the read-only Files-changed diff, and the merge box with its poll fragment and merge mutation. |
|
repo
Package repo holds the Githome web front's code-browsing handlers: the repo home, the tree and blob views, the raw byte view, commit history, the branch and tag overviews, and the file finder.
|
Package repo holds the Githome web front's code-browsing handlers: the repo home, the tree and blob views, the raw byte view, commit history, the branch and tag overviews, and the file finder. |
|
reposettings
Package reposettings holds the Githome web front's repository settings handlers.
|
Package reposettings holds the Githome web front's repository settings handlers. |
|
search
Package search holds the Githome web front's search surface: the global /search page and the in-repo /{owner}/{repo}/search page.
|
Package search holds the Githome web front's search surface: the global /search page and the in-repo /{owner}/{repo}/search page. |
|
settings
Package settings holds the Githome web front's account settings handlers.
|
Package settings holds the Githome web front's account settings handlers. |
|
Package webmw holds the Githome web front's middleware: the signed session cookie that resolves the viewer, the color-mode cookie, the CSRF guard, the one-shot flash cookie, and the panic recovery that renders the HTML error page.
|
Package webmw holds the Githome web front's middleware: the signed session cookie that resolves the viewer, the color-mode cookie, the CSRF guard, the one-shot flash cookie, and the panic recovery that renders the HTML error page. |