all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH pve_flutter_frontend] ui: enable noVNC console on iOS
@ 2025-05-12 15:10 Shan Shaji
  2025-07-23 11:28 ` Shan Shaji
  0 siblings, 1 reply; 2+ messages in thread
From: Shan Shaji @ 2025-05-12 15:10 UTC (permalink / raw)
  To: pve-devel

This patch enables the noVNC console view on iOS devices. It also
includes a refactor of the function responsible for displaying the
webview. Additionally, an `AppBar` has been added to the console view on
iOS to allow users to easily close the view.

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
 lib/widgets/pve_console_menu_widget.dart | 86 +++++++++++-------------
 1 file changed, 40 insertions(+), 46 deletions(-)

diff --git a/lib/widgets/pve_console_menu_widget.dart b/lib/widgets/pve_console_menu_widget.dart
index f4bd8d3..e9481c0 100644
--- a/lib/widgets/pve_console_menu_widget.dart
+++ b/lib/widgets/pve_console_menu_widget.dart
@@ -103,45 +103,19 @@ class PveConsoleMenu extends StatelessWidget {
                   }
                 },
               ),
-            if (Platform.isAndroid) // web_view is only available for mobile :(
+
+            // web_view is only available for mobile :(
+            // xterm.js doesn't work that well on mobile
+            if (Platform.isAndroid || Platform.isIOS)
               ListTile(
                 title: const Text(
-                  //type == "qemu" ? "noVNC Console" : "xterm.js Console",
-                  "noVNC Console", // xterm.js doesn't work that well on mobile
+                  "noVNC Console",
                   style: TextStyle(fontWeight: FontWeight.bold),
                 ),
                 subtitle: const Text("Open console view"),
-                onTap: () async {
-                  if (Platform.isAndroid) {
-                    if (['qemu', 'lxc'].contains(type)) {
-                      SystemChrome.setEnabledSystemUIMode(
-                          SystemUiMode.immersive);
-                      Navigator.of(context)
-                          .push(_createHTMLConsoleRoute())
-                          .then((completion) {
-                        SystemChrome.setEnabledSystemUIMode(
-                            SystemUiMode.edgeToEdge,
-                            overlays: [
-                              SystemUiOverlay.top,
-                              SystemUiOverlay.bottom
-                            ]);
-                      });
-                    } else if (type == 'node') {
-                      SystemChrome.setEnabledSystemUIMode(
-                          SystemUiMode.immersive);
-                      Navigator.of(context)
-                          .push(_createHTMLConsoleRoute())
-                          .then((completion) {
-                        SystemChrome.setEnabledSystemUIMode(
-                            SystemUiMode.edgeToEdge,
-                            overlays: [
-                              SystemUiOverlay.top,
-                              SystemUiOverlay.bottom
-                            ]);
-                      });
-                    }
-                  } else {
-                    print('not implemented for current platform');
+                onTap: () {
+                  if (['qemu', 'lxc'].contains(type) || type == 'node') {
+                    _openNoVncConsole(context);
                   }
                 },
               ),
@@ -151,6 +125,18 @@ class PveConsoleMenu extends StatelessWidget {
     );
   }
 
+  Future<void> _openNoVncConsole(BuildContext context) async {
+    SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
+    await Navigator.push(context, _createHTMLConsoleRoute());
+    SystemChrome.setEnabledSystemUIMode(
+      SystemUiMode.edgeToEdge,
+      overlays: [
+        SystemUiOverlay.top,
+        SystemUiOverlay.bottom,
+      ],
+    );
+  }
+
   void showTextDialog(BuildContext context, String title, String content) {
     showDialog(
       context: context,
@@ -232,14 +218,16 @@ class PVEWebConsoleState extends State<PVEWebConsole> {
     WidgetsFlutterBinding.ensureInitialized();
 
     return FutureBuilder(
-        future: CookieManager.instance().setCookie(
-          url: WebUri(consoleUrl),
-          name: 'PVEAuthCookie',
-          value: ticket,
-        ),
-        builder: (context, snapshot) {
-          return ColoredSafeArea(
-            child: InAppWebView(
+      future: CookieManager.instance().setCookie(
+        url: WebUri(consoleUrl),
+        name: 'PVEAuthCookie',
+        value: ticket,
+      ),
+      builder: (context, snapshot) {
+        return ColoredSafeArea(
+          child: Scaffold(
+            appBar: Platform.isIOS ? AppBar() : null,
+            body: InAppWebView(
               onReceivedServerTrustAuthRequest: (controller, challenge) async {
                 final cert = challenge.protectionSpace.sslCertificate;
                 final certBytes = cert?.x509Certificate?.encoded;
@@ -294,12 +282,18 @@ class PVEWebConsoleState extends State<PVEWebConsole> {
                     urlRequest: URLRequest(url: WebUri(consoleUrl)));
               },
             ),
-          );
-        });
+          ),
+        );
+      },
+    );
   }
 
-  Future<bool> showTLSWarning(BuildContext context, String sslError,
-      String issuedTo, String hash) async {
+  Future<bool> showTLSWarning(
+    BuildContext context,
+    String sslError,
+    String issuedTo,
+    String hash,
+  ) async {
     return await showDialog(
         context: context,
         barrierDismissible: false,
-- 
2.39.5 (Apple Git-154)



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [pve-devel] [PATCH pve_flutter_frontend] ui: enable noVNC console on iOS
  2025-05-12 15:10 [pve-devel] [PATCH pve_flutter_frontend] ui: enable noVNC console on iOS Shan Shaji
@ 2025-07-23 11:28 ` Shan Shaji
  0 siblings, 0 replies; 2+ messages in thread
From: Shan Shaji @ 2025-07-23 11:28 UTC (permalink / raw)
  To: Proxmox VE development discussion

Ping

On Mon May 12, 2025 at 5:10 PM CEST, Shan Shaji wrote:
> This patch enables the noVNC console view on iOS devices. It also
> includes a refactor of the function responsible for displaying the
> webview. Additionally, an `AppBar` has been added to the console view on
> iOS to allow users to easily close the view.
>
> Signed-off-by: Shan Shaji <s.shaji@proxmox.com>



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-23 11:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-12 15:10 [pve-devel] [PATCH pve_flutter_frontend] ui: enable noVNC console on iOS Shan Shaji
2025-07-23 11:28 ` Shan Shaji

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