v4: a deployment chooses which ways federated sign-in goes — every instance took users of the others and let its own sign in to them, with no way to turn either off. GERBEUR_FEDERATION_INCOMING=0 keeps users of other instances out: the login and register pages offer no other instance, /manage no list of instances, their sign-ins are refused, and those already in are signed out until it is on again, their homes' events still applied meanwhile. GERBEUR_FEDERATION_OUTGOING=0 keeps the instance's users from signing in elsewhere: its /authorize page lets no instance sign them in, its metadata says so (gerbeur_outgoing), which other instances check before sending anyone there, the settings page lists no instances, and at startup every grant is withdrawn, which signs them out there. Both are on by default and reach the client through index.html. The dev instance gerbeur (:3000) takes no users of the others, while its own still sign in to them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,18 +16,20 @@ import { PageHeader } from "../components/layout/PageHeader.tsx";
|
||||
import { PageGroup } from "../components/layout/PageGroup.tsx";
|
||||
import { CategoryManager } from "../components/category/CategoryManager.tsx";
|
||||
import { PeerManager } from "../components/federation/PeerManager.tsx";
|
||||
import { FEDERATION_INCOMING } from "../config/instance.ts";
|
||||
import { NotFound } from "./NotFound.tsx";
|
||||
|
||||
/**
|
||||
* Renders the category manager and the instances the site trusts or blocks,
|
||||
* each to those who hold its permission, which the API checks again; without
|
||||
* each to those who hold its permission, which the API checks again, the
|
||||
* instances only while users of other instances may sign in here; without
|
||||
* either, the page isn't found.
|
||||
*/
|
||||
export function Manage(): React.JSX.Element {
|
||||
useDocumentTitle(t`Manage`);
|
||||
const { user } = useRequiredAuth();
|
||||
const categories = can(user, "category:manage");
|
||||
const instances = can(user, "federation:manage");
|
||||
const instances = FEDERATION_INCOMING && can(user, "federation:manage");
|
||||
if (!categories && !instances) return <NotFound />;
|
||||
return (
|
||||
<PageShell narrow>
|
||||
|
||||
@@ -20,7 +20,7 @@ import { useSoundsEnabled } from "../hooks/shared/useSoundsEnabled.ts";
|
||||
import { useSettings } from "../hooks/auth/useSettings.ts";
|
||||
import { useRequiredAuth } from "../hooks/auth/useAuth.ts";
|
||||
import { useDocumentTitle } from "../hooks/shared/useDocumentTitle.ts";
|
||||
import { EMAIL_ENABLED } from "../config/instance.ts";
|
||||
import { EMAIL_ENABLED, FEDERATION_OUTGOING } from "../config/instance.ts";
|
||||
import { previewChime } from "../utils/shared/sound.ts";
|
||||
import { PageShell } from "../components/layout/PageShell.tsx";
|
||||
import { PageHeader } from "../components/layout/PageHeader.tsx";
|
||||
@@ -66,7 +66,7 @@ const ON_OFF_OPTIONS: SegmentedOption<boolean>[] = [
|
||||
* Renders `/settings`, signed in only: the username, which only a moderator
|
||||
* changes (`ProfileManageTab`), the password change, which opens
|
||||
* {@link ChangePasswordModal}, the other instances the account signs in to
|
||||
* ({@link GrantList}), and the settings, each saved as soon as it is
|
||||
* ({@link GrantList}) unless it may sign in to none, and the settings, each saved as soon as it is
|
||||
* clicked. An account from another instance changes its password there. The style, color scheme and digests are saved to the account; the
|
||||
* default feed tab and sounds, for now, to this browser.
|
||||
*/
|
||||
@@ -124,7 +124,7 @@ export function Settings(): React.JSX.Element {
|
||||
</p>
|
||||
)}
|
||||
</PageGroup>
|
||||
{!home && (
|
||||
{!home && FEDERATION_OUTGOING && (
|
||||
<PageGroup label={<Trans>Other instances</Trans>}>
|
||||
<div className="page-card">
|
||||
<GrantList />
|
||||
|
||||
@@ -24,6 +24,7 @@ import { SubmitButton } from "../components/form/SubmitButton.tsx";
|
||||
import { TextField } from "../components/form/TextField.tsx";
|
||||
import { useApiForm } from "../hooks/form/useApiForm.ts";
|
||||
import { FederatedSignIn } from "../components/federation/FederatedSignIn.tsx";
|
||||
import { FEDERATION_INCOMING } from "../config/instance.ts";
|
||||
import { nextPath } from "../utils/auth/next.ts";
|
||||
|
||||
interface LoginValues {
|
||||
@@ -38,7 +39,8 @@ interface ResetValues {
|
||||
/**
|
||||
* Renders `/login`, for the signed out. A sign-in lands on the page `?next=`
|
||||
* names, or `/`, and "Forgot password?" unfolds the reset request form below.
|
||||
* Users of another instance sign in through {@link FederatedSignIn}.
|
||||
* Users of another instance sign in through {@link FederatedSignIn}, unless
|
||||
* the instance takes none.
|
||||
*/
|
||||
export function UserLogin(): React.JSX.Element {
|
||||
useDocumentTitle(t`Log in`);
|
||||
@@ -104,7 +106,7 @@ export function UserLogin(): React.JSX.Element {
|
||||
|
||||
{showReset && <ResetRequestPanel />}
|
||||
|
||||
<FederatedSignIn />
|
||||
{FEDERATION_INCOMING && <FederatedSignIn />}
|
||||
|
||||
<p className="auth-card-footer">
|
||||
<Trans>This is a mirage.</Trans>
|
||||
|
||||
@@ -26,6 +26,7 @@ import { SubmitButton } from "../components/form/SubmitButton.tsx";
|
||||
import { TextField } from "../components/form/TextField.tsx";
|
||||
import { useApiForm } from "../hooks/form/useApiForm.ts";
|
||||
import { FederatedSignIn } from "../components/federation/FederatedSignIn.tsx";
|
||||
import { FEDERATION_INCOMING } from "../config/instance.ts";
|
||||
|
||||
type TokenState =
|
||||
| { status: "checking" }
|
||||
@@ -41,7 +42,8 @@ interface Values {
|
||||
/**
|
||||
* Renders `/register?token=`, for the signed out. It checks the invite before
|
||||
* showing the form, and signs the new user in on success. A user of another
|
||||
* instance joins with that account instead, through {@link FederatedSignIn}.
|
||||
* instance joins with that account instead, through {@link FederatedSignIn},
|
||||
* unless the instance takes none.
|
||||
*/
|
||||
export function UserRegister(): React.JSX.Element {
|
||||
useDocumentTitle(t`Register`);
|
||||
@@ -173,7 +175,7 @@ export function UserRegister(): React.JSX.Element {
|
||||
</form>
|
||||
</FormProvider>
|
||||
|
||||
<FederatedSignIn inviteToken={token} />
|
||||
{FEDERATION_INCOMING && <FederatedSignIn inviteToken={token} />}
|
||||
|
||||
<p className="auth-card-footer">
|
||||
<Trans>
|
||||
|
||||
Reference in New Issue
Block a user