From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id E218B96226 for ; Mon, 15 Apr 2024 12:30:35 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 57B7D7A28 for ; Mon, 15 Apr 2024 12:30:35 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 15 Apr 2024 12:30:31 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 1E05F44AC3 for ; Mon, 15 Apr 2024 12:30:29 +0200 (CEST) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Mon, 15 Apr 2024 12:30:24 +0200 Message-Id: <20240415103027.3000412-6-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240415103027.3000412-1-d.csapak@proxmox.com> References: <20240415103027.3000412-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.014 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH pve-flutter-frontend 2/5] console: wrap console with appbar X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Apr 2024 10:30:35 -0000 so one can return to the previous view without having to use the back button of the device. Signed-off-by: Dominik Csapak --- lib/widgets/pve_console_menu_widget.dart | 107 ++++++++++++----------- 1 file changed, 57 insertions(+), 50 deletions(-) diff --git a/lib/widgets/pve_console_menu_widget.dart b/lib/widgets/pve_console_menu_widget.dart index 243baf1..9c91d30 100644 --- a/lib/widgets/pve_console_menu_widget.dart +++ b/lib/widgets/pve_console_menu_widget.dart @@ -234,63 +234,70 @@ class PVEWebConsoleState extends State { value: ticket, ), builder: (context, snapshot) { - return SafeArea( - child: InAppWebView( - onReceivedServerTrustAuthRequest: (controller, challenge) async { - final cert = challenge.protectionSpace.sslCertificate; - final certBytes = cert?.x509Certificate?.encoded; - final sslError = challenge.protectionSpace.sslError?.message; + return Scaffold( + appBar: AppBar( + title: const Text("Console"), + ), + body: SafeArea( + child: InAppWebView( + onReceivedServerTrustAuthRequest: + (controller, challenge) async { + final cert = challenge.protectionSpace.sslCertificate; + final certBytes = cert?.x509Certificate?.encoded; + final sslError = + challenge.protectionSpace.sslError?.message; - String? issuedTo = cert?.issuedTo?.CName.toString(); - String? hash = certBytes != null - ? sha256.convert(certBytes).toString() - : null; + String? issuedTo = cert?.issuedTo?.CName.toString(); + String? hash = certBytes != null + ? sha256.convert(certBytes).toString() + : null; - final settings = - await ProxmoxGeneralSettingsModel.fromLocalStorage(); + final settings = + await ProxmoxGeneralSettingsModel.fromLocalStorage(); - bool trust = false; - if (hash != null && settings.trustedFingerprints != null) { - trust = settings.trustedFingerprints!.contains(hash); - } + bool trust = false; + if (hash != null && settings.trustedFingerprints != null) { + trust = settings.trustedFingerprints!.contains(hash); + } - if (!trust) { - // format hash to '01:23:...' format - String? formattedHash = hash?.toUpperCase().replaceAllMapped( - RegExp(r"[a-zA-Z0-9]{2}"), - (match) => "${match.group(0)}:"); - formattedHash = formattedHash?.substring( - 0, formattedHash.length - 1); // remove last ':' + if (!trust) { + // format hash to '01:23:...' format + String? formattedHash = hash + ?.toUpperCase() + .replaceAllMapped(RegExp(r"[a-zA-Z0-9]{2}"), + (match) => "${match.group(0)}:"); + formattedHash = formattedHash?.substring( + 0, formattedHash.length - 1); // remove last ':' - if (context.mounted) { - trust = await showTLSWarning( - context, - sslError ?? 'An unknown TLS error has occurred', - issuedTo ?? 'unknown', - formattedHash ?? 'unknown'); - } - } + if (context.mounted) { + trust = await showTLSWarning( + context, + sslError ?? 'An unknown TLS error has occurred', + issuedTo ?? 'unknown', + formattedHash ?? 'unknown'); + } + } - // save Fingerprint - if (trust && hash != null) { - await settings - .rebuild((b) => b..trustedFingerprints.add(hash)) - .toLocalStorage(); - print(settings.toJson()); - } + // save Fingerprint + if (trust && hash != null) { + await settings + .rebuild((b) => b..trustedFingerprints.add(hash)) + .toLocalStorage(); + print(settings.toJson()); + } - final action = trust - ? ServerTrustAuthResponseAction.PROCEED - : ServerTrustAuthResponseAction.CANCEL; - return ServerTrustAuthResponse(action: action); - }, - onWebViewCreated: (controller) { - webViewController = controller; - controller.loadUrl( - urlRequest: URLRequest(url: Uri.parse(consoleUrl))); - }, - ), - ); + final action = trust + ? ServerTrustAuthResponseAction.PROCEED + : ServerTrustAuthResponseAction.CANCEL; + return ServerTrustAuthResponse(action: action); + }, + onWebViewCreated: (controller) { + webViewController = controller; + controller.loadUrl( + urlRequest: URLRequest(url: Uri.parse(consoleUrl))); + }, + ), + )); }); } -- 2.39.2