Files
ThreadNet-Web/modules/restricted-guests/src/config.ts
T
Michael TelatynskiGitHubCopilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
44c540eca0 Tweak modules to be disabled if config is missing (#33806)
* Consolidate modules vitest coverage

* Use vite-common as base for modules vitest config

* Make knip happier

* Fix coverage paths

* Place modules unit tests alongside src

* Switch to defineProject for better type safety

* Consolidate vitest CI & coverage

Kills off vite-common

* Update comment

* Update lockfile

* Fix shared-components vitest config

* Soften eslint config for tests in modules

* Run eslint on modules/playwright dir too

* Make tsc happy

* Tweak modules to be disabled if config is missing

* Restore blank line

* Improve coverage

* Potential fix for pull request finding 'Unused variable, import, function or class'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-06-16 08:41:40 +00:00

48 lines
1.4 KiB
TypeScript

/*
Copyright 2025 New Vector Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import { z, type ZodMiniType, type input } from "zod/mini";
z.config(z.locales.en());
export const ModuleConfig = z.object({
/**
* The URL of the homeserver where the guest users should be registered. This
* must have the `synapse-restricted-guests-module` installed.
* @example `https://synapse.local`
*/
guest_user_homeserver_url: z.url(),
/**
* The username prefix that identifies guest users.
* @defaultValue `@guest-`
*/
guest_user_prefix: z._default(z.string().check(z.regex(/@[a-zA-Z-_1-9]+/)), "@guest-"),
/**
* If true, the user will be forwarded to the login page instead of to the SSO
* login. This is only required if the home server has no SSO support.
* @defaultValue `false`
*/
skip_single_sign_on: z._default(z.boolean(), false),
});
export type ModuleConfig = z.infer<typeof ModuleConfig>;
type ConfigSchema = ZodMiniType<z.output<typeof ModuleConfig>, z.input<typeof ModuleConfig>>;
export const CONFIG_KEY = "io.element.element-web-modules.restricted-guests";
declare module "@element-hq/element-web-module-api" {
export interface Config {
[CONFIG_KEY]?: input<ConfigSchema>;
sso_redirect_options?: {
immediate?: boolean; // incompatible option
};
}
}