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:
Timo
2024-02-21 21:52:31 +01:00
committed by GitHub
parent 30b3ba302e
commit cfb0aa5793
3 changed files with 46 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import { getUrlParams } from "../UrlParams";
import {
DEFAULT_CONFIG,
ConfigOptions,
@@ -45,10 +46,18 @@ export class Config {
// Convenience accessors
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 {
const homeserver = getUrlParams().homeserver;
if (homeserver) {
const url = new URL(homeserver);
return url.hostname;
}
return Config.get().default_server_config?.["m.homeserver"].server_name;
}