From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-flutter-frontend 2/5] console: wrap console with appbar
Date: Mon, 15 Apr 2024 12:30:24 +0200 [thread overview]
Message-ID: <20240415103027.3000412-6-d.csapak@proxmox.com> (raw)
In-Reply-To: <20240415103027.3000412-1-d.csapak@proxmox.com>
so one can return to the previous view without having to use the back
button of the device.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
| 107 ++++++++++++-----------
1 file changed, 57 insertions(+), 50 deletions(-)
--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<PVEWebConsole> {
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
next prev parent reply other threads:[~2024-04-15 10:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-15 10:30 [pve-devel] [PATCH flutter-repositories] some improvements/fixes for the app Dominik Csapak
2024-04-15 10:30 ` [pve-devel] [PATCH proxmox-dart-api-client 1/1] client: correctly set parameter for node actions Dominik Csapak
2024-04-16 15:07 ` [pve-devel] applied: " Thomas Lamprecht
2024-04-15 10:30 ` [pve-devel] [PATCH proxmox-login-manager 1/2] login: show custom alert dialog for password saving errors Dominik Csapak
2024-04-16 15:08 ` [pve-devel] applied: " Thomas Lamprecht
2024-04-15 10:30 ` [pve-devel] [PATCH proxmox-login-manager 2/2] general settings: add trustedFingerprints list Dominik Csapak
2024-04-15 10:30 ` [pve-devel] [PATCH pve-flutter-frontend 1/5] console: use flutter inappwebview as webview Dominik Csapak
2024-04-15 10:30 ` Dominik Csapak [this message]
2024-04-15 10:30 ` [pve-devel] [PATCH pve-flutter-frontend 3/5] node overview: use correct color for rrd icons Dominik Csapak
2024-04-15 10:30 ` [pve-devel] [PATCH pve-flutter-frontend 4/5] nove overview: add power settings menu Dominik Csapak
2024-04-16 15:11 ` Thomas Lamprecht
2024-04-15 10:30 ` [pve-devel] [PATCH pve-flutter-frontend 5/5] improve back button behavior Dominik Csapak
2024-04-16 15:11 ` [pve-devel] applied: [PATCH flutter-repositories] some improvements/fixes for the app Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240415103027.3000412-6-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal