[vlc-devel] [PATCH 4/4] lua/http: ask user before sending web interface URL to Google QR code API

Pierre Ynard linkfanel at yahoo.fr
Sat Aug 8 02:36:40 CEST 2020


The existence and URL of the web interface of a VLC instance can be
sensitive information, and transmitting it over the internet to a third
party might not be something that the user is okay with.

This creates a new dialog informing the user and prompting them for
confirmation, before sending the URL to a remote web API to generate a
QR code for it.


diff --git a/share/lua/http/index.html b/share/lua/http/index.html
index 8fb9484..1d464dc 100644
--- a/share/lua/http/index.html
+++ b/share/lua/http/index.html
@@ -163,6 +163,24 @@
 					}
 					return false;
 				});
+				$('#qrCodeConfirm').dialog({
+					autoOpen: false,
+					width:600,
+					modal: true,
+					buttons:{
+						"<?vlc gettext("Yes") ?>":function(){
+							$(this).dialog('close');
+							var urlimg = $('#mobileintflink').prop('href');
+							var codeimg = $('<img width="350" height="350" alt="qrcode"/>');
+							codeimg.attr('src', 'https://chart.apis.google.com/chart?cht=qr&chs=350x350&chld=L&choe=UTF-8&chl=' + encodeURIComponent(urlimg));
+							codeimg.dialog({width: 350, height: 350, title: "<?vlc gettext("QR Code") ?>"});
+						},
+						"<?vlc gettext("No") ?>":function(){
+							$(this).dialog('close');
+							window.location = $('#mobileintflink').attr('href');
+						}
+					}
+				});
 				$('#windowStreamConfirm').dialog({
 					autoOpen: false,
 					width:600,
@@ -259,6 +277,14 @@
 			</div>
 		</div>
 		</div>
+		<div id="qrCodeConfirm" title="<?vlc gettext("Generate QR Code") ?>">
+			<p>
+				<?vlc gettext("VLC can display a QR code linking to the mobile version of the web interface; the web address of the web interface of your VLC media player instance will be transmitted over the internet to the Google Image Charts web service to generate this QR code.") ?>
+			</p>
+			<p>
+				<?vlc gettext("Do you want to go ahead with this?") ?>
+			</p>
+		</div>
 		<div id="windowStreamConfirm" title="<?vlc gettext("Confirm Stream Settings") ?>">
 			<p>
 				<?vlc gettext("By creating a stream, the <i>Main Controls</i> will operate the stream instead of the main interface.") ?>
diff --git a/share/lua/http/js/ui.js b/share/lua/http/js/ui.js
index c1de13f..bf27f43 100644
--- a/share/lua/http/js/ui.js
+++ b/share/lua/http/js/ui.js
@@ -100,10 +100,7 @@ $(function () {
         {
              return true;
         }
-        var urlimg = $('#mobileintflink').prop('href');
-        var codeimg = $('<img width="350" height="350" alt="qrcode"/>');
-        codeimg.attr('src', 'https://chart.apis.google.com/chart?cht=qr&chs=350x350&chld=L&choe=UTF-8&chl=' + encodeURIComponent(urlimg));
-        codeimg.dialog({width: 350, height: 350, title: 'QR-Code'});
+        $('#qrCodeConfirm').dialog('open');
         return false;
     });
-- 
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."


More information about the vlc-devel mailing list