Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

feat: self-hosted premium page color and card images (#3844)

Hampus0ffc8a7ba6a8
diff --git a/fluxer_admin/openapi-admin.json b/fluxer_admin/openapi-admin.json
index 38896e99c..109d1cdd1 100644
--- a/fluxer_admin/openapi-admin.json
+++ b/fluxer_admin/openapi-admin.json
@@ -5682,7 +5682,7 @@
"content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}
}
},
- "description": "Uploads a branding image served by the media proxy and stores its URL, or clears it when no image is provided. Requires INSTANCE_CONFIG_UPDATE permission.",
+ "description": "Uploads a branding image served by the media proxy and stores its URL, or clears it when no image is provided. The favicon_dark, sign_in_backdrop and premium_showcase_* kinds are only available on self-hosted instances. Requires INSTANCE_CONFIG_UPDATE permission.",
"security": [{"adminApiKey": []}],
"requestBody": {
"required": true,
@@ -18007,6 +18007,11 @@
"premium_product_name": {"type": "string"},
"premium_info_url": {"nullable": true, "type": "string"},
"sign_in_backdrop_url": {"nullable": true, "type": "string"},
+ "premium_page_color": {"nullable": true, "type": "string"},
+ "premium_showcase_expressions_url": {"nullable": true, "type": "string"},
+ "premium_showcase_profile_url": {"nullable": true, "type": "string"},
+ "premium_showcase_stream_url": {"nullable": true, "type": "string"},
+ "premium_showcase_upload_url": {"nullable": true, "type": "string"},
"custom_css": {"nullable": true, "type": "string"},
"upload_limit_message": {"nullable": true, "type": "string"},
"trusted_domains": {"type": "array", "items": {"type": "string"}}
@@ -18025,6 +18030,11 @@
"premium_product_name",
"premium_info_url",
"sign_in_backdrop_url",
+ "premium_page_color",
+ "premium_showcase_expressions_url",
+ "premium_showcase_profile_url",
+ "premium_showcase_stream_url",
+ "premium_showcase_upload_url",
"custom_css",
"upload_limit_message",
"trusted_domains"
@@ -18561,7 +18571,19 @@
"properties": {
"kind": {
"type": "string",
- "enum": ["icon", "symbol", "logo", "wordmark", "favicon", "favicon_dark", "sign_in_backdrop"]
+ "enum": [
+ "icon",
+ "symbol",
+ "logo",
+ "wordmark",
+ "favicon",
+ "favicon_dark",
+ "sign_in_backdrop",
+ "premium_showcase_expressions",
+ "premium_showcase_profile",
+ "premium_showcase_stream",
+ "premium_showcase_upload"
+ ]
},
"image": {"nullable": true, "type": "string", "maxLength": 16000000}
},
@@ -18685,6 +18707,11 @@
"premium_product_name": {"nullable": true, "type": "string", "minLength": 1, "maxLength": 40},
"premium_info_url": {"nullable": true, "type": "string", "maxLength": 2048},
"sign_in_backdrop_url": {"nullable": true, "type": "string", "maxLength": 2048},
+ "premium_page_color": {
+ "nullable": true,
+ "type": "string",
+ "pattern": "^(?:#?(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}))?$"
+ },
"custom_css": {"nullable": true, "type": "string", "maxLength": 32768},
"upload_limit_message": {"nullable": true, "type": "string", "maxLength": 500},
"trusted_domains": {
diff --git a/fluxer_admin/src/api/types/instance_config.rs b/fluxer_admin/src/api/types/instance_config.rs
index 885d517cb..fca921073 100644
--- a/fluxer_admin/src/api/types/instance_config.rs
+++ b/fluxer_admin/src/api/types/instance_config.rs
@@ -463,6 +463,16 @@ pub struct AppBrandingConfigResponse {
pub premium_product_name: String,
pub premium_info_url: Option<String>,
pub sign_in_backdrop_url: Option<String>,
+ #[serde(default)]
+ pub premium_page_color: Option<String>,
+ #[serde(default)]
+ pub premium_showcase_expressions_url: Option<String>,
+ #[serde(default)]
+ pub premium_showcase_profile_url: Option<String>,
+ #[serde(default)]
+ pub premium_showcase_stream_url: Option<String>,
+ #[serde(default)]
+ pub premium_showcase_upload_url: Option<String>,
pub custom_css: Option<String>,
#[serde(default)]
pub upload_limit_message: Option<String>,
@@ -486,6 +496,11 @@ impl Default for AppBrandingConfigResponse {
premium_product_name: default_premium_product_name(),
premium_info_url: None,
sign_in_backdrop_url: None,
+ premium_page_color: None,
+ premium_showcase_expressions_url: None,
+ premium_showcase_profile_url: None,
+ premium_showcase_stream_url: None,
+ premium_showcase_upload_url: None,
custom_css: None,
upload_limit_message: None,
trusted_domains: Vec::new(),
@@ -873,6 +888,9 @@ pub const BRANDING_ASSET_ACCEPT: &str = ".png,.jpeg,.webp,.gif,.apng,.avif,.heic
image/png,image/jpeg,image/webp,image/gif,image/apng,image/avif,image/heic,image/heif,\
image/jxl,image/svg+xml";
+pub const BRANDING_BACKDROP_ACCEPT: &str =
+ ".png,.jpg,.jpeg,.webp,.avif,image/png,image/jpeg,image/webp,image/avif";
+
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum BrandingAssetKind {
@@ -883,10 +901,14 @@ pub enum BrandingAssetKind {
Favicon,
FaviconDark,
SignInBackdrop,
+ PremiumShowcaseExpressions,
+ PremiumShowcaseProfile,
+ PremiumShowcaseStream,
+ PremiumShowcaseUpload,
}
impl BrandingAssetKind {
- pub const ALL: [Self; 7] = [
+ pub const ALL: [Self; 11] = [
Self::Icon,
Self::Symbol,
Self::Logo,
@@ -894,6 +916,17 @@ impl BrandingAssetKind {
Self::Favicon,
Self::FaviconDark,
Self::SignInBackdrop,
+ Self::PremiumShowcaseExpressions,
+ Self::PremiumShowcaseProfile,
+ Self::PremiumShowcaseStream,
+ Self::PremiumShowcaseUpload,
+ ];
+
+ pub const PREMIUM_SHOWCASE: [Self; 4] = [
+ Self::PremiumShowcaseExpressions,
+ Self::PremiumShowcaseProfile,
+ Self::PremiumShowcaseStream,
+ Self::PremiumShowcaseUpload,
];
pub fn as_str(self) -> &'static str {
@@ -905,6 +938,10 @@ impl BrandingAssetKind {
Self::Favicon => "favicon",
Self::FaviconDark => "favicon_dark",
Self::SignInBackdrop => "sign_in_backdrop",
+ Self::PremiumShowcaseExpressions => "premium_showcase_expressions",
+ Self::PremiumShowcaseProfile => "premium_showcase_profile",
+ Self::PremiumShowcaseStream => "premium_showcase_stream",
+ Self::PremiumShowcaseUpload => "premium_showcase_upload",
}
}
@@ -921,6 +958,10 @@ impl BrandingAssetKind {
Self::Favicon => "Favicon",
Self::FaviconDark => "Dark mode favicon",
Self::SignInBackdrop => "Sign-in background",
+ Self::PremiumShowcaseExpressions => "Emoji card image",
+ Self::PremiumShowcaseProfile => "Profile card image",
+ Self::PremiumShowcaseStream => "Stream card image",
+ Self::PremiumShowcaseUpload => "Upload card image",
}
}
@@ -933,8 +974,22 @@ impl BrandingAssetKind {
Self::Favicon => branding.favicon_url.as_deref(),
Self::FaviconDark => branding.favicon_dark_url.as_deref(),
Self::SignInBackdrop => branding.sign_in_backdrop_url.as_deref(),
+ Self::PremiumShowcaseExpressions => {
+ branding.premium_showcase_expressions_url.as_deref()
+ }
+ Self::PremiumShowcaseProfile => branding.premium_showcase_profile_url.as_deref(),
+ Self::PremiumShowcaseStream => branding.premium_showcase_stream_url.as_deref(),
+ Self::PremiumShowcaseUpload => branding.premium_showcase_upload_url.as_deref(),
}
}
+
+ pub fn is_premium_showcase(self) -> bool {
+ Self::PREMIUM_SHOWCASE.contains(&self)
+ }
+
+ pub fn is_photo(self) -> bool {
+ self == Self::SignInBackdrop || self.is_premium_showcase()
+ }
}
#[derive(Clone, Debug, Serialize)]
@@ -1169,6 +1224,8 @@ pub struct AppBrandingConfigUpdateRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub sign_in_backdrop_url: Option<Option<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
+ pub premium_page_color: Option<Option<String>>,
+ #[serde(skip_serializing_if = "Option::is_none")]
pub custom_css: Option<Option<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub upload_limit_message: Option<Option<String>>,
diff --git a/fluxer_admin/src/routes/system_actions/app_public.rs b/fluxer_admin/src/routes/system_actions/app_public.rs
index 7baf3a28e..395a34ee2 100644
--- a/fluxer_admin/src/routes/system_actions/app_public.rs
+++ b/fluxer_admin/src/routes/system_actions/app_public.rs
@@ -56,6 +56,9 @@ pub(super) fn build_app_public_update(
sign_in_backdrop_url: form
.contains_key("app_sign_in_backdrop_url")
.then(|| form.clean("app_sign_in_backdrop_url")),
+ premium_page_color: form
+ .contains_key("app_premium_page_color")
+ .then(|| form.clean("app_premium_page_color")),
custom_css,
upload_limit_message: form
.contains_key(UPLOAD_LIMIT_MESSAGE_FIELD)
diff --git a/fluxer_admin/src/templates/pages/instance_billing.rs b/fluxer_admin/src/templates/pages/instance_billing.rs
index 9adde82dd..d775670fa 100644
--- a/fluxer_admin/src/templates/pages/instance_billing.rs
+++ b/fluxer_admin/src/templates/pages/instance_billing.rs
@@ -380,7 +380,8 @@ pub(crate) fn premium_billing_section(
}
p class="text-xs text-neutral-500" {
"Clients show this name wherever the premium tier is mentioned. Clear it to use the default. \
- The info URL is an optional page that describes the tier."
+ The info URL is an optional page about the tier. The premium page and the premium badge on \
+ profiles link to it. The comparison chart on the premium page comes from your limit settings."
}
@if matches!(premium_mode, PremiumMode::Everyone) {
p class="text-sm text-amber-700" {
diff --git a/fluxer_admin/src/templates/pages/instance_branding.rs b/fluxer_admin/src/templates/pages/instance_branding.rs
index 491660613..127c70d7f 100644
--- a/fluxer_admin/src/templates/pages/instance_branding.rs
+++ b/fluxer_admin/src/templates/pages/instance_branding.rs
@@ -4,7 +4,7 @@ use crate::templates::pages::instance_config::ConfigForm;
use crate::{
api::types::{
AppPublicConfigResponse, BRANDING_ASSET_ACCEPT, BRANDING_ASSET_MAX_IMAGE_CHARS,
- BrandingAssetKind, CUSTOM_CSS_MAX_CHARS,
+ BRANDING_BACKDROP_ACCEPT, BrandingAssetKind, CUSTOM_CSS_MAX_CHARS,
},
config::AdminConfig,
templates::components::form::{
@@ -67,9 +67,27 @@ fn asset_guidance(kind: BrandingAssetKind) -> AssetGuidance {
help: "Browsers set to a dark theme show this instead of the favicon. Add one when your favicon is too dark to see on a dark tab. Use a square PNG, at least 64 by 64 pixels and up to 10 MB.",
empty: "If you leave it empty, the tab shows the same favicon in light and dark themes.",
},
+ BrandingAssetKind::PremiumShowcaseExpressions => AssetGuidance {
+ help: "Shows next to \"Your emojis, everywhere\" on the premium page. Use a JPEG, PNG, WebP or AVIF between 480 and 2400 pixels on each side, up to 4 MB. A landscape image around 1100 by 800 pixels fits best.",
+ empty: PREMIUM_SHOWCASE_EMPTY,
+ },
+ BrandingAssetKind::PremiumShowcaseProfile => AssetGuidance {
+ help: "Shows next to \"A profile that stands out\" on the premium page. Use a JPEG, PNG, WebP or AVIF between 480 and 2400 pixels on each side, up to 4 MB. A landscape image around 1100 by 800 pixels fits best.",
+ empty: PREMIUM_SHOWCASE_EMPTY,
+ },
+ BrandingAssetKind::PremiumShowcaseStream => AssetGuidance {
+ help: "Shows next to \"Stream in 4K at 60 FPS\" on the premium page. Use a JPEG, PNG, WebP or AVIF between 480 and 2400 pixels on each side, up to 4 MB. A landscape image around 1100 by 800 pixels fits best.",
+ empty: PREMIUM_SHOWCASE_EMPTY,
+ },
+ BrandingAssetKind::PremiumShowcaseUpload => AssetGuidance {
+ help: "Shows next to the card about file size limits on the premium page. Use a JPEG, PNG, WebP or AVIF between 480 and 2400 pixels on each side, up to 4 MB. A landscape image around 1100 by 800 pixels fits best.",
+ empty: PREMIUM_SHOWCASE_EMPTY,
+ },
}
}
+const PREMIUM_SHOWCASE_EMPTY: &str = "If you leave it empty, this card shows text only.";
+
pub(super) fn branding_section(
config: &AdminConfig,
config_form: ConfigForm<'_>,
@@ -113,6 +131,9 @@ pub(super) fn branding_section(
(branding_asset_field(config, kind, kind.url(&app_public.branding)))
}
}
+ @if config.self_hosted {
+ (premium_page_fields(config, app_public))
+ }
div class="flex flex-col gap-2 border-t border-neutral-200 pt-6" {
(custom_css_field(app_public.branding.custom_css.as_deref().unwrap_or("")))
p class="text-xs leading-5 text-neutral-500" {
@@ -190,6 +211,28 @@ pub(super) fn branding_section(
}
}
+fn premium_page_fields(config: &AdminConfig, app_public: &AppPublicConfigResponse) -> Markup {
+ html! {
+ div class="space-y-4 border-t border-neutral-200 pt-6" {
+ h3 class="text-sm font-semibold text-neutral-900" { "Premium page" }
+ div class="flex flex-col gap-2" {
+ (text_input(
+ "app_premium_page_color",
+ "Premium page color (hex)",
+ app_public.branding.premium_page_color.as_deref().unwrap_or(""),
+ "#4641d9",
+ ))
+ p class="text-xs leading-5 text-neutral-500" {
+ "Recolors the premium page with this hue. The page keeps its own light and dark shades, so a light color shows up darker than the one you enter. A gray color makes the page gray. Text keeps the same contrast as with the default colors, so it stays easy to read. Leave it empty to keep the default colors."
+ }
+ }
+ @for kind in BrandingAssetKind::PREMIUM_SHOWCASE {
+ (branding_asset_field(config, kind, kind.url(&app_public.branding)))
+ }
+ }
+ }
+}
+
fn custom_css_count_text(length: usize) -> String {
format!(
"{} of {} characters",
@@ -243,11 +286,16 @@ pub fn branding_asset_field(
Some(url) if config.shows_image(url) => UNLOADABLE_IMAGE_NOTE,
_ => UNPREVIEWABLE_IMAGE_NOTE,
};
- let thumbnail_class = if kind == BrandingAssetKind::SignInBackdrop {
+ let thumbnail_class = if kind.is_photo() {
"h-16 w-28"
} else {
"h-16 w-16"
};
+ let accept = if kind.is_photo() {
+ BRANDING_BACKDROP_ACCEPT
+ } else {
+ BRANDING_ASSET_ACCEPT
+ };
html! {
div id=(branding_asset_field_id(kind))
class="flex flex-col gap-3 rounded-lg border border-neutral-200 p-4"
@@ -263,14 +311,14 @@ pub fn branding_asset_field(
@if let Some(url) = url {
img src=(url) alt={(kind.label()) " preview"}
onerror=(THUMBNAIL_ONERROR)
- class={"max-h-full max-w-full " (if kind == BrandingAssetKind::SignInBackdrop { "h-full w-full object-cover" } else { "object-contain" })};
+ class={"max-h-full max-w-full " (if kind.is_photo() { "h-full w-full object-cover" } else { "object-contain" })};
span class="h-6 w-6 text-neutral-400" data-branding-asset-placeholder hidden {
(PreEscaped(IMAGE_PLACEHOLDER_SVG))
}
}
}
div class="flex flex-wrap items-center gap-2" {
- input type="file" accept=(BRANDING_ASSET_ACCEPT) class="hidden"
+ input type="file" accept=(accept) class="hidden"
data-branding-asset-file
aria-label={"Upload " (kind.label())};
button type="button" data-branding-asset-upload
@@ -292,7 +340,9 @@ pub fn branding_asset_field(
(failed_note)
}
}
- (text_input(&name, &format!("{} URL", kind.label()), url.unwrap_or(""), &placeholder))
+ @if !kind.is_premium_showcase() {
+ (text_input(&name, &format!("{} URL", kind.label()), url.unwrap_or(""), &placeholder))
+ }
}
}
}
diff --git a/fluxer_api/src/api/admin/controllers/InstanceConfigAdminController.ts b/fluxer_api/src/api/admin/controllers/InstanceConfigAdminController.ts
index a8211e608..e9662fce7 100644
--- a/fluxer_api/src/api/admin/controllers/InstanceConfigAdminController.ts
+++ b/fluxer_api/src/api/admin/controllers/InstanceConfigAdminController.ts
@@ -375,6 +375,7 @@ function assertSelfHostedBillingSections(data: InstanceConfigUpdateRequest): voi
'premium_product_name',
'premium_info_url',
'sign_in_backdrop_url',
+ 'premium_page_color',
'favicon_dark_url',
'custom_css',
'upload_limit_message',
@@ -804,6 +805,7 @@ const INSTANCE_CONFIG_SECTION_APPLIERS = {
premium_product_name: readOptionalField(appPublic.branding, 'premium_product_name'),
premium_info_url: readOptionalField(appPublic.branding, 'premium_info_url'),
sign_in_backdrop_url: readOptionalField(appPublic.branding, 'sign_in_backdrop_url'),
+ premium_page_color: readOptionalField(appPublic.branding, 'premium_page_color'),
custom_css: readOptionalField(appPublic.branding, 'custom_css'),
upload_limit_message: readOptionalField(appPublic.branding, 'upload_limit_message'),
trusted_domains: readTrustedDomains(appPublic.branding),
@@ -994,7 +996,7 @@ export function InstanceConfigAdminController(app: HonoApp) {
operationId: 'create_admin_instance_branding_asset',
summary: 'Upload an instance branding asset',
description:
- 'Uploads a branding image served by the media proxy and stores its URL, or clears it when no image is provided. Requires INSTANCE_CONFIG_UPDATE permission.',
+ 'Uploads a branding image served by the media proxy and stores its URL, or clears it when no image is provided. The favicon_dark, sign_in_backdrop and premium_showcase_* kinds are only available on self-hosted instances. Requires INSTANCE_CONFIG_UPDATE permission.',
responseSchema: InstanceConfigResponse,
statusCode: 200,
security: 'adminApiKey',
@@ -1002,7 +1004,8 @@ export function InstanceConfigAdminController(app: HonoApp) {
}),
async (ctx) => {
const {kind, image} = ctx.req.valid('json');
- const isBackdrop = kind === 'sign_in_backdrop';
+ const isPremiumShowcase = kind.startsWith('premium_showcase_');
+ const isBackdrop = kind === 'sign_in_backdrop' || isPremiumShowcase;
if ((isBackdrop || kind === 'favicon_dark') && !Config.instance.selfHosted) {
throw InputValidationError.create('kind', 'This setting is only available on self-hosted instances');
}
@@ -1013,6 +1016,7 @@ export function InstanceConfigAdminController(app: HonoApp) {
previousHash: null,
base64Image: image ?? null,
errorPath: 'image',
+ enforceDimensions: isPremiumShowcase,
});
const brandingPatch: Partial<InstanceBranding> = {[`${kind}_url`]: prepared.newCdnUrl};
const {releasedBrandingAssets} = await instanceConfigRepository.writeAppPublicConfig({branding: brandingPatch});
diff --git a/fluxer_api/src/api/admin/tests/InstanceConfigBrandingAssetCleanup.test.ts b/fluxer_api/src/api/admin/tests/InstanceConfigBrandingAssetCleanup.test.ts
index 4599ef630..7edba29f1 100644
--- a/fluxer_api/src/api/admin/tests/InstanceConfigBrandingAssetCleanup.test.ts
+++ b/fluxer_api/src/api/admin/tests/InstanceConfigBrandingAssetCleanup.test.ts
@@ -21,10 +21,10 @@ import type {InstanceConfigResponse} from '@fluxer/schema/src/domains/admin/Admi
import sharp from 'sharp';
import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'vitest';
-type BrandingKind = 'icon' | 'logo' | 'sign_in_backdrop';
+type BrandingKind = 'icon' | 'logo' | 'premium_showcase_stream';
-async function solidPng(background: string): Promise<string> {
- const buffer = await sharp({create: {width: 4, height: 4, channels: 4, background}})
+async function solidPng(background: string, size = 4): Promise<string> {
+ const buffer = await sharp({create: {width: size, height: size, channels: 4, background}})
.png()
.toBuffer();
return getPngDataUrl(buffer.toString('base64'));
@@ -118,4 +118,12 @@ describe('branding image cleanup', () => {
await upload('logo', image);
expect(await storedAfterCleanup(key)).toBe(true);
});
+
+ it('releases the old premium page card image when it is replaced', async () => {
+ const first = (await upload('premium_showcase_stream', await solidPng('#ff0000', 480))).app_public.branding;
+ const key = storageKey(first.premium_showcase_stream_url);
+ const second = (await upload('premium_showcase_stream', await solidPng('#00ff00', 480))).app_public.branding;
+ expect(storageKey(second.premium_showcase_stream_url)).not.toBe(key);
+ expect(await storedAfterCleanup(key)).toBe(false);
+ });
});
diff --git a/fluxer_api/src/api/infrastructure/EntityAssetService.ts b/fluxer_api/src/api/infrastructure/EntityAssetService.ts
index 4cb3fff33..4aeb6f781 100644
--- a/fluxer_api/src/api/infrastructure/EntityAssetService.ts
+++ b/fluxer_api/src/api/infrastructure/EntityAssetService.ts
@@ -93,6 +93,7 @@ interface PrepareAssetUploadOptions {
base64Image: string | null;
errorPath: string;
uploader?: User | null;
+ enforceDimensions?: boolean;
}
type LimitConfigSnapshotProvider = Pick<LimitConfigService, 'getConfigSnapshot'>;
@@ -127,7 +128,17 @@ export class EntityAssetService {
}
async prepareAssetUpload(options: PrepareAssetUploadOptions): Promise<PreparedAssetUpload> {
- const {assetType, entityType, entityId, guildId, previousHash, base64Image, errorPath, uploader} = options;
+ const {
+ assetType,
+ entityType,
+ entityId,
+ guildId,
+ previousHash,
+ base64Image,
+ errorPath,
+ uploader,
+ enforceDimensions,
+ } = options;
const s3KeyBase = this.buildS3KeyBase(assetType, entityType, entityId, guildId);
const cdnUrlBase = `${Config.endpoints.media}/${s3KeyBase}`;
const previousS3Key = previousHash ? `${s3KeyBase}/${stripAnimationPrefix(previousHash)}` : null;
@@ -158,7 +169,13 @@ export class EntityAssetService {
width,
contentType,
animated: isAnimated,
- } = await this.validateAndProcessImage(base64Image, errorPath, assetType, uploader ?? null);
+ } = await this.validateAndProcessImage(
+ base64Image,
+ errorPath,
+ assetType,
+ uploader ?? null,
+ enforceDimensions ?? false,
+ );
const imageHash = crypto.createHash('md5').update(Buffer.from(imageBuffer)).digest('hex');
const imageHashShort = imageHash.slice(0, 8);
const newHash = isAnimated ? `a_${imageHashShort}` : imageHashShort;
@@ -358,6 +375,7 @@ export class EntityAssetService {
errorPath: string,
assetType: AssetType,
uploader: User | null,
+ enforceDimensions: boolean,
): Promise<{
imageBuffer: Uint8Array;
format: string;
@@ -376,7 +394,7 @@ export class EntityAssetService {
? getPolicy(kind).maxBytes
: resolveAssetSizeLimit(this.limitConfigService, 'avatar_max_size', AVATAR_MAX_SIZE, null, uploader),
});
- if (kind === 'role_icon') {
+ if (kind === 'role_icon' || enforceDimensions) {
requireDimensionsWithinPolicy(metadata, kind, errorPath);
}
const isAnimatedImage = metadata.animated ?? false;
diff --git a/fluxer_api/src/api/instance/InstanceAssetReferences.ts b/fluxer_api/src/api/instance/InstanceAssetReferences.ts
index e73c2b922..93ed1d1b4 100644
--- a/fluxer_api/src/api/instance/InstanceAssetReferences.ts
+++ b/fluxer_api/src/api/instance/InstanceAssetReferences.ts
@@ -10,6 +10,10 @@ export const BRANDING_ASSET_FIELDS = [
'favicon_url',
'favicon_dark_url',
'sign_in_backdrop_url',
+ 'premium_showcase_expressions_url',
+ 'premium_showcase_profile_url',
+ 'premium_showcase_stream_url',
+ 'premium_showcase_upload_url',
] as const;
export type BrandingAssetField = (typeof BRANDING_ASSET_FIELDS)[number];
diff --git a/fluxer_api/src/api/instance/InstanceConfigRepository.ts b/fluxer_api/src/api/instance/InstanceConfigRepository.ts
index c3df8ed96..d7af6b6fe 100644
--- a/fluxer_api/src/api/instance/InstanceConfigRepository.ts
+++ b/fluxer_api/src/api/instance/InstanceConfigRepository.ts
@@ -109,7 +109,7 @@ import {
import {resolveSmtpTlsMode, type SmtpTlsMode} from '@fluxer/constants/src/SmtpConstants';
import {ConflictError} from '@fluxer/errors/src/domains/core/ConflictError';
import {ServiceUnavailableError} from '@fluxer/errors/src/domains/core/ServiceUnavailableError';
-import {normalizeThemeColor} from '@fluxer/instance_bootstrap/src/ThemeColor';
+import {normalizeHexColor, normalizeThemeColor} from '@fluxer/instance_bootstrap/src/ThemeColor';
import {
type AccountsConfig,
AccountsConfigSchema,
@@ -511,6 +511,16 @@ function normalizeOptionalPublicString(value: string | null | undefined, fallbac
return value === undefined ? fallback : normalizeOptionalString(value);
}
+function normalizePremiumShowcaseAsset(value: string | null | undefined): string | null {
+ if (!Config.instance.selfHosted || typeof value !== 'string') return null;
+ const reference = toStoredBrandingAsset(value.trim(), Config.endpoints.media);
+ return typeof reference === 'string' &&
+ reference.startsWith('branding-backdrops/') &&
+ isBrandingAssetReference(reference)
+ ? reference
+ : null;
+}
+
function getDefaultPremiumProductName(): string {
return Config.instance.selfHosted ? 'Premium' : 'Plutonium';
}
@@ -533,6 +543,11 @@ function getDefaultAppPublicConfig(): InstanceAppPublicConfig {
premium_product_name: getDefaultPremiumProductName(),
premium_info_url: null,
sign_in_backdrop_url: normalizeOptionalString(Config.instance.branding.signInBackdropUrl),
+ premium_page_color: null,
+ premium_showcase_expressions_url: null,
+ premium_showcase_profile_url: null,
+ premium_showcase_stream_url: null,
+ premium_showcase_upload_url: null,
custom_css: null,
upload_limit_message: null,
trusted_domains: [],
@@ -1056,6 +1071,11 @@ function buildAppPublicConfig(config: z.infer<typeof StoredInstanceAppPublicSche
branding.sign_in_backdrop_url,
defaults.branding.sign_in_backdrop_url,
),
+ premium_page_color: Config.instance.selfHosted ? normalizeHexColor(branding.premium_page_color) : null,
+ premium_showcase_expressions_url: normalizePremiumShowcaseAsset(branding.premium_showcase_expressions_url),
+ premium_showcase_profile_url: normalizePremiumShowcaseAsset(branding.premium_showcase_profile_url),
+ premium_showcase_stream_url: normalizePremiumShowcaseAsset(branding.premium_showcase_stream_url),
+ premium_showcase_upload_url: normalizePremiumShowcaseAsset(branding.premium_showcase_upload_url),
custom_css: normalizeOptionalPublicString(branding.custom_css, defaults.branding.custom_css),
upload_limit_message: normalizeOptionalPublicString(
branding.upload_limit_message,
diff --git a/fluxer_api/src/api/openapi/openapi.json b/fluxer_api/src/api/openapi/openapi.json
index fa5fbaa55..7e7f73476 100644
--- a/fluxer_api/src/api/openapi/openapi.json
+++ b/fluxer_api/src/api/openapi/openapi.json
@@ -39099,6 +39099,26 @@
"description": "Optional image URL drawn behind the sign-in card on a self-hosted instance",
"type": ["string", "null"]
},
+ "premium_page_color": {
+ "description": "Optional hex color a self-hosted instance uses to recolor its premium page",
+ "type": ["string", "null"]
+ },
+ "premium_showcase_expressions_url": {
+ "description": "Optional image a self-hosted instance shows next to the \"Your emojis, everywhere\" card on its premium page",
+ "type": ["string", "null"]
+ },
+ "premium_showcase_profile_url": {
+ "description": "Optional image a self-hosted instance shows next to the \"A profile that stands out\" card on its premium page",
+ "type": ["string", "null"]
+ },
+ "premium_showcase_stream_url": {
+ "description": "Optional image a self-hosted instance shows next to the \"Stream in 4K at 60 FPS\" card on its premium page",
+ "type": ["string", "null"]
+ },
+ "premium_showcase_upload_url": {
+ "description": "Optional image a self-hosted instance shows next to the card about file size limits on its premium page",
+ "type": ["string", "null"]
+ },
"custom_css": {
"description": "Optional stylesheet a self-hosted instance applies to its web and desktop app, except on sign-in pages",
"type": ["string", "null"]
@@ -39128,6 +39148,11 @@
"premium_product_name",
"premium_info_url",
"sign_in_backdrop_url",
+ "premium_page_color",
+ "premium_showcase_expressions_url",
+ "premium_showcase_profile_url",
+ "premium_showcase_stream_url",
+ "premium_showcase_upload_url",
"custom_css",
"upload_limit_message",
"trusted_domains"
diff --git a/fluxer_app/src/features/app/components/setup/SetupWizardClient.ts b/fluxer_app/src/features/app/components/setup/SetupWizardClient.ts
index b3a4f41a0..c5ffa5029 100644
--- a/fluxer_app/src/features/app/components/setup/SetupWizardClient.ts
+++ b/fluxer_app/src/features/app/components/setup/SetupWizardClient.ts
@@ -19,7 +19,7 @@ import type {
const logger = new Logger('SetupWizardClient');
-export type SetupBrandingAssetKind = BrandingAssetUploadRequest['kind'];
+export type SetupBrandingAssetKind = Exclude<BrandingAssetUploadRequest['kind'], `premium_showcase_${string}`>;
export async function fetchInstanceConfig(): Promise<InstanceConfigResponse> {
const response = await http.get<InstanceConfigResponse>(Endpoints.ADMIN_INSTANCE_CONFIG);
diff --git a/fluxer_app/src/features/app/state/RuntimeConfigSnapshot.ts b/fluxer_app/src/features/app/state/RuntimeConfigSnapshot.ts
index 3bb0fdcfe..2c8bc48c9 100644
--- a/fluxer_app/src/features/app/state/RuntimeConfigSnapshot.ts
+++ b/fluxer_app/src/features/app/state/RuntimeConfigSnapshot.ts
@@ -26,7 +26,7 @@ import {
} from '@fluxer/instance_bootstrap/src/Discovery';
import {InstanceEndpointKind, normalizeInstanceEndpoint} from '@fluxer/instance_bootstrap/src/EndpointNormalization';
import {CanonicalNetworkProtocol} from '@fluxer/instance_bootstrap/src/NetworkOrigin';
-import {normalizeThemeColor} from '@fluxer/instance_bootstrap/src/ThemeColor';
+import {normalizeHexColor, normalizeThemeColor} from '@fluxer/instance_bootstrap/src/ThemeColor';
import {
AGE_POLICY_ACTIONS,
type InstanceAgePolicy,
@@ -499,6 +499,35 @@ function readAppPublic(value: unknown): InstanceAppPublic {
sign_in_backdrop_url: Object.hasOwn(branding, 'sign_in_backdrop_url')
? readNullableAbsoluteHttpUrl(branding, 'sign_in_backdrop_url', 'appPublic.branding.sign_in_backdrop_url')
: null,
+ premium_page_color: normalizeHexColor(branding.premium_page_color),
+ premium_showcase_expressions_url: Object.hasOwn(branding, 'premium_showcase_expressions_url')
+ ? readNullableAbsoluteHttpUrl(
+ branding,
+ 'premium_showcase_expressions_url',
+ 'appPublic.branding.premium_showcase_expressions_url',
+ )
+ : null,
+ premium_showcase_profile_url: Object.hasOwn(branding, 'premium_showcase_profile_url')
+ ? readNullableAbsoluteHttpUrl(
+ branding,
+ 'premium_showcase_profile_url',
+ 'appPublic.branding.premium_showcase_profile_url',
+ )
+ : null,
+ premium_showcase_stream_url: Object.hasOwn(branding, 'premium_showcase_stream_url')
+ ? readNullableAbsoluteHttpUrl(
+ branding,
+ 'premium_showcase_stream_url',
+ 'appPublic.branding.premium_showcase_stream_url',
+ )
+ : null,
+ premium_showcase_upload_url: Object.hasOwn(branding, 'premium_showcase_upload_url')
+ ? readNullableAbsoluteHttpUrl(
+ branding,
+ 'premium_showcase_upload_url',
+ 'appPublic.branding.premium_showcase_upload_url',
+ )
+ : null,
custom_css: readOptionalText(branding, 'custom_css'),
upload_limit_message: readOptionalText(branding, 'upload_limit_message'),
trusted_domains: Object.hasOwn(branding, 'trusted_domains')
diff --git a/fluxer_app/src/features/app/utils/LimitResolverAdapter.ts b/fluxer_app/src/features/app/utils/LimitResolverAdapter.ts
index 955b0839a..277a8c8c0 100644
--- a/fluxer_app/src/features/app/utils/LimitResolverAdapter.ts
+++ b/fluxer_app/src/features/app/utils/LimitResolverAdapter.ts
@@ -27,7 +27,7 @@ class LimitResolverClass {
if (!Number.isFinite(resolved) || resolved < 0) {
return fallback;
}
- return Math.floor(resolved);
+ return Math.min(Math.floor(resolved), Number.MAX_SAFE_INTEGER);
}
private getSnapshotForInstance(instanceDomain?: string): LimitConfigSnapshot | null {
diff --git a/fluxer_app/src/features/i18n/locales/ar/messages.po b/fluxer_app/src/features/i18n/locales/ar/messages.po
index fca32c54b..60f366cd6 100644
--- a/fluxer_app/src/features/i18n/locales/ar/messages.po
+++ b/fluxer_app/src/features/i18n/locales/ar/messages.po
@@ -21020,6 +21020,11 @@ msgstr "معرفة المزيد عن معاينات مشاركة الشاشة"
msgid "Learn more"
msgstr "معرفة المزيد"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "اعرف المزيد عن {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/bg/messages.po b/fluxer_app/src/features/i18n/locales/bg/messages.po
index 29fb09b52..d3f67468d 100644
--- a/fluxer_app/src/features/i18n/locales/bg/messages.po
+++ b/fluxer_app/src/features/i18n/locales/bg/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Научи повече за предварителния преглед
msgid "Learn more"
msgstr "Научи повече"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Научете повече за {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/cs/messages.po b/fluxer_app/src/features/i18n/locales/cs/messages.po
index c049ac06f..521b72c5a 100644
--- a/fluxer_app/src/features/i18n/locales/cs/messages.po
+++ b/fluxer_app/src/features/i18n/locales/cs/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Zjistěte více o náhledech sdílené obrazovky"
msgid "Learn more"
msgstr "Zjistit více"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Další informace o {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/da/messages.po b/fluxer_app/src/features/i18n/locales/da/messages.po
index 56cb3d474..78137cbe2 100644
--- a/fluxer_app/src/features/i18n/locales/da/messages.po
+++ b/fluxer_app/src/features/i18n/locales/da/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Få mere at vide om forhåndsvisninger af skærmdeling"
msgid "Learn more"
msgstr "Læs mere"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Lær mere om {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/de/messages.po b/fluxer_app/src/features/i18n/locales/de/messages.po
index d68bda91e..11a7ee04b 100644
--- a/fluxer_app/src/features/i18n/locales/de/messages.po
+++ b/fluxer_app/src/features/i18n/locales/de/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Mehr über Bildschirmfreigabe-Vorschauen erfahren"
msgid "Learn more"
msgstr "Mehr erfahren"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Mehr über {premiumProductName} erfahren"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/el/messages.po b/fluxer_app/src/features/i18n/locales/el/messages.po
index 7e7f0c0c4..6c686073c 100644
--- a/fluxer_app/src/features/i18n/locales/el/messages.po
+++ b/fluxer_app/src/features/i18n/locales/el/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Μάθετε περισσότερα για τις προεπισκοπή
msgid "Learn more"
msgstr "Μάθετε περισσότερα"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Μάθετε περισσότερα για το {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/en-GB/messages.po b/fluxer_app/src/features/i18n/locales/en-GB/messages.po
index 48888a8b1..bc7c64862 100644
--- a/fluxer_app/src/features/i18n/locales/en-GB/messages.po
+++ b/fluxer_app/src/features/i18n/locales/en-GB/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Learn about screen share previews"
msgid "Learn more"
msgstr "Learn more"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Find out more about {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/en-US/messages.po b/fluxer_app/src/features/i18n/locales/en-US/messages.po
index 2a37334c0..92d0f37f3 100644
--- a/fluxer_app/src/features/i18n/locales/en-US/messages.po
+++ b/fluxer_app/src/features/i18n/locales/en-US/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Learn about screen share previews"
msgid "Learn more"
msgstr "Learn more"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Learn more about {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/es-419/messages.po b/fluxer_app/src/features/i18n/locales/es-419/messages.po
index 2ea445526..7ab127f10 100644
--- a/fluxer_app/src/features/i18n/locales/es-419/messages.po
+++ b/fluxer_app/src/features/i18n/locales/es-419/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Más información sobre las vistas previas del uso compartido de pantall
msgid "Learn more"
msgstr "Más información"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Más información sobre {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/es-ES/messages.po b/fluxer_app/src/features/i18n/locales/es-ES/messages.po
index f0aee94d8..fd79624f7 100644
--- a/fluxer_app/src/features/i18n/locales/es-ES/messages.po
+++ b/fluxer_app/src/features/i18n/locales/es-ES/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Más información sobre las vistas previas del uso compartido de pantall
msgid "Learn more"
msgstr "Más información"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Más información sobre {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/fi/messages.po b/fluxer_app/src/features/i18n/locales/fi/messages.po
index b88af6e81..0056ebf9a 100644
--- a/fluxer_app/src/features/i18n/locales/fi/messages.po
+++ b/fluxer_app/src/features/i18n/locales/fi/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Lue lisää näytönjakamisen esikatsauksista"
msgid "Learn more"
msgstr "Lue lisää"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Lue lisää: {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/fr/messages.po b/fluxer_app/src/features/i18n/locales/fr/messages.po
index e3e9ad8ac..039908a0a 100644
--- a/fluxer_app/src/features/i18n/locales/fr/messages.po
+++ b/fluxer_app/src/features/i18n/locales/fr/messages.po
@@ -21020,6 +21020,11 @@ msgstr "En savoir plus sur les aperçus du partage d’écran"
msgid "Learn more"
msgstr "En savoir plus"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "En savoir plus sur {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/he/messages.po b/fluxer_app/src/features/i18n/locales/he/messages.po
index cb3c8e2b6..82e952206 100644
--- a/fluxer_app/src/features/i18n/locales/he/messages.po
+++ b/fluxer_app/src/features/i18n/locales/he/messages.po
@@ -21020,6 +21020,11 @@ msgstr "למידע נוסף על תצוגות מקדימות של שיתוף מ
msgid "Learn more"
msgstr "מידע נוסף"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "מידע נוסף על {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/hi/messages.po b/fluxer_app/src/features/i18n/locales/hi/messages.po
index d289cd733..0aa20de33 100644
--- a/fluxer_app/src/features/i18n/locales/hi/messages.po
+++ b/fluxer_app/src/features/i18n/locales/hi/messages.po
@@ -21020,6 +21020,11 @@ msgstr "स्क्रीन शेयर पूर्वावलोकन क
msgid "Learn more"
msgstr "और जानें"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "{premiumProductName} के बारे में ज़्यादा जानें"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/hr/messages.po b/fluxer_app/src/features/i18n/locales/hr/messages.po
index f8ab8c4b4..547833971 100644
--- a/fluxer_app/src/features/i18n/locales/hr/messages.po
+++ b/fluxer_app/src/features/i18n/locales/hr/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Saznajte više o pregledima dijeljenja zaslona"
msgid "Learn more"
msgstr "Saznajte više"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Saznajte više o {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/hu/messages.po b/fluxer_app/src/features/i18n/locales/hu/messages.po
index abd0b2cf6..23fb15197 100644
--- a/fluxer_app/src/features/i18n/locales/hu/messages.po
+++ b/fluxer_app/src/features/i18n/locales/hu/messages.po
@@ -21020,6 +21020,11 @@ msgstr "További információ a képernyőmegosztás előnézeteiről"
msgid "Learn more"
msgstr "További információ"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Tudj meg többet: {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/id/messages.po b/fluxer_app/src/features/i18n/locales/id/messages.po
index 066e9e936..ffbf8139c 100644
--- a/fluxer_app/src/features/i18n/locales/id/messages.po
+++ b/fluxer_app/src/features/i18n/locales/id/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Pelajari tentang pratinjau berbagi layar"
msgid "Learn more"
msgstr "Pelajari selengkapnya"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Selengkapnya tentang {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/it/messages.po b/fluxer_app/src/features/i18n/locales/it/messages.po
index 4880ca0be..6143e4817 100644
--- a/fluxer_app/src/features/i18n/locales/it/messages.po
+++ b/fluxer_app/src/features/i18n/locales/it/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Scopri di più sulle anteprime della condivisione schermo"
msgid "Learn more"
msgstr "Scopri di più"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Scopri di più su {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/ja/messages.po b/fluxer_app/src/features/i18n/locales/ja/messages.po
index 6aa2bd55e..1f30e1593 100644
--- a/fluxer_app/src/features/i18n/locales/ja/messages.po
+++ b/fluxer_app/src/features/i18n/locales/ja/messages.po
@@ -21020,6 +21020,11 @@ msgstr "画面共有プレビューについて"
msgid "Learn more"
msgstr "詳細はこちら"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "{premiumProductName} について詳しく見る"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/ko/messages.po b/fluxer_app/src/features/i18n/locales/ko/messages.po
index a56454627..97dc6992b 100644
--- a/fluxer_app/src/features/i18n/locales/ko/messages.po
+++ b/fluxer_app/src/features/i18n/locales/ko/messages.po
@@ -21020,6 +21020,11 @@ msgstr "화면 공유 미리보기에 대해 자세히 알아보세요"
msgid "Learn more"
msgstr "자세히 알아보기"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "{premiumProductName}에 대해 자세히 알아보기"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/lt/messages.po b/fluxer_app/src/features/i18n/locales/lt/messages.po
index 2f20a12cf..91cdb9485 100644
--- a/fluxer_app/src/features/i18n/locales/lt/messages.po
+++ b/fluxer_app/src/features/i18n/locales/lt/messages.po
@@ -21021,6 +21021,11 @@ msgstr "Sužinokite apie ekrano bendrinimo peržiūras"
msgid "Learn more"
msgstr "Sužinoti daugiau"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Sužinokite daugiau apie „{premiumProductName}“"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/nl/messages.po b/fluxer_app/src/features/i18n/locales/nl/messages.po
index 519d2a5c7..1ab669015 100644
--- a/fluxer_app/src/features/i18n/locales/nl/messages.po
+++ b/fluxer_app/src/features/i18n/locales/nl/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Meer informatie over voorbeelden van schermdeling"
msgid "Learn more"
msgstr "Meer informatie"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Meer informatie over {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/no/messages.po b/fluxer_app/src/features/i18n/locales/no/messages.po
index 349169ac7..3724587e2 100644
--- a/fluxer_app/src/features/i18n/locales/no/messages.po
+++ b/fluxer_app/src/features/i18n/locales/no/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Lær mer om skjermdelingsforhåndsvisninger"
msgid "Learn more"
msgstr "Les mer"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Finn ut mer om {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/pl/messages.po b/fluxer_app/src/features/i18n/locales/pl/messages.po
index bad74a4d8..92374e80c 100644
--- a/fluxer_app/src/features/i18n/locales/pl/messages.po
+++ b/fluxer_app/src/features/i18n/locales/pl/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Dowiedz się więcej o podglądach udostępniania ekranu"
msgid "Learn more"
msgstr "Dowiedz się więcej"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Dowiedz się więcej o {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/pt-BR/messages.po b/fluxer_app/src/features/i18n/locales/pt-BR/messages.po
index 72f998d71..85f5f33ff 100644
--- a/fluxer_app/src/features/i18n/locales/pt-BR/messages.po
+++ b/fluxer_app/src/features/i18n/locales/pt-BR/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Saiba mais sobre as prévias de compartilhamento de tela"
msgid "Learn more"
msgstr "Saiba mais"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Saiba mais sobre {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/ro/messages.po b/fluxer_app/src/features/i18n/locales/ro/messages.po
index dadd3b309..02b81b4db 100644
--- a/fluxer_app/src/features/i18n/locales/ro/messages.po
+++ b/fluxer_app/src/features/i18n/locales/ro/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Află mai multe despre previzualizarea partajării ecranului"
msgid "Learn more"
msgstr "Află mai multe"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Află mai multe despre {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/ru/messages.po b/fluxer_app/src/features/i18n/locales/ru/messages.po
index c7e238d46..310343128 100644
--- a/fluxer_app/src/features/i18n/locales/ru/messages.po
+++ b/fluxer_app/src/features/i18n/locales/ru/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Узнать больше о предпросмотре демонстр
msgid "Learn more"
msgstr "Подробнее"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Узнайте больше о {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/sv-SE/messages.po b/fluxer_app/src/features/i18n/locales/sv-SE/messages.po
index 89325cec8..4d0ca8815 100644
--- a/fluxer_app/src/features/i18n/locales/sv-SE/messages.po
+++ b/fluxer_app/src/features/i18n/locales/sv-SE/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Läs mer om förhandsvisningar av skärmdelning"
msgid "Learn more"
msgstr "Läs mer"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Läs mer om {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/th/messages.po b/fluxer_app/src/features/i18n/locales/th/messages.po
index e05e35cff..479852d26 100644
--- a/fluxer_app/src/features/i18n/locales/th/messages.po
+++ b/fluxer_app/src/features/i18n/locales/th/messages.po
@@ -21020,6 +21020,11 @@ msgstr "ดูข้อมูลเพิ่มเติมเกี่ยวก
msgid "Learn more"
msgstr "ดูเพิ่มเติม"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "เรียนรู้เพิ่มเติมเกี่ยวกับ {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/tr/messages.po b/fluxer_app/src/features/i18n/locales/tr/messages.po
index 696a873c1..6102e7c76 100644
--- a/fluxer_app/src/features/i18n/locales/tr/messages.po
+++ b/fluxer_app/src/features/i18n/locales/tr/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Ekran paylaşımı önizlemeleri hakkında bilgi edinin"
msgid "Learn more"
msgstr "Daha fazla bilgi edinin"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "{premiumProductName} hakkında daha fazla bilgi edinin"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/uk/messages.po b/fluxer_app/src/features/i18n/locales/uk/messages.po
index 3f124d14f..fa8af3269 100644
--- a/fluxer_app/src/features/i18n/locales/uk/messages.po
+++ b/fluxer_app/src/features/i18n/locales/uk/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Дізнайтеся більше про попередній перег
msgid "Learn more"
msgstr "Докладніше"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Дізнайтеся більше про {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/vi/messages.po b/fluxer_app/src/features/i18n/locales/vi/messages.po
index 081f65a14..14f153857 100644
--- a/fluxer_app/src/features/i18n/locales/vi/messages.po
+++ b/fluxer_app/src/features/i18n/locales/vi/messages.po
@@ -21020,6 +21020,11 @@ msgstr "Tìm hiểu về bản xem trước chia sẻ màn hình"
msgid "Learn more"
msgstr "Tìm hiểu thêm"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "Tìm hiểu thêm về {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/zh-CN/messages.po b/fluxer_app/src/features/i18n/locales/zh-CN/messages.po
index 22ab069fd..232577c75 100644
--- a/fluxer_app/src/features/i18n/locales/zh-CN/messages.po
+++ b/fluxer_app/src/features/i18n/locales/zh-CN/messages.po
@@ -21020,6 +21020,11 @@ msgstr "了解屏幕共享预览"
msgid "Learn more"
msgstr "了解详情"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "了解更多关于 {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/i18n/locales/zh-TW/messages.po b/fluxer_app/src/features/i18n/locales/zh-TW/messages.po
index f4380cc1d..a889bf4ef 100644
--- a/fluxer_app/src/features/i18n/locales/zh-TW/messages.po
+++ b/fluxer_app/src/features/i18n/locales/zh-TW/messages.po
@@ -21020,6 +21020,11 @@ msgstr "了解螢幕分享預覽功能"
msgid "Learn more"
msgstr "瞭解詳情"
+#. Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.
+#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+msgid "Learn more about {premiumProductName}"
+msgstr "進一步了解 {premiumProductName}"
+
#. Link text in the Plutonium page tag footnote. Opens the Visionary help article.
#: src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
msgid "Learn more about Visionary"
diff --git a/fluxer_app/src/features/messaging/utils/FileUtils.ts b/fluxer_app/src/features/messaging/utils/FileUtils.ts
index 639bf699e..4dda42cbb 100644
--- a/fluxer_app/src/features/messaging/utils/FileUtils.ts
+++ b/fluxer_app/src/features/messaging/utils/FileUtils.ts
@@ -3,20 +3,25 @@
import {getCachedNumberFormat} from '@app/features/i18n/utils/IntlCache';
const FILE_SIZE_UNIT_BYTES = 1024;
-const FILE_SIZE_UNITS = ['byte', 'kilobyte', 'megabyte', 'gigabyte'] as const;
+const FILE_SIZE_UNITS = ['byte', 'kilobyte', 'megabyte', 'gigabyte', 'terabyte'] as const;
export function formatFileSize(locale: string, bytes: number): string {
if (!Number.isSafeInteger(bytes) || bytes < 0) {
throw new RangeError('File size must be a non-negative safe integer');
}
- const unitIndex =
+ let unitIndex =
bytes === 0
? 0
: Math.min(Math.floor(Math.log(bytes) / Math.log(FILE_SIZE_UNIT_BYTES)), FILE_SIZE_UNITS.length - 1);
+ let value = bytes / FILE_SIZE_UNIT_BYTES ** unitIndex;
+ if (Math.round(value * 10) / 10 >= FILE_SIZE_UNIT_BYTES && unitIndex < FILE_SIZE_UNITS.length - 1) {
+ unitIndex += 1;
+ value /= FILE_SIZE_UNIT_BYTES;
+ }
return getCachedNumberFormat(locale, {
style: 'unit',
unit: FILE_SIZE_UNITS[unitIndex],
unitDisplay: 'narrow',
maximumFractionDigits: 1,
- }).format(bytes / FILE_SIZE_UNIT_BYTES ** unitIndex);
+ }).format(value);
}
diff --git a/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPage.module.css b/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPage.module.css
index f0b7207b5..6d7b79755 100644
--- a/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPage.module.css
+++ b/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPage.module.css
@@ -707,6 +707,21 @@
filter: drop-shadow(0 var(--pl-ledge-xl) 0 var(--pl-image-ledge));
}
+.perkArtCustom {
+ aspect-ratio: 11 / 8;
+ overflow: hidden;
+ border-radius: var(--pl-radius-l);
+}
+
+.perkArtCustom .perkArtImage {
+ height: 100%;
+ object-fit: cover;
+}
+
+.perkArtCustom.perkArtFailed .perkArtImage {
+ display: none;
+}
+
.perkArtPending,
.perkArtFailed {
border-radius: var(--pl-radius-l);
diff --git a/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPage.tsx b/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPage.tsx
index 434057716..276417941 100644
--- a/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPage.tsx
+++ b/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPage.tsx
@@ -38,6 +38,7 @@ import {
MEMBER_THANKS_DESCRIPTOR,
MONTHLY_PRICE_DESCRIPTOR,
PAGE_LABEL_DESCRIPTOR,
+ PREMIUM_INFO_LINK_DESCRIPTOR,
PRICE_OR_DESCRIPTOR,
REDEEM_GIFT_CODE_DESCRIPTOR,
REDEEM_ONLY_DESCRIPTOR,
@@ -60,6 +61,7 @@ import {MANAGE_SUBSCRIPTION_DESCRIPTOR} from '@app/features/premium/utils/Premiu
import {yearlySavingsPercent} from '@app/features/premium/utils/PremiumSavings';
import {getPremiumProductFullName, getPremiumProductName} from '@app/features/premium/utils/PremiumUtils';
import {getSubscriptionStatus} from '@app/features/premium/utils/SubscriptionStatus';
+import {getPremiumPageVariables} from '@app/features/theme/utils/InstanceBrandColors';
import * as ToastCommands from '@app/features/ui/commands/ToastCommands';
import FocusRing from '@app/features/ui/focus_ring/FocusRing';
import {ArrowLeftIcon} from '@app/features/ui/icons/DirectionalIcons';
@@ -257,6 +259,10 @@ export const PlutoniumPage = observer(function PlutoniumPage() {
comparisonActions = giftButton('primary', 'comparison');
}
const showDonationHint = !RuntimeConfig.isSelfHosted();
+ const premiumInfoUrl = RuntimeConfig.isSelfHosted() ? RuntimeConfig.appPublic.branding.premium_info_url : null;
+ const pageColors = getPremiumPageVariables(
+ RuntimeConfig.isSelfHosted() ? RuntimeConfig.appPublic.branding.premium_page_color : null,
+ );
const heroArt = heroArtFor(RuntimeConfig.isSelfHosted());
const donationTemplate = i18n._(DONATION_HINT_DESCRIPTOR, {
productName: RuntimeConfig.productName,
@@ -444,6 +450,7 @@ export const PlutoniumPage = observer(function PlutoniumPage() {
return (
<div
className={styles.root}
+ style={(pageColors ?? undefined) as React.CSSProperties | undefined}
role="main"
aria-label={i18n._(PAGE_LABEL_DESCRIPTOR, {premiumProductName: getPremiumProductName()})}
data-flx="premium.plutonium-page.root"
@@ -498,6 +505,21 @@ export const PlutoniumPage = observer(function PlutoniumPage() {
<span data-flx="premium.plutonium-page.plutonium-page.span--4">{donationAfter}</span>
</p>
)}
+ {premiumInfoUrl && (
+ <p className={styles.meta} data-flx="premium.plutonium-page.hero.premium-info">
+ <FocusRing offset={-2} data-flx="premium.plutonium-page.hero.premium-info-focus-ring">
+ <a
+ className={styles.inlineLink}
+ href={premiumInfoUrl}
+ target="_blank"
+ rel="noopener noreferrer"
+ data-flx="premium.plutonium-page.hero.premium-info-link"
+ >
+ {i18n._(PREMIUM_INFO_LINK_DESCRIPTOR, {premiumProductName: getPremiumProductName()})}
+ </a>
+ </FocusRing>
+ </p>
+ )}
</div>
</section>
<div className={styles.sections} data-flx="premium.plutonium-page.sections">
diff --git a/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageComparison.tsx b/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageComparison.tsx
index b8c3f0936..6f9263a7c 100644
--- a/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageComparison.tsx
+++ b/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageComparison.tsx
@@ -4,6 +4,7 @@ import RuntimeConfig from '@app/features/app/state/RuntimeConfig';
import {Limits} from '@app/features/app/utils/UserLimits';
import {AVAILABLE_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
import {formatNumber} from '@app/features/i18n/utils/IntlCache';
+import {formatFileSize} from '@app/features/messaging/utils/FileUtils';
import styles from '@app/features/premium/components/plutonium_page/PlutoniumPage.module.css';
import {
PlutoniumPageIcon,
@@ -35,6 +36,7 @@ import {
} from '@app/features/premium/components/plutonium_page/PlutoniumPageMessages';
import {getPremiumProductName} from '@app/features/premium/utils/PremiumUtils';
import FocusRing from '@app/features/ui/focus_ring/FocusRing';
+import {ATTACHMENT_MAX_SIZE_NON_PREMIUM, ATTACHMENT_MAX_SIZE_PREMIUM} from '@fluxer/constants/src/LimitConstants';
import {
isBooleanTierPerk,
isNumericTierPerk,
@@ -81,25 +83,17 @@ const PERK_DEFINITIONS: ReadonlyArray<PerkDefinition> = [
{perkId: 'custom_themes', icon: 'palette', label: PERK_CUSTOM_THEMES_DESCRIPTOR},
];
-const BYTES_PER_MEGABYTE = 1024 * 1024;
-
-function formatMegabytes(locale: string, bytes: number): string {
- return new Intl.NumberFormat(locale, {style: 'unit', unit: 'megabyte', unitDisplay: 'short'}).format(
- Math.floor(bytes / BYTES_PER_MEGABYTE),
- );
-}
-
export function resolveUploadSizes(locale: string): {free: string; premium: string} {
const perk = LIMIT_TIER_PERKS.find((candidate) => candidate.id === 'max_attachment_file_size');
if (!perk || !isNumericTierPerk(perk) || !perk.limitKey) {
return {
- free: formatMegabytes(locale, 25 * BYTES_PER_MEGABYTE),
- premium: formatMegabytes(locale, 500 * BYTES_PER_MEGABYTE),
+ free: formatFileSize(locale, ATTACHMENT_MAX_SIZE_NON_PREMIUM),
+ premium: formatFileSize(locale, ATTACHMENT_MAX_SIZE_PREMIUM),
};
}
return {
- free: formatMegabytes(locale, Limits.getRestrictedValue(perk.limitKey, perk.restrictedValue)),
- premium: formatMegabytes(locale, Limits.getStockValue(perk.limitKey, perk.stockValue)),
+ free: formatFileSize(locale, Limits.getRestrictedValue(perk.limitKey, perk.restrictedValue)),
+ premium: formatFileSize(locale, Limits.getStockValue(perk.limitKey, perk.stockValue)),
};
}
@@ -110,7 +104,7 @@ function resolveNumericValue(perk: NumericTierPerk, value: number, tier: 'free'
tier === 'premium' ? Limits.getStockValue(perk.limitKey, value) : Limits.getRestrictedValue(perk.limitKey, value);
}
if (perk.unit === 'bytes') {
- return formatMegabytes(locale, resolved);
+ return formatFileSize(locale, resolved);
}
return formatNumber(resolved, locale);
}
diff --git a/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageLayout.module.css b/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageLayout.module.css
index 98d73f228..053a54f7d 100644
--- a/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageLayout.module.css
+++ b/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageLayout.module.css
@@ -8,5 +8,5 @@
min-width: 0;
min-height: 0;
overflow: hidden;
- background-color: #0a0822;
+ background-color: var(--pl-layout-face, #0a0822);
}
diff --git a/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageLayout.tsx b/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageLayout.tsx
index 145925b04..b725f6ebb 100644
--- a/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageLayout.tsx
+++ b/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageLayout.tsx
@@ -1,20 +1,29 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {Routes} from '@app/app/Routes';
+import RuntimeConfig from '@app/features/app/state/RuntimeConfig';
import * as RouterUtils from '@app/features/navigation/utils/RouterUtils';
import {PlutoniumPage} from '@app/features/premium/components/plutonium_page/PlutoniumPage';
import styles from '@app/features/premium/components/plutonium_page/PlutoniumPageLayout.module.css';
import {shouldShowPremiumFeatures} from '@app/features/premium/utils/PremiumUtils';
+import {getPremiumPageVariables} from '@app/features/theme/utils/InstanceBrandColors';
import {observer} from 'mobx-react-lite';
-import {useEffect} from 'react';
+import {type CSSProperties, useEffect} from 'react';
export const PlutoniumPageLayout = observer(function PlutoniumPageLayout() {
const enabled = shouldShowPremiumFeatures();
+ const pageColors = getPremiumPageVariables(
+ RuntimeConfig.isSelfHosted() ? RuntimeConfig.appPublic.branding.premium_page_color : null,
+ );
useEffect(() => {
if (!enabled) RouterUtils.replaceWith(Routes.ME);
}, [enabled]);
return (
- <div className={styles.layout} data-flx="premium.plutonium-page-layout.layout">
+ <div
+ className={styles.layout}
+ style={pageColors ? ({'--pl-layout-face': pageColors['--pl-layout-face']} as CSSProperties) : undefined}
+ data-flx="premium.plutonium-page-layout.layout"
+ >
{enabled && <PlutoniumPage data-flx="premium.plutonium-page-layout.page" />}
</div>
);
diff --git a/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts b/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
index d92a692b6..406e66a25 100644
--- a/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
+++ b/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageMessages.ts
@@ -26,6 +26,11 @@ export const DONATE_INSTEAD_DESCRIPTOR = msg({
message: 'Donate instead',
comment: 'Link text in the Plutonium page donation hint. Opens the donation page on the website.',
});
+export const PREMIUM_INFO_LINK_DESCRIPTOR = msg({
+ message: 'Learn more about {premiumProductName}',
+ comment:
+ 'Link under the Plutonium page hero buttons on self-hosted instances. premiumProductName is the paid tier name set by the instance. Opens a page about the tier that the instance admin chose.',
+});
export const SUBSCRIBE_YEARLY_DESCRIPTOR = msg({
message: 'Get yearly',
comment: 'Primary Plutonium page button that starts a yearly subscription checkout.',
diff --git a/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageShowcase.tsx b/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageShowcase.tsx
index 24da7bfbe..78f62e7d2 100644
--- a/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageShowcase.tsx
+++ b/fluxer_app/src/features/premium/components/plutonium_page/PlutoniumPageShowcase.tsx
@@ -34,6 +34,7 @@ import FocusRing from '@app/features/ui/focus_ring/FocusRing';
import type {MessageDescriptor} from '@lingui/core';
import {useLingui} from '@lingui/react/macro';
import {clsx} from 'clsx';
+import {observer} from 'mobx-react-lite';
import type React from 'react';
import {useCallback, useState} from 'react';
@@ -49,8 +50,10 @@ interface PerkOverlay {
backdrop?: string;
}
+type PerkCardId = 'expressions' | 'profile' | 'stream' | 'upload';
+
interface PerkCard {
- id: string;
+ id: PerkCardId;
icon: PlutoniumPageIconName;
title: MessageDescriptor;
body: MessageDescriptor;
@@ -62,6 +65,26 @@ interface PerkCard {
}
const SHOT_WIDTHS = [640, 1120, 1600] as const;
+const CUSTOM_SHOT_SIZES = [640, 1024, 1536] as const;
+
+const CUSTOM_SHOT_FIELDS = {
+ expressions: 'premium_showcase_expressions_url',
+ profile: 'premium_showcase_profile_url',
+ stream: 'premium_showcase_stream_url',
+ upload: 'premium_showcase_upload_url',
+} as const satisfies Record<PerkCardId, string>;
+
+type PerkArtSource = {kind: 'flagship'} | {kind: 'custom'; url: string};
+
+function perkArtSource(card: PerkCard): PerkArtSource | null {
+ if (!RuntimeConfig.isSelfHosted()) return {kind: 'flagship'};
+ const url = RuntimeConfig.appPublic.branding[CUSTOM_SHOT_FIELDS[card.id]];
+ return url ? {kind: 'custom', url} : null;
+}
+
+function customSrcSet(url: string): string {
+ return CUSTOM_SHOT_SIZES.map((size) => `${url}?size=${size} ${size}w`).join(', ');
+}
const EXPRESSIONS_OVERLAYS: ReadonlyArray<PerkOverlay> = [
{src: EMOJI_CATVIBE, left: 65.22, top: 11.241, width: 4.372, height: 5.128, backdrop: CHAT_SURFACE},
@@ -241,7 +264,7 @@ function ProfileOverlay() {
);
}
-function PerkArt({card, eager}: {card: PerkCard; eager: boolean}) {
+function PerkArt({card, source, eager}: {card: PerkCard; source: PerkArtSource; eager: boolean}) {
const [status, setStatus] = useState<'pending' | 'loaded' | 'failed'>('pending');
const imageRef = useCallback((image: HTMLImageElement | null) => {
if (image?.complete) setStatus(image.naturalWidth > 0 ? 'loaded' : 'failed');
@@ -250,6 +273,7 @@ function PerkArt({card, eager}: {card: PerkCard; eager: boolean}) {
<div
className={clsx(
styles.perkArt,
+ source.kind === 'custom' && styles.perkArtCustom,
status === 'pending' && styles.perkArtPending,
status === 'failed' && styles.perkArtFailed,
)}
@@ -264,6 +288,42 @@ function PerkArt({card, eager}: {card: PerkCard; eager: boolean}) {
/>
</div>
)}
+ {source.kind === 'custom' ? (
+ <img
+ ref={imageRef}
+ draggable={false}
+ className={styles.perkArtImage}
+ src={`${source.url}?size=${CUSTOM_SHOT_SIZES[1]}`}
+ srcSet={customSrcSet(source.url)}
+ sizes={PERK_SHOT_SIZES}
+ loading={eager ? 'eager' : 'lazy'}
+ fetchPriority={eager ? 'high' : undefined}
+ decoding="async"
+ alt=""
+ onLoad={() => setStatus('loaded')}
+ onError={() => setStatus('failed')}
+ data-flx="premium.plutonium-page.perk-art.custom-image"
+ />
+ ) : (
+ <FlagshipPerkArt card={card} eager={eager} imageRef={imageRef} onStatus={setStatus} />
+ )}
+ </div>
+ );
+}
+
+function FlagshipPerkArt({
+ card,
+ eager,
+ imageRef,
+ onStatus,
+}: {
+ card: PerkCard;
+ eager: boolean;
+ imageRef: (image: HTMLImageElement | null) => void;
+ onStatus: (status: 'loaded' | 'failed') => void;
+}) {
+ return (
+ <>
<picture data-flx="premium.plutonium-page.plutonium-page-showcase.perk-art.picture">
<source
type="image/avif"
@@ -288,8 +348,8 @@ function PerkArt({card, eager}: {card: PerkCard; eager: boolean}) {
fetchPriority={eager ? 'high' : undefined}
decoding="async"
alt=""
- onLoad={() => setStatus('loaded')}
- onError={() => setStatus('failed')}
+ onLoad={() => onStatus('loaded')}
+ onError={() => onStatus('failed')}
data-flx="premium.plutonium-page.perk-art.image"
/>
</picture>
@@ -318,7 +378,7 @@ function PerkArt({card, eager}: {card: PerkCard; eager: boolean}) {
{card.profileOverlay && (
<ProfileOverlay data-flx="premium.plutonium-page.plutonium-page-showcase.perk-art.profile-overlay" />
)}
- </div>
+ </>
);
}
@@ -329,18 +389,21 @@ interface PlutoniumPageShowcaseProps {
onFootnoteClick: (event: React.MouseEvent<HTMLAnchorElement>) => void;
}
-export function PlutoniumPageShowcase({
+export const PlutoniumPageShowcase = observer(function PlutoniumPageShowcase({
uploadSize,
freeUploadSize,
footnoteId,
onFootnoteClick,
}: PlutoniumPageShowcaseProps) {
const {i18n} = useLingui();
- const showArt = !RuntimeConfig.isSelfHosted();
+ let artIndex = 0;
return (
<div className={styles.featureRows} data-flx="premium.plutonium-page.feature-rows">
- {PERK_CARDS.map((card, index) => {
- const flipped = index % 2 === 1;
+ {PERK_CARDS.map((card) => {
+ const source = perkArtSource(card);
+ const artPosition = source ? artIndex++ : -1;
+ const eager = artPosition === 0;
+ const flipped = artPosition % 2 === 1;
let body: React.ReactNode;
if (card.id === 'profile' && RuntimeConfig.usesUniqueUsernames) {
body = i18n._(SHOWCASE_PROFILE_BODY_WITHOUT_TAG_DESCRIPTOR);
@@ -357,18 +420,20 @@ export function PlutoniumPageShowcase({
return (
<article
key={card.id}
- className={clsx(styles.perkRow, showArt ? flipped && styles.perkRowFlipped : styles.perkRowTextOnly)}
+ className={clsx(styles.perkRow, source ? flipped && styles.perkRowFlipped : styles.perkRowTextOnly)}
data-flx={`premium.plutonium-page.perk-row.${card.id}`}
>
- {showArt && (
+ {source && (
<div className={styles.perkArtColumn} data-flx="premium.plutonium-page.perk-row.art-column">
<div
className={clsx(styles.tilt, flipped && styles.tiltReverse)}
data-flx="premium.plutonium-page.perk-row.tilt"
>
<PerkArt
+ key={source.kind === 'custom' ? source.url : 'flagship'}
card={card}
- eager={index === 0}
+ source={source}
+ eager={eager}
data-flx="premium.plutonium-page.plutonium-page-showcase.perk-art"
/>
</div>
@@ -387,7 +452,7 @@ export function PlutoniumPageShowcase({
})}
</div>
);
-}
+});
function renderProfileBody(
text: string,
diff --git a/fluxer_app/src/features/theme/utils/InstanceBrandColors.ts b/fluxer_app/src/features/theme/utils/InstanceBrandColors.ts
index d09114a07..758b6c409 100644
--- a/fluxer_app/src/features/theme/utils/InstanceBrandColors.ts
+++ b/fluxer_app/src/features/theme/utils/InstanceBrandColors.ts
@@ -306,3 +306,60 @@ export function getInstanceBrandVariables(
'--instance-text-on-brand-tint': tint.text.css,
};
}
+
+export const PREMIUM_PAGE_STOPS = {
+ '--pl-indigo-0': '#ffffff',
+ '--pl-indigo-1': '#e3e2ff',
+ '--pl-indigo-2': '#c9c7ff',
+ '--pl-indigo-3': '#b0adff',
+ '--pl-indigo-8': '#5352df',
+ '--pl-indigo-9': '#4641d9',
+ '--pl-indigo-10': '#3d38c6',
+ '--pl-indigo-11': '#3530b4',
+ '--pl-indigo-12': '#2e29a4',
+ '--pl-indigo-13': '#282394',
+ '--pl-indigo-14': '#231e84',
+ '--pl-indigo-15': '#1f1b76',
+ '--pl-indigo-16': '#1c1865',
+ '--pl-indigo-17': '#1b1754',
+ '--pl-indigo-21': '#0f0d2d',
+ '--pl-indigo-23': '#0b0921',
+ '--pl-layout-face': '#0a0822',
+} as const;
+
+export type PremiumPageVariable = keyof typeof PREMIUM_PAGE_STOPS;
+
+const PREMIUM_PAGE_MID_LUMINANCE = 0.18;
+
+const PREMIUM_PAGE_STOP_LUMINANCE = Object.entries(PREMIUM_PAGE_STOPS).map(
+ ([name, stop]) => [name as PremiumPageVariable, relativeLuminance(parseHexColor(stop) ?? BLACK)] as const,
+);
+
+function toHex(rgb: Rgb): string {
+ return `#${rgb.map((channel) => Math.round(channel).toString(16).padStart(2, '0')).join('')}`;
+}
+
+function matchLuminance(hue: number, saturation: number, target: number): Rgb {
+ let low = 0;
+ let high = 100;
+ for (let step = 0; step < 32; step++) {
+ const middle = (low + high) / 2;
+ if (relativeLuminance(hslToRgb(hue, saturation, middle)) < target) {
+ low = middle;
+ } else {
+ high = middle;
+ }
+ }
+ return hslToRgb(hue, saturation, target >= PREMIUM_PAGE_MID_LUMINANCE ? high : low);
+}
+
+export function getPremiumPageVariables(color: string | null): Record<PremiumPageVariable, string> | null {
+ const rgb = color === null ? null : parseHexColor(color);
+ if (rgb === null) return null;
+ const {hue, saturation} = rgbToHsl(rgb);
+ const variables = {} as Record<PremiumPageVariable, string>;
+ for (const [name, luminance] of PREMIUM_PAGE_STOP_LUMINANCE) {
+ variables[name] = toHex(matchLuminance(hue, saturation, luminance));
+ }
+ return variables;
+}
diff --git a/fluxer_docs/src/content/docs/admin-api/instance.mdx b/fluxer_docs/src/content/docs/admin-api/instance.mdx
index 60382882e..5561eb5cd 100644
--- a/fluxer_docs/src/content/docs/admin-api/instance.mdx
+++ b/fluxer_docs/src/content/docs/admin-api/instance.mdx
@@ -521,6 +521,12 @@ Fluxer drops an override that would make a maximum smaller than its minimum.
| favicon | Writes `branding.favicon_url` |
| favicon_dark | Writes `branding.favicon_dark_url` |
| sign_in_backdrop | Writes `branding.sign_in_backdrop_url` |
+| premium_showcase_expressions | Writes the emoji card image |
+| premium_showcase_profile | Writes the profile card image |
+| premium_showcase_stream | Writes the stream card image |
+| premium_showcase_upload | Writes the upload card image |
+
+Each `premium_showcase_*` kind writes the `branding` field with its name and `_url`, such as `branding.premium_showcase_stream_url`. The `favicon_dark`, `sign_in_backdrop` and `premium_showcase_*` kinds only work on self-hosted instances.
## SMTP TLS mode
@@ -659,7 +665,7 @@ Merges the body into the saved configuration and returns the [instance configura
<sup>1</sup> While `enabled` is true, a save without an `issuer` fails with `SSO_ISSUER_REQUIRED`, and endpoint URLs must use `https` and point at a public address unless `FLUXER_SSO_ALLOW_PRIVATE_ADDRESSES` is true. Turning on both `enabled` and `enforced` fails with `SSO_MISCONFIGURED` without a `client_id`. When endpoints come from the `issuer`, Fluxer fetches the provider's discovery document. If that fails, turning on `enforced` fails with `SSO_DISCOVERY_FAILED`, and a save without `enforced` goes through with a line in `warnings`. A save that changes the provider ID while accounts are linked to the old one moves those links itself when only a trailing `/` changed, or when it adds an `issuer` whose authorization endpoint is the one already in use. Otherwise it fails with `SSO_ISSUER_CHANGE_HAS_IDENTITIES` unless it sends `migrate_identities`. True moves the links to the new issuer, and false leaves them on the old one. Each move writes a `migrate_sso_identities` audit log entry. `migrate_identities` applies to that save only and is never stored
-<sup>2</sup> `branding.product_name` is 1-80 characters, `branding.premium_product_name` 1-40, `branding.custom_css` up to 32,768 and `branding.upload_limit_message` up to 500. `branding.trusted_domains` holds up to 50 hostnames, each optionally starting with `*.`, and null clears it. URLs are up to 2048 characters and `branding.theme_color` is a hex color. Setting `setup.configured` to true finishes setup, and accounts that register after that don't get the wildcard Admin ACL
+<sup>2</sup> `branding.product_name` is 1-80 characters, `branding.premium_product_name` 1-40, `branding.custom_css` up to 32,768 and `branding.upload_limit_message` up to 500. `branding.trusted_domains` holds up to 50 hostnames, each optionally starting with `*.`, and null clears it. URLs are up to 2048 characters, and `branding.theme_color` and `branding.premium_page_color` are hex colors. `branding.premium_page_color` only works on self-hosted instances. Setting `setup.configured` to true finishes setup, and accounts that register after that don't get the wildcard Admin ACL
<sup>3</sup> A secret such as `klipy_api_key`, `api_key` or the SMTP `password` is saved when sent and kept when left out. `email.smtp` takes `host`, `port`, `username`, `password` and `tls_mode`. `bluesky.keys` replaces the signing keys with up to 8 entries of `kid` and `private_key`
@@ -726,14 +732,14 @@ Uploads an image to a branding slot and returns the [instance configuration](#in
| kind | string | [Branding asset kind](#branding-asset-kinds) of the slot to write |
| image?<sup>1</sup> | ?string | Base64 image or data URI, or null to clear the slot (up to 16000000 characters) |
-<sup>1</sup> Up to the `avatar_max_size` limit, 10 MiB by default, as PNG, JPEG, WebP, GIF, APNG, still AVIF, HEIC, HEIF, JXL or SVG. A `sign_in_backdrop` is up to 4 MiB as a still PNG, JPEG, WebP or AVIF
+<sup>1</sup> Up to the `avatar_max_size` limit, 10 MiB by default, as PNG, JPEG, WebP, GIF, APNG, still AVIF, HEIC, HEIF, JXL or SVG. A `sign_in_backdrop` is up to 4 MiB as a still PNG, JPEG, WebP or AVIF. A `premium_showcase_*` image has the same limits and is 480 to 2400 pixels on each side
### Response
| Status | Body | Condition |
| --- | --- | --- |
| 200 | [instance configuration](#instance-configuration-object) object | The slot was written or cleared |
-| 400 | [error response](/admin-api/#error-response) | `IMAGE_SIZE_EXCEEDS_LIMIT`, `INVALID_IMAGE_FORMAT` or `FAILED_TO_UPLOAD_IMAGE` for a bad image |
+| 400 | [error response](/admin-api/#error-response) | `IMAGE_SIZE_EXCEEDS_LIMIT`, `IMAGE_DIMENSIONS_OUT_OF_RANGE`, `INVALID_IMAGE_FORMAT` or `FAILED_TO_UPLOAD_IMAGE` for a bad image |
The rate limit is 100 requests per minute, on the `admin:user:modify` bucket.
diff --git a/fluxer_docs/src/content/docs/http-api/instance.mdx b/fluxer_docs/src/content/docs/http-api/instance.mdx
index e1e5f942a..964a85e3e 100644
--- a/fluxer_docs/src/content/docs/http-api/instance.mdx
+++ b/fluxer_docs/src/content/docs/http-api/instance.mdx
@@ -422,6 +422,11 @@ What a client needs before anyone signs in.
| premium_product_name | string | The name of the premium tier, `Premium` unless an admin sets one |
| premium_info_url | ?string | URL of a page about the premium tier, or null |
| sign_in_backdrop_url | ?string | Image shown behind the sign-in screens, or null for the default |
+| premium_page_color | ?string | Premium page color of a self-hosted instance as lowercase `#rrggbb`, or null |
+| premium_showcase_expressions_url | ?string | Image next to the emoji card on the premium page of a self-hosted instance, or null |
+| premium_showcase_profile_url | ?string | Image next to the profile card on the premium page of a self-hosted instance, or null |
+| premium_showcase_stream_url | ?string | Image next to the stream card on the premium page of a self-hosted instance, or null |
+| premium_showcase_upload_url | ?string | Image next to the upload card on the premium page of a self-hosted instance, or null |
| custom_css | ?string | CSS the web and desktop app apply before the person's own theme, except on sign-in pages, or null |
| upload_limit_message | ?string | Markdown shown when a file is over the upload limit, or null for the default text |
| trusted_domains | string[] | Extra domains whose links open without a warning. Entries are hostnames, and a `*.` prefix also covers subdomains |
diff --git a/fluxer_rexctl/internal/adminapi/configschema.json b/fluxer_rexctl/internal/adminapi/configschema.json
index 42f1c1320..73a9ebab3 100644
--- a/fluxer_rexctl/internal/adminapi/configschema.json
+++ b/fluxer_rexctl/internal/adminapi/configschema.json
@@ -131,6 +131,12 @@
"help": "Branding premium info URL",
"nullable": true
},
+ {
+ "key": "app_public.branding.premium_page_color",
+ "type": "string",
+ "help": "Branding premium page color",
+ "nullable": true
+ },
{
"key": "app_public.branding.premium_product_name",
"type": "string",
diff --git a/fluxer_rexctl/internal/adminapi/gen.go b/fluxer_rexctl/internal/adminapi/gen.go
index 49ea3f584..d87e130bb 100644
--- a/fluxer_rexctl/internal/adminapi/gen.go
+++ b/fluxer_rexctl/internal/adminapi/gen.go
@@ -485,13 +485,17 @@ func (e BillingCatalogModeSchema) Valid() bool {
// Defines values for BrandingAssetUploadRequestKind.
const (
- Favicon BrandingAssetUploadRequestKind = "favicon"
- FaviconDark BrandingAssetUploadRequestKind = "favicon_dark"
- Icon BrandingAssetUploadRequestKind = "icon"
- Logo BrandingAssetUploadRequestKind = "logo"
- SignInBackdrop BrandingAssetUploadRequestKind = "sign_in_backdrop"
- Symbol BrandingAssetUploadRequestKind = "symbol"
- Wordmark BrandingAssetUploadRequestKind = "wordmark"
+ Favicon BrandingAssetUploadRequestKind = "favicon"
+ FaviconDark BrandingAssetUploadRequestKind = "favicon_dark"
+ Icon BrandingAssetUploadRequestKind = "icon"
+ Logo BrandingAssetUploadRequestKind = "logo"
+ PremiumShowcaseExpressions BrandingAssetUploadRequestKind = "premium_showcase_expressions"
+ PremiumShowcaseProfile BrandingAssetUploadRequestKind = "premium_showcase_profile"
+ PremiumShowcaseStream BrandingAssetUploadRequestKind = "premium_showcase_stream"
+ PremiumShowcaseUpload BrandingAssetUploadRequestKind = "premium_showcase_upload"
+ SignInBackdrop BrandingAssetUploadRequestKind = "sign_in_backdrop"
+ Symbol BrandingAssetUploadRequestKind = "symbol"
+ Wordmark BrandingAssetUploadRequestKind = "wordmark"
)
// Valid indicates whether the value is a known member of the BrandingAssetUploadRequestKind enum.
@@ -505,6 +509,14 @@ func (e BrandingAssetUploadRequestKind) Valid() bool {
return true
case Logo:
return true
+ case PremiumShowcaseExpressions:
+ return true
+ case PremiumShowcaseProfile:
+ return true
+ case PremiumShowcaseStream:
+ return true
+ case PremiumShowcaseUpload:
+ return true
case SignInBackdrop:
return true
case Symbol:
@@ -2242,22 +2254,27 @@ type InstanceConfigResponse struct {
Accounts AccountsConfigSchema `json:"accounts"`
AppPublic struct {
Branding struct {
- CustomCss *string `json:"custom_css"`
- FaviconDarkUrl *string `json:"favicon_dark_url"`
- FaviconUrl *string `json:"favicon_url"`
- IconUrl *string `json:"icon_url"`
- LogoUrl *string `json:"logo_url"`
- PremiumInfoUrl *string `json:"premium_info_url"`
- PremiumProductName string `json:"premium_product_name"`
- ProductName string `json:"product_name"`
- SignInBackdropUrl *string `json:"sign_in_backdrop_url"`
- StatusPageIncidentHistoryUrl *string `json:"status_page_incident_history_url"`
- StatusPageUrl *string `json:"status_page_url"`
- SymbolUrl *string `json:"symbol_url"`
- ThemeColor *string `json:"theme_color"`
- TrustedDomains []string `json:"trusted_domains"`
- UploadLimitMessage *string `json:"upload_limit_message"`
- WordmarkUrl *string `json:"wordmark_url"`
+ CustomCss *string `json:"custom_css"`
+ FaviconDarkUrl *string `json:"favicon_dark_url"`
+ FaviconUrl *string `json:"favicon_url"`
+ IconUrl *string `json:"icon_url"`
+ LogoUrl *string `json:"logo_url"`
+ PremiumInfoUrl *string `json:"premium_info_url"`
+ PremiumPageColor *string `json:"premium_page_color"`
+ PremiumProductName string `json:"premium_product_name"`
+ PremiumShowcaseExpressionsUrl *string `json:"premium_showcase_expressions_url"`
+ PremiumShowcaseProfileUrl *string `json:"premium_showcase_profile_url"`
+ PremiumShowcaseStreamUrl *string `json:"premium_showcase_stream_url"`
+ PremiumShowcaseUploadUrl *string `json:"premium_showcase_upload_url"`
+ ProductName string `json:"product_name"`
+ SignInBackdropUrl *string `json:"sign_in_backdrop_url"`
+ StatusPageIncidentHistoryUrl *string `json:"status_page_incident_history_url"`
+ StatusPageUrl *string `json:"status_page_url"`
+ SymbolUrl *string `json:"symbol_url"`
+ ThemeColor *string `json:"theme_color"`
+ TrustedDomains []string `json:"trusted_domains"`
+ UploadLimitMessage *string `json:"upload_limit_message"`
+ WordmarkUrl *string `json:"wordmark_url"`
} `json:"branding"`
Legal struct {
GuidelinesUrl *string `json:"guidelines_url"`
@@ -2489,6 +2506,7 @@ type InstanceConfigUpdateRequest struct {
IconUrl *string `json:"icon_url,omitempty"`
LogoUrl *string `json:"logo_url,omitempty"`
PremiumInfoUrl *string `json:"premium_info_url,omitempty"`
+ PremiumPageColor *string `json:"premium_page_color,omitempty"`
PremiumProductName *string `json:"premium_product_name,omitempty"`
ProductName *string `json:"product_name,omitempty"`
SignInBackdropUrl *string `json:"sign_in_backdrop_url,omitempty"`
diff --git a/packages/instance_bootstrap/src/ClientRuntimeDiscovery.ts b/packages/instance_bootstrap/src/ClientRuntimeDiscovery.ts
index 5c3275d9f..519d624cb 100644
--- a/packages/instance_bootstrap/src/ClientRuntimeDiscovery.ts
+++ b/packages/instance_bootstrap/src/ClientRuntimeDiscovery.ts
@@ -170,6 +170,11 @@ function projectAppPublic(appPublic: InstanceDiscoveryDocument['appPublic']): In
premium_product_name: value.branding.premium_product_name ?? DEFAULT_PREMIUM_PRODUCT_NAME,
premium_info_url: value.branding.premium_info_url ?? null,
sign_in_backdrop_url: value.branding.sign_in_backdrop_url ?? null,
+ premium_page_color: value.branding.premium_page_color ?? null,
+ premium_showcase_expressions_url: value.branding.premium_showcase_expressions_url ?? null,
+ premium_showcase_profile_url: value.branding.premium_showcase_profile_url ?? null,
+ premium_showcase_stream_url: value.branding.premium_showcase_stream_url ?? null,
+ premium_showcase_upload_url: value.branding.premium_showcase_upload_url ?? null,
custom_css: value.branding.custom_css ?? null,
upload_limit_message: value.branding.upload_limit_message ?? null,
trusted_domains: value.branding.trusted_domains ?? [],
diff --git a/packages/instance_bootstrap/src/Discovery.ts b/packages/instance_bootstrap/src/Discovery.ts
index 0020f145a..4e55dd34d 100644
--- a/packages/instance_bootstrap/src/Discovery.ts
+++ b/packages/instance_bootstrap/src/Discovery.ts
@@ -94,6 +94,10 @@ const BRANDING_URL_KEYS = Object.freeze([
'status_page_incident_history_url',
'premium_info_url',
'sign_in_backdrop_url',
+ 'premium_showcase_expressions_url',
+ 'premium_showcase_profile_url',
+ 'premium_showcase_stream_url',
+ 'premium_showcase_upload_url',
] as const) satisfies ReadonlyArray<keyof InstanceBranding>;
const SETUP_FLAG_KEYS = Object.freeze([
@@ -931,6 +935,9 @@ function parseBranding(value: unknown): Readonly<Partial<InstanceBranding>> {
if (Object.hasOwn(source, 'theme_color')) {
branding.theme_color = readNonEmptyString(source, 'theme_color');
}
+ if (Object.hasOwn(source, 'premium_page_color')) {
+ branding.premium_page_color = readNonEmptyString(source, 'premium_page_color');
+ }
if (Object.hasOwn(source, 'custom_css')) {
branding.custom_css = readNonEmptyString(source, 'custom_css');
}
diff --git a/packages/instance_bootstrap/src/ThemeColor.ts b/packages/instance_bootstrap/src/ThemeColor.ts
index 938d64ceb..a452b558a 100644
--- a/packages/instance_bootstrap/src/ThemeColor.ts
+++ b/packages/instance_bootstrap/src/ThemeColor.ts
@@ -1,13 +1,17 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
-const HEX_THEME_COLOR_PATTERN = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;
+const HEX_COLOR_PATTERN = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;
const UNSET_THEME_COLOR = '#000000';
-export function normalizeThemeColor(value: unknown): string | null {
+export function normalizeHexColor(value: unknown): string | null {
if (typeof value !== 'string') return null;
- const match = HEX_THEME_COLOR_PATTERN.exec(value.trim());
+ const match = HEX_COLOR_PATTERN.exec(value.trim());
if (match === null) return null;
const digits = match[1].toLowerCase();
- const color = `#${digits.length === 3 ? digits.replace(/./g, '$&$&') : digits}`;
+ return `#${digits.length === 3 ? digits.replace(/./g, '$&$&') : digits}`;
+}
+
+export function normalizeThemeColor(value: unknown): string | null {
+ const color = normalizeHexColor(value);
return color === UNSET_THEME_COLOR ? null : color;
}
diff --git a/packages/schema/src/domains/admin/AdminSchemas.ts b/packages/schema/src/domains/admin/AdminSchemas.ts
index f5afeb97a..b0a9f271f 100644
--- a/packages/schema/src/domains/admin/AdminSchemas.ts
+++ b/packages/schema/src/domains/admin/AdminSchemas.ts
@@ -617,6 +617,11 @@ const AppPublicConfigResponse = z.object({
premium_product_name: z.string(),
premium_info_url: z.string().nullable(),
sign_in_backdrop_url: z.string().nullable(),
+ premium_page_color: z.string().nullable(),
+ premium_showcase_expressions_url: z.string().nullable(),
+ premium_showcase_profile_url: z.string().nullable(),
+ premium_showcase_stream_url: z.string().nullable(),
+ premium_showcase_upload_url: z.string().nullable(),
custom_css: z.string().nullable(),
upload_limit_message: z.string().nullable(),
trusted_domains: z.array(z.string()),
@@ -665,6 +670,7 @@ const AppPublicConfigUpdateRequest = z.object({
premium_product_name: z.string().trim().min(1).max(40).nullable().optional(),
premium_info_url: z.string().trim().max(2048).refine(isAbsoluteHttpUrl).nullish(),
sign_in_backdrop_url: z.string().trim().max(2048).nullish(),
+ premium_page_color: z.string().trim().regex(HEX_THEME_COLOR_PATTERN).nullish(),
custom_css: z.string().trim().max(32_768).nullish(),
upload_limit_message: z.string().trim().max(UPLOAD_LIMIT_MESSAGE_MAX_LENGTH).nullish(),
trusted_domains: z.array(z.string().max(255)).max(TRUSTED_DOMAINS_MAX).nullish(),
@@ -1039,7 +1045,19 @@ export const InstanceConfigUpdateRequest = z.object({
export type InstanceConfigUpdateRequest = z.infer<typeof InstanceConfigUpdateRequest>;
export const BrandingAssetUploadRequest = z.object({
- kind: z.enum(['icon', 'symbol', 'logo', 'wordmark', 'favicon', 'favicon_dark', 'sign_in_backdrop']),
+ kind: z.enum([
+ 'icon',
+ 'symbol',
+ 'logo',
+ 'wordmark',
+ 'favicon',
+ 'favicon_dark',
+ 'sign_in_backdrop',
+ 'premium_showcase_expressions',
+ 'premium_showcase_profile',
+ 'premium_showcase_stream',
+ 'premium_showcase_upload',
+ ]),
image: z.string().max(16_000_000).nullish(),
});
diff --git a/packages/schema/src/domains/instance/InstanceSchemas.ts b/packages/schema/src/domains/instance/InstanceSchemas.ts
index 5cde59627..fde3bd326 100644
--- a/packages/schema/src/domains/instance/InstanceSchemas.ts
+++ b/packages/schema/src/domains/instance/InstanceSchemas.ts
@@ -81,6 +81,34 @@ export const InstanceBrandingSchema = z
.string()
.nullable()
.describe('Optional image URL drawn behind the sign-in card on a self-hosted instance'),
+ premium_page_color: z
+ .string()
+ .nullable()
+ .describe('Optional hex color a self-hosted instance uses to recolor its premium page'),
+ premium_showcase_expressions_url: z
+ .string()
+ .nullable()
+ .describe(
+ 'Optional image a self-hosted instance shows next to the "Your emojis, everywhere" card on its premium page',
+ ),
+ premium_showcase_profile_url: z
+ .string()
+ .nullable()
+ .describe(
+ 'Optional image a self-hosted instance shows next to the "A profile that stands out" card on its premium page',
+ ),
+ premium_showcase_stream_url: z
+ .string()
+ .nullable()
+ .describe(
+ 'Optional image a self-hosted instance shows next to the "Stream in 4K at 60 FPS" card on its premium page',
+ ),
+ premium_showcase_upload_url: z
+ .string()
+ .nullable()
+ .describe(
+ 'Optional image a self-hosted instance shows next to the card about file size limits on its premium page',
+ ),
custom_css: z
.string()
.nullable()