Commit Graph
6298 Commits
Author SHA1 Message Date
Joe Chen 0114e18bd3 31231 2026-05-28 17:20:19 -04:00
Joe Chen c4821cfe31 31231 2026-05-28 17:10:08 -04:00
Joe Chen 9327909209 1231 2026-05-28 16:53:38 -04:00
Joe Chen 8f9a1cf2c1 312 2026-05-28 16:40:47 -04:00
Joe Chen bc6c1ddf07 231 2026-05-28 16:31:27 -04:00
Joe Chen 65cce4eafe 312 2026-05-28 16:22:27 -04:00
Joe Chen 7102695655 213 2026-05-28 16:04:53 -04:00
Joe Chen 32573b844c 213 2026-05-28 16:00:32 -04:00
Joe Chen 98cb5a3db4 1231 2026-05-28 15:54:47 -04:00
Joe Chen a5d2c0ee36 111 2026-05-28 14:09:49 -04:00
Joe Chen 2d78fd22dc 213 2026-05-28 12:47:43 -04:00
Joe Chen c81f418856 1231 2026-05-28 12:25:48 -04:00
Joe Chen d259b87cfd 2131 2026-05-28 12:06:54 -04:00
Joe Chen f7449a8c85 21312 2026-05-28 12:00:53 -04:00
Joe Chen 9e1525bdf8 12312 2026-05-27 23:55:24 -04:00
unknwon c604d23be5 web(api): standardize repo handlers on flamego.Context
Drop `*http.Request` from handlers that only needed it for the request
context or `URL.Query()`, and replace `params := c.Params()` indexing
with `c.Param(...)` lookups. Every handler in webapi_repo.go now takes
just `(c flamego.Context, user *database.User)`.
2026-05-27 22:28:55 -04:00
Joe Chen 22f84f7ee9 111 2026-05-27 22:19:26 -04:00
unknwon c6b90ea5ab web(api): rename repo header fields to match GitHub-style naming
Apply review feedback on PR #8295. Flatten `repoHeaderCounts` into
`repoHeader` and rename fields to be more descriptive on the JSON wire
(`isViewerAdmin`, `issuesEnabled`, `pullRequestsEnabled`, `wikiEnabled`,
`watches`, `openPullRequests`, `isViewerWatching`, `hasViewerStarred`).
Apply the same naming to `repoActionResponse`. Rename `getRepoRaw` ->
`getRepoRawFile` with `{file}` param. Update the TS types and consumers
in `RepoHeader.tsx` to match.
2026-05-27 21:39:04 -04:00
Joe Chen 552fde5e8c 231 2026-05-27 21:25:27 -04:00
Joe Chen 87a7e5a80b 111 2026-05-27 16:48:31 -04:00
Joe Chen 6188e01752 111 2026-05-27 16:15:11 -04:00
Joe Chen 8c17948ddf 1231 2026-05-27 15:31:21 -04:00
Joe Chen a91b0551bd 111 2026-05-27 15:26:56 -04:00
Joe Chen 91e8a36578 1211 2026-05-27 14:20:54 -04:00
Joe Chen 5e191aa5c8 2131 2026-05-27 13:13:27 -04:00
unknwon c2a424a678 web(diff): tighten commit metadata row on commit page
Merge the author and parent/commit/buttons rows into a single
wrap-friendly flex line on desktop. Drop the committer line, since
showing it twice (author + committer) is rarely useful for the
common case where they match. Render each parent SHA as its own
clickable chip so multi-parent merge commits link to every parent.
Align View patch and Browse files to the left on mobile.
2026-05-27 09:47:15 -04:00
unknwon 10c829f798 web(diff): add per-file "Expand all lines" via raw file fetch
The commit diff page only ships the patch hunks, so unmodified context
between hunks is invisible. Add a per-file "Expand all lines" toggle so
the reader can pull in the full file when the surrounding code matters.

Backend:
- Migrate `repo.SingleDownload` to a new Flamego `getRepoRaw` handler.
  Same URL shape (`/{owner}/{name}/raw/{ref}/{path}`) so external
  consumers (`curl`, scripts) keep working. Bridged from the Macaron
  router via `flamegoBridger` so the legacy path doesn't double-route
  through `RepoRef` middleware. The ref segment accepts a branch, tag,
  or commit SHA; commit SHAs match first (the common case from the
  React diff page).
- Delete `repo.SingleDownload` and the legacy `m.Get("/raw/*", ...)`
  Macaron handler. `repo.ServeBlob` stays because `internal/route/api/v1`
  still uses it for the public REST API.

Frontend:
- Add an `UnfoldVertical` icon button to each file header. Click fetches
  the pre + post file contents in parallel via the legacy raw URL,
  calls `parseDiffFromFile` to upgrade the `FileDiffMetadata` to
  `isPartial: false`, and stores the result keyed by item id.
- The `items` useMemo swaps in the upgraded `fileDiff` when present and
  bumps the item `version` so Pierre's `CodeView` re-renders that file.
  Set `expandUnchanged: true` globally so non-partial files immediately
  render all context lines.
- Show a spinner during fetch, hide the button once expansion succeeds.
  Skip the button for added/deleted files (no opposite side to expand).
- Added/deleted files preserve the old behaviour (no expansion).
2026-05-27 03:51:16 -04:00
unknwon c535b64bb9 web: wire commit diff page to real data with TanStack Query
Migrate the React commit diff page off of mocked repo metadata and onto
live web API endpoints, and take over the legacy `/owner/repo/commit/{sha}`
URL so the React page is the canonical commit view.

Backend:
- Split `webapi.go` into `webapi.go` (shared infra), `webapi_user.go`
  (user handlers), and `webapi_repo.go` (repo handlers).
- Add `GET /api/web/{owner}/{name}/info` returning repo header data
  (avatar, visibility, counts, mirror, viewer state). Mirrors legacy
  `RepoAssignment` access logic: admin shortcut + partial-public masking.
- Add `GET /api/web/{owner}/{name}/commit/{sha}` returning commit
  metadata only. Patch text lives on the existing `.diff` URL so it
  avoids JSON-string escaping and caches independently.
- Migrate `repo.RawDiff` to Flamego `getRepoCommitRawDiff`. Now supports
  `?whitespace=` for the React diff toggle. Public URL unchanged.
- Add `POST/DELETE /api/web/{owner}/{name}/watch` and `.../star` returning
  the new viewer state + count so the client can update without refetch.
- Delete legacy `repo.Diff` and `repo.DiffJSON`. Add a SPA pass-through
  Macaron route at `/owner/repo/commit/{sha}` with the legacy
  `[a-f0-9]{7,40}` SHA regex.

Frontend:
- Install `@tanstack/react-query` and wire `QueryClientProvider` in
  `router.tsx`. Pass `queryClient` through router context so loaders can
  prefetch via `ensureQueryData`.
- Add `lib/queries/repo.ts` with `repoInfoQuery` + watch/star mutations.
- Move `CommitDiff.tsx` → `pages/repo/Commit.tsx` and `CommitDiff.search.ts`
  → `pages/repo/Commit.search.ts`. Rename `CommitDiff` → `RepoCommit`,
  `CommitDiffPage` → `RepoCommitPage`, etc.
- Change route from `/$owner/$repo/_diff/$sha` to
  `/$owner/$repo/commit/$sha`. Enforce SHA regex via TanStack `params.parse`
  and convert API 404s to router `notFound()` so they render the NotFound
  page instead of ServerError.
- Loader fetches metadata + raw diff in parallel (plus repo info via
  Query cache), assembles them into `RepoCommitPage`.
- Replace `RepoHeader`'s `RepoHeaderRepo` interface with the live
  `RepoInfo` type. Watch/Star buttons fire `useMutation` with optimistic
  cache updates via `setQueryData`. Anonymous users see sign-in links.
- Swap the "Public"/"Private" pill for a Globe/Lock icon with tooltip.
- Add a collapsible desktop file tree. The toolbar's "Showing N changed
  files" row owns a single toggle icon that opens the Sheet on mobile
  and toggles the persistent sidebar on desktop. State persists to
  localStorage.
- Hide the always-on "Verified" badge until commit signature
  verification lands.
2026-05-27 02:57:35 -04:00
Joe Chen c3577dc6fa 213 2026-05-26 13:18:29 -04:00
unknwon d7c3f16f7a web(diff): use PanelLeftOpen icon for mobile file-tree trigger 2026-05-26 12:02:25 -04:00
unknwon eb24142b83 web: polish commit diff page chrome and search UX
- DiffSearch: walk hunks by addition/deletionCount so matches on context
  lines and pure-deletion hunks are no longer dropped.
- DiffSearch: nudge popup up to top-1 so it sits closer to the toolbar.
- RepoHeader: add per-repo avatar slot (mocked to favicon for now),
  fold mobile tabs past the third into a hamburger overflow, swap
  Issues icon from Clock to CircleDot, nudge avatar down 2px to
  optically center the off-center favicon glyph.
- CommitDiff: render the authored timestamp as a relative string with
  RFC1123 tooltip (matches Gogs's TimeSince template helper); helper
  lives in web/src/lib/relative-time.ts.
- CommitDiff: inject GitHub-style yellow into Pierre's selected-line
  background overrides so search matches read clearly in both themes.
- AGENTS.md: note that chrome-devtools MCP should run headless.
2026-05-26 12:02:25 -04:00
unknwon dcad796c73 web: build out commit diff page on @pierre/diffs
Adds the full commit diff experience around the @pierre/diffs CodeView
and @pierre/trees FileTree spike from the prior commit:

- RepoHeader, DiffToolbar, FileHeaderMenu, ResizableSidebar components
  for the page chrome and per-file actions
- Sheet and Tooltip shadcn primitives
- CommitDiff.search.ts encodes diff toggles in the URL via TanStack
  Router validation so the view is shareable
- Sticky workspace lock that pins the toolbar plus tree plus diff to
  the viewport once the user scrolls past the commit metadata
- Whitespace mode wired through to git via the diff API's new
  whitespace query (ignore-all, ignore-change)
- Per-file collapse, status filter, unified/split toggle, wrap, expand
  all and collapse all
- New --color-success, --color-diff-added, --color-diff-removed
  tokens documented in DESIGN.md, replacing ad-hoc Tailwind palette
  references
2026-05-26 12:02:25 -04:00
Joe Chen 9b7d8ebd9d WIP: Pierre diff 2026-05-26 12:01:58 -04:00
ᴊᴏᴇ ᴄʜᴇɴ 878caa7378 ci: notarize macOS release archives (#8297) latest-commit-build 2026-05-24 23:08:45 -04:00
ᴊᴏᴇ ᴄʜᴇɴ adea243ee8 feat(web): migrate account activation page to React (#8296) 2026-05-24 22:35:41 -04:00
ᴊᴏᴇ ᴄʜᴇɴ 44f0222a71 web: migrate /user/sign-out to Flamego (#8294) 2026-05-24 11:16:57 -04:00
ᴊᴏᴇ ᴄʜᴇɴ 26483c41c6 feat(web): add React sign-up page with Flamego captcha (#8291) 2026-05-23 23:33:41 -04:00
dependabot[bot] 403db931cf mod: bump filippo.io/edwards25519 from 1.1.0 to 1.1.1 (#8292) 2026-05-23 22:25:56 -04:00
dependabot[bot] cd2f94a85b mod: bump github.com/redis/go-redis/v9 from 9.5.1 to 9.5.5 (#8293) 2026-05-23 22:25:41 -04:00
ᴊᴏᴇ ᴄʜᴇɴ 4935e7a63b web: move password reset to React (#8290) 2026-05-23 21:55:22 -04:00
ᴊᴏᴇ ᴄʜᴇɴ 71dfd3c7ac chore: fix up README image positions
[skip ci]
2026-05-22 16:31:17 -04:00
ᴊᴏᴇ ᴄʜᴇɴ ecb04beadd chore: align-center README images
[skip ci]
2026-05-22 16:28:22 -04:00
ᴊᴏᴇ ᴄʜᴇɴ 83a48c286d fix: remove forgeable remember-me cookie, persist sessions by default (#8289) 2026-05-22 16:24:39 -04:00
ᴊᴏᴇ ᴄʜᴇɴ f739682e9a Move sign-in MFA step to React with /api/web/user/mfa (#8288) 2026-05-22 15:33:06 -04:00
ᴊᴏᴇ ᴄʜᴇɴ d54f98f5a4 feat(web): adopt Pierre theme palette and reorder sign-in tab stops (#8287) 2026-05-22 11:19:38 -04:00
ᴊᴏᴇ ᴄʜᴇɴ e7d0cb646d Update README banner for dark mode (#8286) 2026-05-22 00:56:13 -04:00
ᴊᴏᴇ ᴄʜᴇɴ dd6be39208 feat: React-based sign-in page with /api/web/user/sign-in (#8285) 2026-05-22 00:28:27 -04:00
ᴊᴏᴇ ᴄʜᴇɴ c93373baec feat: add /api/web/user/sign-out and nest user info under /user/info (#8284) 2026-05-21 15:05:19 -04:00
ᴊᴏᴇ ᴄʜᴇɴ 90790b2966 Embed WebContext and add /api/web/user-info endpoint (#8282) 2026-05-21 14:43:09 -04:00
ᴊᴏᴇ ᴄʜᴇɴ e9310ea08f chore: remove Packager.io build support (#8281) 2026-05-20 22:55:08 -04:00