fix: SSO on web

This commit is contained in:
Christian Pauly 2021-06-18 15:36:27 +02:00
parent cf37d56778
commit 826d8778dd
2 changed files with 2 additions and 1 deletions

View File

@ -18,6 +18,7 @@ abstract class AppConfig {
static String get privacyUrl => _privacyUrl; static String get privacyUrl => _privacyUrl;
static const String appId = 'im.fluffychat.FluffyChat'; static const String appId = 'im.fluffychat.FluffyChat';
static const String appOpenUrlScheme = 'im.fluffychat'; static const String appOpenUrlScheme = 'im.fluffychat';
static const String webBaseUrl = 'https://fluffychat.im/web';
static const String sourceCodeUrl = 'https://gitlab.com/famedly/fluffychat'; static const String sourceCodeUrl = 'https://gitlab.com/famedly/fluffychat';
static const String supportUrl = static const String supportUrl =
'https://gitlab.com/famedly/fluffychat/issues'; 'https://gitlab.com/famedly/fluffychat/issues';

View File

@ -198,7 +198,7 @@ class HomeserverPickerController extends State<HomeserverPicker> {
ssoHomeserverKey, Matrix.of(context).client.homeserver.toString()); ssoHomeserverKey, Matrix.of(context).client.homeserver.toString());
} }
final redirectUrl = kIsWeb final redirectUrl = kIsWeb
? html.window.location.href ? AppConfig.webBaseUrl
: AppConfig.appOpenUrlScheme.toLowerCase() + '://login'; : AppConfig.appOpenUrlScheme.toLowerCase() + '://login';
launch( launch(
'${Matrix.of(context).client.homeserver?.toString()}/_matrix/client/r0/login/sso/redirect/${Uri.encodeComponent(id)}?redirectUrl=${Uri.encodeQueryComponent(redirectUrl)}', '${Matrix.of(context).client.homeserver?.toString()}/_matrix/client/r0/login/sso/redirect/${Uri.encodeComponent(id)}?redirectUrl=${Uri.encodeQueryComponent(redirectUrl)}',