mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Allow manual entry of QR code server address
This commit is contained in:
parent
1c8e581cf1
commit
be2989ead1
2 changed files with 36 additions and 6 deletions
|
@ -1377,11 +1377,14 @@
|
||||||
<label>Instructions</label>
|
<label>Instructions</label>
|
||||||
<p class="help-block">
|
<p class="help-block">
|
||||||
Scan the QR code below with the PlexPy Android app to automatically register it with the server.
|
Scan the QR code below with the PlexPy Android app to automatically register it with the server.
|
||||||
|
Make sure the PlexPy Address below is correct.
|
||||||
|
<span class="inline-pre">127.0.0.1</span> and <span class="inline-pre">localhost</span> will not work.
|
||||||
</p>
|
</p>
|
||||||
<label>QR Code</label>
|
<label>QR Code</label>
|
||||||
<pre id="api_qr_code" style="text-align: center"></pre>
|
<pre id="api_qr_code" style="text-align: center"></pre>
|
||||||
<label>Encoded String</label>
|
<label>PlexPy Address</label>
|
||||||
<pre id="api_qr_string"></pre>
|
<input type="text" class="form-control" id="api_qr_address">
|
||||||
|
<input type="hidden" class="form-control" id="api_qr_token">
|
||||||
<p class="help-block" id="api_qr_private" style="display: none;">
|
<p class="help-block" id="api_qr_private" style="display: none;">
|
||||||
Note: This is a private IP address. PlexPy will not be reachable outside of your home network.
|
Note: This is a private IP address. PlexPy will not be reachable outside of your home network.
|
||||||
Access PlexPy externally to generate the QR code for remote access.
|
Access PlexPy externally to generate the QR code for remote access.
|
||||||
|
@ -2034,14 +2037,16 @@ $(document).ready(function() {
|
||||||
parser.href = url;
|
parser.href = url;
|
||||||
isPrivateIP(parser.hostname).then(function (valid) {
|
isPrivateIP(parser.hostname).then(function (valid) {
|
||||||
$('#api_qr_private').toggle((valid !== 'n/a'));
|
$('#api_qr_private').toggle((valid !== 'n/a'));
|
||||||
|
}, function () {
|
||||||
|
$('#api_qr_private').toggle(false);
|
||||||
});
|
});
|
||||||
$('#api_qr_https').toggle(!(url.startsWith('https')));
|
$('#api_qr_https').toggle(!(url.startsWith('https')));
|
||||||
|
|
||||||
$.get('generate_api_key', { device: true }).then(function (token) {
|
$.get('generate_api_key', { device: true }).then(function (token) {
|
||||||
var encoded_string = url + '|' + token;
|
$('#api_qr_address').val(url);
|
||||||
$('#api_qr_string').html(encoded_string);
|
$('#api_qr_token').val(token);
|
||||||
$('#api_qr_code').empty().qrcode({
|
$('#api_qr_code').empty().qrcode({
|
||||||
text: encoded_string
|
text: url + '|' + token
|
||||||
});
|
});
|
||||||
|
|
||||||
(function poll(){
|
(function poll(){
|
||||||
|
@ -2072,6 +2077,22 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#api_qr_address').change(function () {
|
||||||
|
var url = $(this).val();
|
||||||
|
var parser = document.createElement('a');
|
||||||
|
parser.href = url;
|
||||||
|
isPrivateIP(parser.hostname).then(function (valid) {
|
||||||
|
$('#api_qr_private').toggle((valid !== 'n/a'));
|
||||||
|
}, function () {
|
||||||
|
$('#api_qr_private').toggle(false);
|
||||||
|
});
|
||||||
|
$('#api_qr_https').toggle(!(url.startsWith('https')));
|
||||||
|
|
||||||
|
$('#api_qr_code').empty().qrcode({
|
||||||
|
text: url + '|' + $('#api_qr_token').val()
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$('#api-qr-modal').on('hidden.bs.modal', function () {
|
$('#api-qr-modal').on('hidden.bs.modal', function () {
|
||||||
if (!(verifiedDevice)) {
|
if (!(verifiedDevice)) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
|
@ -4775,8 +4775,17 @@ class WebInterface(object):
|
||||||
else:
|
else:
|
||||||
scheme = 'http'
|
scheme = 'http'
|
||||||
|
|
||||||
|
# Have to return some hostname if socket fails even if 127.0.0.1 won't work
|
||||||
|
hostname = '127.0.0.1'
|
||||||
|
|
||||||
if plexpy.CONFIG.HTTP_HOST == '0.0.0.0':
|
if plexpy.CONFIG.HTTP_HOST == '0.0.0.0':
|
||||||
import socket
|
import socket
|
||||||
|
try:
|
||||||
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
|
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
|
||||||
|
s.connect(('<broadcast>', 0))
|
||||||
|
hostname = s.getsockname()[0]
|
||||||
|
except socket.error:
|
||||||
hostname = socket.gethostbyname(socket.gethostname())
|
hostname = socket.gethostbyname(socket.gethostname())
|
||||||
else:
|
else:
|
||||||
hostname = plexpy.CONFIG.HTTP_HOST
|
hostname = plexpy.CONFIG.HTTP_HOST
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue