diff --git a/web/src/features/repos/ui/ReposPage.tsx b/web/src/features/repos/ui/ReposPage.tsx
index 8b77383..e492bed 100644
--- a/web/src/features/repos/ui/ReposPage.tsx
+++ b/web/src/features/repos/ui/ReposPage.tsx
@@ -13,6 +13,17 @@ import { RepoListItem } from "./RepoListItem";
type SortOrder = "newest" | "oldest" | "name";
+function isRelayAuthenticationError(error: unknown): boolean {
+ if (!(error instanceof Error)) return false;
+
+ const message = error.message.toLowerCase();
+ return (
+ message.startsWith("auth-required") ||
+ message.includes("not a relay member") ||
+ message.includes("membership required")
+ );
+}
+
function ListItemSkeleton() {
return (
@@ -102,8 +113,7 @@ export function ReposPage() {
const isLoading = preview ? false : isLoadingRepos;
const [search, setSearch] = useState("");
const [sort, setSort] = useState("newest");
- const authRequired =
- error instanceof Error && error.message.startsWith("auth-required");
+ const authRequired = isRelayAuthenticationError(error);
useEffect(() => {
if (error && !authRequired) {
diff --git a/web/tests/e2e/smoke.spec.ts b/web/tests/e2e/smoke.spec.ts
index 0ad9460..316434e 100644
--- a/web/tests/e2e/smoke.spec.ts
+++ b/web/tests/e2e/smoke.spec.ts
@@ -13,6 +13,29 @@ test("home page shows repositories section", async ({ page }) => {
await expect(page.getByText("代码仓库")).toBeVisible();
});
+test("shows member authentication instead of an empty community", async ({
+ page,
+}) => {
+ await page.routeWebSocket(/\/buzz\/?$/, (webSocket) => {
+ webSocket.onMessage((message) => {
+ const request = JSON.parse(String(message)) as unknown[];
+ if (request[0] === "REQ" && typeof request[1] === "string") {
+ webSocket.send(
+ JSON.stringify([
+ "CLOSED",
+ request[1],
+ "restricted: not a relay member",
+ ]),
+ );
+ }
+ });
+ });
+
+ await page.goto("./");
+ await expect(page.getByText("登录后才能查看代码仓库")).toBeVisible();
+ await expect(page.getByText("这个社区还是空的")).not.toBeVisible();
+});
+
test("defaults to Simplified Chinese and persists the selected locale", async ({
page,
}) => {