From e58037e48244cfd4224b0ccd3831a3364d6fa340 Mon Sep 17 00:00:00 2001 From: Airyzz <36567925+Airyzz@users.noreply.github.com> Date: Sat, 26 Oct 2024 12:35:07 +1030 Subject: [PATCH 1/2] dont use authenticated media for SSO login brand images --- .../matrix/auth/matrix_sso_login_flow.dart | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/commet/lib/client/matrix/auth/matrix_sso_login_flow.dart b/commet/lib/client/matrix/auth/matrix_sso_login_flow.dart index 2e12e855..12f4fc8f 100644 --- a/commet/lib/client/matrix/auth/matrix_sso_login_flow.dart +++ b/commet/lib/client/matrix/auth/matrix_sso_login_flow.dart @@ -30,11 +30,26 @@ class MatrixSSOLoginFlow implements SsoLoginFlow { id: json['id'], name: json['name'], icon: json['icon'] != null - ? MatrixMxcImage(Uri.parse(json['icon']), client.getMatrixClient()) + ? getLoginFlowImage( + Uri.parse( + json['icon'], + ), + client, + ) : null, brand: json['brand'], ); + static NetworkImage getLoginFlowImage(Uri mxc, MatrixClient client) { + var path = + '_matrix/media/v3/thumbnail/${Uri.encodeComponent(mxc.authority)}/${Uri.encodeComponent(mxc.pathSegments.first)}'; + + var server = client.getMatrixClient().baseUri!; + var request = + server.replace(path: path, query: "width=96&height=96&method=crop"); + return NetworkImage(request.toString()); + } + @override Future submit(Client client) async { if (client is! MatrixClient) { From fb9d7a93ac139f51dd2f7509f05c753bd6f33726 Mon Sep 17 00:00:00 2001 From: Airyzz <36567925+Airyzz@users.noreply.github.com> Date: Sat, 26 Oct 2024 12:35:21 +1030 Subject: [PATCH 2/2] Update matrix_sso_login_flow.dart --- commet/lib/client/matrix/auth/matrix_sso_login_flow.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/commet/lib/client/matrix/auth/matrix_sso_login_flow.dart b/commet/lib/client/matrix/auth/matrix_sso_login_flow.dart index 12f4fc8f..47bac913 100644 --- a/commet/lib/client/matrix/auth/matrix_sso_login_flow.dart +++ b/commet/lib/client/matrix/auth/matrix_sso_login_flow.dart @@ -1,7 +1,6 @@ import 'package:commet/client/auth.dart'; import 'package:commet/client/client.dart'; import 'package:commet/client/matrix/matrix_client.dart'; -import 'package:commet/client/matrix/matrix_mxc_image_provider.dart'; import 'package:commet/config/platform_utils.dart'; import 'package:commet/debug/log.dart'; import 'package:commet/utils/custom_uri.dart';