fix(selfhost): branding image origins and theme colour (#3389)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-11 13:31:05 +02:00
1 parent cca8227ca6
commit edc913096a
27 files changed
+724 -49

No files matched your search

@@ -219,6 +219,33 @@ describe('InstanceConfigRepository', () => {
expect(config.branding.product_name).toBe('Kept');
});
it('serves the theme colour as six-digit hex and drops a stored value that is not hex', async () => {
setCassandraQueryExecutorForTesting(new InMemoryCassandraQueryExecutor());
const repository = createRepository(new MockKVProvider());
expect((await repository.setAppPublicConfig({branding: {theme_color: '7B2CE4'}})).branding.theme_color).toBe(
'#7b2ce4',
);
expect((await repository.setAppPublicConfig({branding: {theme_color: '#AbC'}})).branding.theme_color).toBe(
'#aabbcc',
);
await repository.setConfig(APP_PUBLIC_CONFIG_KEY, JSON.stringify({branding: {theme_color: 'rgb(123, 44, 228)'}}));
expect((await repository.getAppPublicConfig()).branding.theme_color).toBeNull();
});
it('treats the black theme colour the setup wizard used to store as unset', async () => {
setCassandraQueryExecutorForTesting(new InMemoryCassandraQueryExecutor());
const repository = createRepository(new MockKVProvider());
await repository.setConfig(APP_PUBLIC_CONFIG_KEY, JSON.stringify({branding: {theme_color: '#000000'}}));
expect((await repository.getAppPublicConfig()).branding.theme_color).toBeNull();
expect((await repository.setAppPublicConfig({branding: {theme_color: '#000'}})).branding.theme_color).toBeNull();
expect((await repository.setAppPublicConfig({branding: {theme_color: '#000001'}})).branding.theme_color).toBe(
'#000001',
);
});
it('stores uploaded branding assets as references and resolves them against the current media endpoint', async () => {
setCassandraQueryExecutorForTesting(new CountingInMemoryCassandraQueryExecutor());
const repository = createRepository(new MockKVProvider());