feat: Add game activity status (Experimental)
All checks were successful
Queue Release Build / prepare (push) Successful in 23s
Deploy Web Apps / deploy (push) Successful in 5m54s
Queue Release Build / build-windows (push) Successful in 16m19s
Queue Release Build / build-linux (push) Successful in 30m13s
Queue Release Build / finalize (push) Successful in 47s
All checks were successful
Queue Release Build / prepare (push) Successful in 23s
Deploy Web Apps / deploy (push) Successful in 5m54s
Queue Release Build / build-windows (push) Successful in 16m19s
Queue Release Build / build-linux (push) Successful in 30m13s
Queue Release Build / finalize (push) Successful in 47s
This commit is contained in:
@@ -157,6 +157,14 @@ describe('ServerEndpointStateService', () => {
|
||||
expect(service.servers().find((candidate) => candidate.id === endpoint.id)?.isActive).toBe(true);
|
||||
});
|
||||
|
||||
it('resolves legacy https source URLs to the local http default endpoint on the same host', () => {
|
||||
const defaultServer = getConfiguredDefaultServer('default');
|
||||
const service = createService();
|
||||
const legacyHttpsUrl = defaultServer.url?.replace(/^http:\/\//, 'https://') ?? '';
|
||||
|
||||
expect(service.findServerByUrl(legacyHttpsUrl)?.url).toBe(defaultServer.url);
|
||||
});
|
||||
|
||||
it('persists turning a configured default endpoint off and back on', () => {
|
||||
const defaultServer = getConfiguredDefaultServer('toju-primary');
|
||||
const service = createService();
|
||||
|
||||
@@ -117,8 +117,9 @@ export class ServerEndpointStateService {
|
||||
|
||||
findServerByUrl(url: string): ServerEndpoint | undefined {
|
||||
const sanitisedUrl = this.sanitiseUrl(url);
|
||||
const exactEndpoint = this._servers().find((endpoint) => this.sanitiseUrl(endpoint.url) === sanitisedUrl);
|
||||
|
||||
return this._servers().find((endpoint) => this.sanitiseUrl(endpoint.url) === sanitisedUrl);
|
||||
return exactEndpoint ?? this.findHttpEndpointForHttpsUrl(sanitisedUrl);
|
||||
}
|
||||
|
||||
resolveCanonicalEndpoint(endpoint: ServerEndpoint | null | undefined): ServerEndpoint | null {
|
||||
@@ -447,4 +448,28 @@ export class ServerEndpointStateService {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private findHttpEndpointForHttpsUrl(url: string): ServerEndpoint | undefined {
|
||||
const requestedUrl = this.parseUrl(url);
|
||||
|
||||
if (requestedUrl?.protocol !== 'https:') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return this._servers().find((endpoint) => {
|
||||
const endpointUrl = this.parseUrl(endpoint.url);
|
||||
|
||||
return endpointUrl?.protocol === 'http:'
|
||||
&& endpointUrl.hostname === requestedUrl.hostname
|
||||
&& endpointUrl.port === requestedUrl.port;
|
||||
});
|
||||
}
|
||||
|
||||
private parseUrl(url: string): URL | null {
|
||||
try {
|
||||
return new URL(url);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user