Default homeserver is gamecult.org #86
3 changed files with 30 additions and 3 deletions
11
config.json
11
config.json
|
|
@ -1,6 +1,13 @@
|
|||
{
|
||||
"defaultHomeserver": 1,
|
||||
"homeserverList": ["converser.eu", "matrix.org", "mozilla.org", "unredacted.org", "xmr.se"],
|
||||
"defaultHomeserver": 0,
|
||||
"homeserverList": [
|
||||
"gamecult.org",
|
||||
"converser.eu",
|
||||
"matrix.org",
|
||||
"mozilla.org",
|
||||
"unredacted.org",
|
||||
"xmr.se"
|
||||
],
|
||||
"allowCustomHomeservers": true,
|
||||
"featuredCommunities": {
|
||||
"openAsDefault": false,
|
||||
|
|
|
|||
20
src/app/hooks/useClientConfig.test.ts
Normal file
20
src/app/hooks/useClientConfig.test.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { describe, expect, it } from 'vitest';
|
||||
import { clientDefaultServer } from './useClientConfig';
|
||||
import config from '../../../config.json';
|
||||
|
||||
describe('default homeserver', () => {
|
||||
it('is gamecult.org when the config names none', () => {
|
||||
expect(clientDefaultServer({})).toBe('gamecult.org');
|
||||
expect(clientDefaultServer({ homeserverList: [] })).toBe('gamecult.org');
|
||||
});
|
||||
|
||||
it('is the listed server the config points at', () => {
|
||||
expect(
|
||||
clientDefaultServer({ homeserverList: ['chat.gamecult.org'], defaultHomeserver: 0 })
|
||||
).toBe('chat.gamecult.org');
|
||||
});
|
||||
|
||||
it('is gamecult.org in the repo config.json too', () => {
|
||||
expect(clientDefaultServer(config)).toBe('gamecult.org');
|
||||
});
|
||||
});
|
||||
|
|
@ -44,7 +44,7 @@ export function useClientConfig(): ClientConfig {
|
|||
}
|
||||
|
||||
export const clientDefaultServer = (clientConfig: ClientConfig): string =>
|
||||
clientConfig.homeserverList?.[clientConfig.defaultHomeserver ?? 0] ?? 'matrix.org';
|
||||
clientConfig.homeserverList?.[clientConfig.defaultHomeserver ?? 0] ?? 'gamecult.org';
|
||||
|
||||
export const clientAllowedServer = (clientConfig: ClientConfig, server: string): boolean => {
|
||||
const { homeserverList, allowCustomHomeservers } = clientConfig;
|
||||
|
|
|
|||
Loading…
Reference in a new issue