From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <lstechauner@dana.proxmox.com>
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) server-digest SHA256)
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 4ABEC75874
 for <pve-devel@lists.proxmox.com>; Thu, 22 Apr 2021 09:50:20 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 31E9818599
 for <pve-devel@lists.proxmox.com>; Thu, 22 Apr 2021 09:49:50 +0200 (CEST)
Received: from dana.proxmox.com (unknown [94.136.29.99])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 1102A1858F
 for <pve-devel@lists.proxmox.com>; Thu, 22 Apr 2021 09:49:49 +0200 (CEST)
Received: by dana.proxmox.com (Postfix, from userid 10037)
 id DFAE61C4DCE; Thu, 22 Apr 2021 09:49:42 +0200 (CEST)
From: Lorenz Stechauner <l.stechauner@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Thu, 22 Apr 2021 09:49:02 +0200
Message-Id: <20210422074902.32118-1-l.stechauner@proxmox.com>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  2
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery
 methods
 NO_DNS_FOR_FROM         0.379 Envelope sender has no MX or A DNS records
 RDNS_NONE 1.274 Delivered to internal network by a host with no rDNS
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_NONE                0.001 SPF: sender does not publish an SPF Record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [link.download]
Subject: [pve-devel] [PATCH manager] ui: set file name for spice console
 download in chrome
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 22 Apr 2021 07:50:20 -0000

When the virt-viewer file is downloaded we already set
a file name in Android, so the file type may be
recognized. Also doing this in Chrome (and Chromium
based browsers) allows users to "alyways open files of
this type". So the browser automatically opens the
console window without user interaction.

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
---
 www/manager6/Utils.js | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index f502950f..35d49630 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1358,11 +1358,10 @@ Ext.define('PVE.Utils', {
 		css: 'display:none;visibility:hidden;height:0px;',
 	    });
 
-	    // Note: we need to tell android the correct file name extension
+	    // Note: we need to tell Android and Chrome the correct file name extension
 	    // but we do not set 'download' tag for other environments, because
 	    // It can have strange side effects (additional user prompt on firefox)
-	    var andriod = !!navigator.userAgent.match(/Android/i);
-	    if (andriod) {
+	    if (navigator.userAgent.match(/Android|Chrome/i)) {
 		link.download = name;
 	    }
 
-- 
2.20.1