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

Pierre Ynard git at videolan.org
Tue Aug 18 17:18:36 CEST 2020


vlc/vlc-3.0 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Tue Aug 18 16:55:18 2020 +0200| [13301d60822a4efd1b7e8a7cc677c92899e5b223] | committer: Pierre Ynard

lua/http: ask user before sending web interface URL to Google QR code API

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.

Refs #25005

(cherry picked from commit e891b5bb1fd946a4c2430270f7422932c35e8bb8)
Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=13301d60822a4efd1b7e8a7cc677c92899e5b223
---

 share/lua/http/index.html | 26 ++++++++++++++++++++++++++
 share/lua/http/js/ui.js   |  5 +----
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/share/lua/http/index.html b/share/lua/http/index.html
index d540c4108b..7d3ea06f37 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 b81674ab36..0bfd6ec795 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;
     });
 



More information about the vlc-commits mailing list