Add customHomeserver url Param (#2190)
* Add customHomeserver url to urlParams. Signed-off-by: Timo K <toger5@hotmail.de> * rename to homeserver Signed-off-by: Timo K <toger5@hotmail.de> --------- Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
@@ -199,3 +199,23 @@ If set to false, the widget will show a blank page after leaving the call.
|
|||||||
```
|
```
|
||||||
returnToLobby: boolean; (default: false)
|
returnToLobby: boolean; (default: false)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**viaServers**
|
||||||
|
This defines the homeserver that is going to be used when joining a room.
|
||||||
|
It has to be set to a non default value for links to rooms
|
||||||
|
that are not on the default homeserver,
|
||||||
|
that is in use for the current user.
|
||||||
|
|
||||||
|
```
|
||||||
|
viaServers: string; (default: undefined)
|
||||||
|
```
|
||||||
|
|
||||||
|
**homeserver**
|
||||||
|
This defines the homeserver that is going to be used when registering
|
||||||
|
a new (guest) user.
|
||||||
|
This can be user to configure a non default guest user server when
|
||||||
|
creating a spa link.
|
||||||
|
|
||||||
|
```
|
||||||
|
homeserver: string; (default: undefined)
|
||||||
|
```
|
||||||
|
|||||||
@@ -130,6 +130,20 @@ export interface UrlParams {
|
|||||||
* This is useful for video rooms.
|
* This is useful for video rooms.
|
||||||
*/
|
*/
|
||||||
returnToLobby: boolean;
|
returnToLobby: boolean;
|
||||||
|
/**
|
||||||
|
* This defines the homeserver that is going to be used when joining a room.
|
||||||
|
* It has to be set to a non default value for links to rooms
|
||||||
|
* that are not on the default homeserver,
|
||||||
|
* that is in use for the current user.
|
||||||
|
*/
|
||||||
|
viaServers: string | null;
|
||||||
|
/**
|
||||||
|
* This defines the homeserver that is going to be used when registering
|
||||||
|
* a new (guest) user.
|
||||||
|
* This can be user to configure a non default guest user server when
|
||||||
|
* creating a spa link.
|
||||||
|
*/
|
||||||
|
homeserver: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is here as a stopgap, but what would be far nicer is a function that
|
// This is here as a stopgap, but what would be far nicer is a function that
|
||||||
@@ -229,6 +243,8 @@ export const getUrlParams = (
|
|||||||
perParticipantE2EE: parser.getFlagParam("perParticipantE2EE"),
|
perParticipantE2EE: parser.getFlagParam("perParticipantE2EE"),
|
||||||
skipLobby: parser.getFlagParam("skipLobby"),
|
skipLobby: parser.getFlagParam("skipLobby"),
|
||||||
returnToLobby: parser.getFlagParam("returnToLobby"),
|
returnToLobby: parser.getFlagParam("returnToLobby"),
|
||||||
|
viaServers: parser.getParam("viaServers"),
|
||||||
|
homeserver: parser.getParam("homeserver"),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { getUrlParams } from "../UrlParams";
|
||||||
import {
|
import {
|
||||||
DEFAULT_CONFIG,
|
DEFAULT_CONFIG,
|
||||||
ConfigOptions,
|
ConfigOptions,
|
||||||
@@ -45,10 +46,18 @@ export class Config {
|
|||||||
|
|
||||||
// Convenience accessors
|
// Convenience accessors
|
||||||
public static defaultHomeserverUrl(): string | undefined {
|
public static defaultHomeserverUrl(): string | undefined {
|
||||||
return Config.get().default_server_config?.["m.homeserver"].base_url;
|
return (
|
||||||
|
getUrlParams().homeserver ??
|
||||||
|
Config.get().default_server_config?.["m.homeserver"].base_url
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static defaultServerName(): string | undefined {
|
public static defaultServerName(): string | undefined {
|
||||||
|
const homeserver = getUrlParams().homeserver;
|
||||||
|
if (homeserver) {
|
||||||
|
const url = new URL(homeserver);
|
||||||
|
return url.hostname;
|
||||||
|
}
|
||||||
return Config.get().default_server_config?.["m.homeserver"].server_name;
|
return Config.get().default_server_config?.["m.homeserver"].server_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user