mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-21 14:20:42 +08:00
Repos need not carry a `xyz.radicle.project` payload; the default branch can come from `xyz.radicle.crefs` alone. Such repos got no counts and no default branch, and failed schema validation in explorer, which broke the parse of a whole listing. httpd: - Add top-level `cobs` with issue, patch and bucketed release counts - Add top-level `defaultBranch`, qualified like the crefs payload - Omit a count the node cannot determine instead of reporting zero - Drop `head`: the tip is `refs[defaultBranch]` - Keep counts in the project payload for older clients until a major release - Keep the project payload when a COB read fails - Keep `meta.releases` a single count: delegate + other - Log and skip canonical ref rules and refs that fail to read, so one bad ref doesn't drop the default branch tip explorer: - Model `cobs` and `defaultBranch`, adapting older nodes to one shape - Resolve the default branch from the crefs HEAD on older nodes - Collect the shims for older httpd in http-client/lib/compat.ts, each naming the httpd release that the client can drop it with - Add `defaultBranchTip`, replacing `head`, with a fallback to the legacy `meta.head` - Make the project payload and its legacy meta optional - Fall back to the RID for the repo name, and show a placeholder for a missing name in repo cards and the header - Hide a counter instead of reading a missing count as zero - Fall back to a full-page check for "More" without counts - Add a `repo.sourceUnavailable` route for repos without a default branch or tip - Browse explicit revisions and offer the branch selector without a default branch - List these repos in repo grids and on the landing page - Say the node is older or built without releases - Scope release pages in the client, so views never call the shims - Read OG worker repos through the same compat shims - Share the repo name and default branch helpers with the OG worker CI: - Add check:open-graph, a wrangler deploy dry run - Run it in GitHub CI, Buildkite and check:ci - Install explorer's dependencies first: the worker resolves compat.ts imports, such as zod, from there Tests: - Test that a build without releases omits the count - Test that one failing rule keeps the others - Test the repo shape across httpd versions and the release shims - Test `hasMorePages` and `repoName` - Test repos without a project payload end to end
119 lines
4.5 KiB
Svelte
119 lines
4.5 KiB
Svelte
<script lang="ts">
|
|
import * as router from "@app/lib/router";
|
|
import { unreachable } from "@app/lib/utils";
|
|
|
|
import {
|
|
codeFont,
|
|
followSystemTheme,
|
|
loadTheme,
|
|
theme,
|
|
} from "@app/lib/appearance";
|
|
|
|
import FullscreenModalPortal from "./App/FullscreenModalPortal.svelte";
|
|
import Hotkeys from "./App/Hotkeys.svelte";
|
|
import LoadingBar from "./App/LoadingBar.svelte";
|
|
|
|
import Commit from "@app/views/repos/Commit.svelte";
|
|
import Explore from "@app/views/explore/View.svelte";
|
|
import ExploreRepos from "@app/views/explore/ReposView.svelte";
|
|
import History from "@app/views/repos/History.svelte";
|
|
import Issue from "@app/views/repos/Issue.svelte";
|
|
import Issues from "@app/views/repos/Issues.svelte";
|
|
import Marketing from "@app/marketing/Marketing.svelte";
|
|
import Nodes from "@app/views/nodes/View.svelte";
|
|
import NotFound from "@app/views/NotFound.svelte";
|
|
import Patch from "@app/views/repos/Patch.svelte";
|
|
import Patches from "@app/views/repos/Patches.svelte";
|
|
import Release from "@app/views/repos/Release.svelte";
|
|
import Releases from "@app/views/repos/Releases.svelte";
|
|
import Source from "@app/views/repos/Source.svelte";
|
|
import SourceUnavailable from "@app/views/repos/SourceUnavailable.svelte";
|
|
import Users from "@app/views/users/View.svelte";
|
|
|
|
import Error from "@app/views/error/View.svelte";
|
|
import Loading from "@app/components/Loading.svelte";
|
|
|
|
const activeRouteStore = router.activeRouteStore;
|
|
|
|
window
|
|
.matchMedia("(prefers-color-scheme: dark)")
|
|
.addEventListener("change", ({ matches }) => {
|
|
if ($followSystemTheme) {
|
|
theme.set(matches ? "dark" : "light");
|
|
}
|
|
});
|
|
|
|
// Detect any change to the system theme on first load.
|
|
if ($followSystemTheme) {
|
|
theme.set(loadTheme());
|
|
}
|
|
|
|
void router.loadFromLocation();
|
|
|
|
$: document.documentElement.setAttribute("data-codefont", $codeFont);
|
|
$: document.documentElement.setAttribute("data-theme", $theme);
|
|
$: document.documentElement.setAttribute(
|
|
"data-repo-view",
|
|
$activeRouteStore.resource.startsWith("repo.") ? "true" : "false",
|
|
);
|
|
</script>
|
|
|
|
<style>
|
|
.loading {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
height: 100%;
|
|
align-items: center;
|
|
}
|
|
</style>
|
|
|
|
{#if $activeRouteStore.resource !== "booting"}
|
|
<LoadingBar />
|
|
{/if}
|
|
|
|
<FullscreenModalPortal />
|
|
<Hotkeys />
|
|
|
|
{#if $activeRouteStore.resource === "booting"}
|
|
<div class="loading" role="progressbar" aria-label="App loading">
|
|
<Loading />
|
|
</div>
|
|
{:else if $activeRouteStore.resource === "nodes"}
|
|
<Nodes {...$activeRouteStore.params} />
|
|
{:else if $activeRouteStore.resource === "explore"}
|
|
<Explore {...$activeRouteStore.params} />
|
|
{:else if $activeRouteStore.resource === "explore.repos"}
|
|
<ExploreRepos {...$activeRouteStore.params} />
|
|
{:else if $activeRouteStore.resource === "landing" || $activeRouteStore.resource === "learn" || $activeRouteStore.resource === "install" || $activeRouteStore.resource === "guides" || $activeRouteStore.resource === "desktop" || $activeRouteStore.resource === "cli" || $activeRouteStore.resource === "principles" || $activeRouteStore.resource === "docs"}
|
|
<Marketing route={$activeRouteStore} />
|
|
{:else if $activeRouteStore.resource === "users"}
|
|
<Users {...$activeRouteStore.params} />
|
|
{:else if $activeRouteStore.resource === "repo.source"}
|
|
<Source {...$activeRouteStore.params} />
|
|
{:else if $activeRouteStore.resource === "repo.sourceUnavailable"}
|
|
<SourceUnavailable {...$activeRouteStore.params} />
|
|
{:else if $activeRouteStore.resource === "repo.history"}
|
|
<History {...$activeRouteStore.params} />
|
|
{:else if $activeRouteStore.resource === "repo.commit"}
|
|
<Commit {...$activeRouteStore.params} />
|
|
{:else if $activeRouteStore.resource === "repo.issues"}
|
|
<Issues {...$activeRouteStore.params} />
|
|
{:else if $activeRouteStore.resource === "repo.issue"}
|
|
<Issue {...$activeRouteStore.params} />
|
|
{:else if $activeRouteStore.resource === "repo.patches"}
|
|
<Patches {...$activeRouteStore.params} />
|
|
{:else if $activeRouteStore.resource === "repo.patch"}
|
|
<Patch {...$activeRouteStore.params} />
|
|
{:else if $activeRouteStore.resource === "repo.releases"}
|
|
<Releases {...$activeRouteStore.params} />
|
|
{:else if $activeRouteStore.resource === "repo.release"}
|
|
<Release {...$activeRouteStore.params} />
|
|
{:else if $activeRouteStore.resource === "error"}
|
|
<Error {...$activeRouteStore.params} />
|
|
{:else if $activeRouteStore.resource === "notFound"}
|
|
<NotFound {...$activeRouteStore.params} />
|
|
{:else}
|
|
{unreachable($activeRouteStore)}
|
|
{/if}
|