feat: Android APP V1 - Experimental Alpha

This commit is contained in:
2026-06-05 07:40:25 +02:00
parent bf4e6891d1
commit 9a1305f976
179 changed files with 8031 additions and 120 deletions

View File

@@ -0,0 +1,19 @@
import {
describe,
expect,
it
} from 'vitest';
import { endpointSupportsServerDiscovery } from './server-discovery.rules';
describe('server-discovery.rules', () => {
it('skips discovery calls for production signal hosts without featured/trending routes', () => {
expect(endpointSupportsServerDiscovery('https://signal.toju.app')).toBe(false);
expect(endpointSupportsServerDiscovery('https://signal-sweden.toju.app')).toBe(false);
});
it('allows discovery on local and custom signal servers', () => {
expect(endpointSupportsServerDiscovery('http://localhost:3001')).toBe(true);
expect(endpointSupportsServerDiscovery('https://signal.example.com')).toBe(true);
});
});

View File

@@ -0,0 +1,16 @@
/** Hostnames known to run older signal servers without featured/trending discovery routes. */
const DISCOVERY_UNSUPPORTED_HOSTS = new Set([
'signal.toju.app',
'signal-sweden.toju.app'
]);
/** Returns false when discovery endpoints are known to 404 on the active signal server. */
export function endpointSupportsServerDiscovery(baseUrl: string): boolean {
try {
const hostname = new URL(baseUrl).hostname;
return !DISCOVERY_UNSUPPORTED_HOSTS.has(hostname);
} catch {
return true;
}
}

View File

@@ -35,6 +35,7 @@ import type {
UnbanServerMemberRequest
} from '../../domain/models/server-directory.model';
import type { RoomSignalSourceInput } from '../../domain/logic/room-signal-source.logic';
import { endpointSupportsServerDiscovery } from '../../domain/logic/server-discovery.rules';
interface ServerLookupError {
status?: number;
@@ -297,6 +298,12 @@ export class ServerDirectoryApiService {
}
private getDiscoveryServers(kind: 'featured' | 'trending', limit?: number): Observable<ServerInfo[]> {
const baseUrl = this.resolveBaseServerUrl();
if (!endpointSupportsServerDiscovery(baseUrl)) {
return of([]);
}
const params = typeof limit === 'number' ? new HttpParams().set('limit', String(limit)) : undefined;
return this.http