feat(desktop): bundled renderer, modules and instance accounts (#3254)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-07 16:48:07 +02:00
1 parent c748c8af4e
commit 7c5fa2180a
1275 files changed
+215074 -81246

No files matched your search

@@ -11,14 +11,14 @@ function normalizeDesktopHandoffCode(value: string): string {
return value.replace(DESKTOP_HANDOFF_CODE_SEPARATOR_PATTERN, '').toUpperCase();
}
function isDesktopHandoffCode(value: string): boolean {
export function isDesktopHandoffCode(value: string): boolean {
if (value.length !== DESKTOP_HANDOFF_CODE_LENGTH) {
return false;
}
return Array.from(value).every((character) => DESKTOP_HANDOFF_CODE_ALPHABET.includes(character));
}
function parseDesktopHandoffCodeInput(value: string): string {
export function parseDesktopHandoffCodeInput(value: string): string {
return normalizeDesktopHandoffCode(value).slice(0, DESKTOP_HANDOFF_CODE_LENGTH);
}
@@ -90,8 +90,10 @@ export const InstanceEndpointsSchema = z
api_public: z.string().describe('Base URL for public API requests'),
gateway: z.string().describe('WebSocket URL for the gateway'),
media: z.string().describe('Base URL for the media proxy'),
upload_relay: z.string().optional().describe('Base URL for proxied attachment and preview uploads'),
static_cdn: z.string().describe('Base URL for static assets (avatars, emojis, etc.)'),
marketing: z.string().describe('Base URL for the marketing website'),
docs: z.string().optional().describe('Base URL for the documentation website'),
admin: z.string().describe('Base URL for the admin panel'),
invite: z.string().describe('Base URL for invite links'),
gift: z.string().describe('Base URL for gift links'),
@@ -137,6 +139,21 @@ export const InstanceFeaturesSchema = z
presigned_attachment_uploads: z.boolean().describe('Whether clients can request presigned attachment upload URLs'),
emails_enabled: z.boolean().describe('Whether the instance sends emails (verification, password reset, etc.)'),
phone_verification_enabled: z.boolean().describe('Deprecated. Always false.'),
desktop_modules_enabled: z.boolean().optional().describe('Whether desktop clients may load downloadable modules'),
account_deletion_grace_period_hours: z
.number()
.int()
.min(1)
.max(8760)
.optional()
.describe('Hours between a deletion request and the permanent deletion of the account'),
max_background_gateway_connections: z
.number()
.int()
.min(0)
.max(64)
.optional()
.describe('Maximum gateway connections a client may keep open for background accounts'),
account_identity: AccountIdentityModeSchema.optional().describe(
'How people sign in on this instance. Clients treat a missing value as email',
),
@@ -156,7 +173,9 @@ export const InstanceGifSchema = z
.describe('GIF provider configuration for clients');
export type InstanceGif = z.infer<typeof InstanceGifSchema>;
export const InstanceSsoSchema = SsoStatusResponse.describe('Single sign-on configuration');
export const InstanceSsoSchema = SsoStatusResponse.extend({
available: z.boolean().optional().describe('Whether an SSO provider is configured for this instance'),
}).describe('Single sign-on configuration');
export type InstanceSso = z.infer<typeof InstanceSsoSchema>;
export const InstanceRegistrationModeSchema = createNamedStringLiteralUnion(
@@ -206,14 +225,49 @@ export const InstanceServicesSchema = z
.describe('Optional third-party service integrations enabled for this instance');
export type InstanceServices = z.infer<typeof InstanceServicesSchema>;
export const InstancePushDeliveryModeSchema = z.enum(['direct', 'external_relay', 'hybrid']);
export type InstancePushDeliveryMode = z.infer<typeof InstancePushDeliveryModeSchema>;
export const InstancePushSchema = z
.object({
public_vapid_key: z.string().nullable().describe('VAPID public key for web push notifications'),
delivery_mode: InstancePushDeliveryModeSchema.optional().describe('How push notifications reach devices'),
event_resolution_path: z
.string()
.optional()
.describe('API path clients call to resolve the payload of a push event'),
external_relay_url: z.string().nullable().optional().describe('URL of the external push relay, if any'),
relay_signing_key_hashes: z
.array(z.string())
.nullable()
.optional()
.describe('Hashes of the keys the external push relay signs with'),
})
.describe('Push notification configuration');
export type InstancePush = z.infer<typeof InstancePushSchema>;
export const InstanceAgePolicyActionSchema = z.enum(['restrict', 'block']);
export type InstanceAgePolicyAction = z.infer<typeof InstanceAgePolicyActionSchema>;
export const InstanceAgePolicyGeoSchema = z
.object({
country_code: z.string().describe('ISO 3166-1 alpha-2 country code'),
region_code: z.string().nullable().describe('ISO 3166-2 subdivision code, or null for the whole country'),
action: InstanceAgePolicyActionSchema.describe('Whether the region restricts or blocks access'),
card_verification_available: z.boolean().describe('Whether card age verification is available in the region'),
})
.describe('Age policy for one region');
export type InstanceAgePolicyGeo = z.infer<typeof InstanceAgePolicyGeoSchema>;
export const InstanceAgePolicySchema = z
.object({
geos: z.array(InstanceAgePolicyGeoSchema).describe('Regions with an age policy'),
})
.describe('Regional age policy for this instance');
export type InstanceAgePolicy = z.infer<typeof InstanceAgePolicySchema>;
export const WellKnownFluxerResponse = z.object({
codename: z.string().optional().describe('Protocol generation spoken by this instance'),
api_code_version: z.number().int().describe('Version of the API server code'),
endpoints: InstanceEndpointsSchema,
captcha: InstanceCaptchaSchema,
@@ -226,6 +280,7 @@ export const WellKnownFluxerResponse = z.object({
limits: LimitConfigResponse.describe('Limit configuration with rules and trait definitions'),
push: InstancePushSchema,
app_public: InstanceAppPublicSchema.describe('Public application configuration for client-side features'),
age_policy: InstanceAgePolicySchema.optional().describe('Regional age policy for this instance'),
domain_migration: DomainMigrationDiscoveryResponse.optional().describe(
'Web domain migration switch and anonymous rollout, only acted on by official instance clients',
),