mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-13 20:10:07 +02:00
support secondary public server URL
This commit is contained in:
@@ -1,4 +1,25 @@
|
||||
import { ServerListItem } from '/@/shared/types/domain-types';
|
||||
|
||||
export const normalizeServerUrl = (url: string) => {
|
||||
// Remove trailing slash
|
||||
return url.endsWith('/') ? url.slice(0, -1) : url;
|
||||
};
|
||||
|
||||
export const getServerUrl = (
|
||||
server: null | ServerListItem | undefined,
|
||||
forceRemoteUrl?: boolean,
|
||||
): string | undefined => {
|
||||
if (!server) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!forceRemoteUrl && !server.preferRemoteUrl) {
|
||||
return server.url;
|
||||
}
|
||||
|
||||
if (!server.remoteUrl) {
|
||||
return server.url;
|
||||
}
|
||||
|
||||
return server.remoteUrl;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user