ITRav4/PlexRedirect

Keeps checking

donflex42 opened this issue · 4 comments

My PlexRedirect just keeps checking if my server is online
here is my index.html:

<!DOCTYPE html>
<html lang="en">
  <head>
    <link rel="shortcut icon" type="image/x-icon" href="plexlanding.ico" />`
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <style>
        body.offline #link-bar {
            display:none;
        }

        body.online  #link-bar{
            display:block;
        }
    </style>
    <script src="assets/js/ping.js"></script>
    <script type='text/javascript'>
        HTMLElement.prototype.hasClass = function (className) {
            if (this.classList) {
                return this.classList.contains(className);
            } else {
                return (-1 < this.className.indexOf(className));
            }
        };

        HTMLElement.prototype.addClass = function (className) {
            if (this.classList) {
                this.classList.add(className);
            } else if (!this.hasClass(className)) {
                var classes = this.className.split(" ");
                classes.push(className);
                this.className = classes.join(" ");
            }
            return this;
        };

        HTMLElement.prototype.removeClass = function (className) {
            if (this.classList) {
                this.classList.remove(className);
            } else {
                var classes = this.className.split(" ");
                classes.splice(classes.indexOf(className), 1);
                this.className = classes.join(" ");
            }
            return this;
        };

        function checkServer() {
            var p = new Ping();
            var server = mydyn.duckdns.org //Try to get it automagically, but you can manually specify this
            var timeout = 2000; //Milliseconds
            var body = document.getElementsByTagName("body")[0];
            p.ping(server+":myexternalport", function(data) {
                var serverMsg = document.getElementById( "server-status-msg" );
                var serverImg = document.getElementById( "server-status-img" );
                if (data < 1000){
                    serverMsg.innerHTML ='Up and reachable';
                    serverImg.src = "assets/img/ipad-hand-on.png";
                    body.addClass('online').removeClass("offline");
                }else{
                    serverMsg.innerHTML = 'Down and unreachable';
                    serverImg.src = "assets/img/ipad-hand-off.png";
                }
            }, timeout);
        }
    </script>


    <title>Fast Debian Server</title>


    <!-- Bootstrap core CSS -->
    <link href="assets/css/bootstrap.css" rel="stylesheet">

    <!-- Custom styles -->
    <link href="assets/css/main.css" rel="stylesheet">

    <!-- Fonts from Google Fonts -->
    <link href='//fonts.googleapis.com/css?family=Lato:300,400,900' rel='stylesheet' type='text/css'>


  </head>

  <body onload="checkServer()" class="offline">

    <!-- Fixed navbar -->
    <div class="navbar navbar-default navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">

          </button>
          <a href="http://mydyn.duckdns.org:24515/web"
          <a class="navbar-brand" href="#"><b>Fast Debian Server</b></a>
        </div>

          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </div>
    <div class="container" id="link-bar">
        <div class="row mt centered">
            <div class="col-lg-6 col-lg-offset-3">


            </div>
        </div><!-- /row -->

        <div class="row mt centered">
            <div class="col-lg-4">
                <a href="http://app.plex.tv/web/app" target="_top">
                <img src="assets/img/s01.png" width="180" alt="">
                <h4>Access Fast Debian Server</h4>
                <p>Access the Fast Debian Server library with over X Movies & X TV Shows available instantly.<p>
                    </a>
            </div><!--/col-lg-4 -->

            <div class="col-lg-4">
                <a href="http://mydyn.duckdns.org:3000" target="_top">
                <img src="assets/img/s02.png" width="180" alt="">
                <h4>Request</h4>
                <p>Want to watch a Movie or TV Show but it's not currently on Fast Debian Server? Request it here!</p>
</a>
            </div><!--/col-lg-4 -->

            <div class="col-lg-4">
                <a href="PLEXEMAIL LINK HERE" target="_top">
                <img src="assets/img/s03.png" width="180" alt="">
                <h4>What's New</h4>
                <p>See what has been recently added to Fast Debian Server without having to log in.</p>
</a>
            </div><!--/col-lg-4 -->
        </div><!-- /row -->
    </div><!-- /container -->
    <p>

    <div id="headerwrap">
        <div class="container">
            <div class="row">
                <div class="col-lg-6">
                    <h1><br/>
                    <center>Fast Debian Server Status:</h1></center>
                    <center><h4 id="server-status-msg"><img src="assets/img/puff.svg">   Checking...</h4></center><br/>
                    <br/>
                    <br/>
                    <form class="form-inline" role="form">
                      <div class="form-group">

                      </div>

                </div><!-- /col-lg-6 -->
                <div class="col-lg-6">
                    <img id="server-status-img" class="img-responsive" src="assets/img/ipad-hand.png" alt="">
                </div><!-- /col-lg-6 -->

            </div><!-- /row -->
        </div><!-- /container -->
    </div><!-- /headerwrap -->
  </body>
</html>

Chrome tells me this:

Uncaught SyntaxError: Unexpected token <
SVG's SMIL animations (<animate>, <set>, etc.) are deprecated and will be removed. Please use CSS animations or Web animations instead.
(index):52 Uncaught ReferenceError: Ping is not definedcheckServer @ (index):52onload @ 192.168.1.123/:87

Could you try adding "quotation marks" to your domain or your IP address. So it looks something like this:

var server = "mydyn.duckdns.org"

Unfortunately it still doesn't work, but on my Mac with MAMP it does. I'm using PiHole on my server as well, so this may be an issue, as Pihole uses lighttp as web server, correct me if I'm wrong

I now installed nginx, where it works, but my pihole doesn't work anymore
Could you give me some assistance for nginx? (config file and other things I'd have to change)
My setup is this:
Server Debian (192.168.1.123) : Nginx would run on this
Couchpotato 5050
Sonarr 8989
PlexRequests 3000
Plex 32400

Synology (192.168.1.112) :
DSM 5000 5001 (SSL)

Raspberry Pi (192.168.1.116) :
MagicMirror 8080

I have the same problem. i have fix it to replace it with te following thing:
var server = "DOMAIN NAME"; //Try to get it automagically, but you can manually specify this

set a ; and " "