diff options
Diffstat (limited to 'fg21sim')
-rw-r--r-- | fg21sim/webui/handlers/index.py | 14 | ||||
-rw-r--r-- | fg21sim/webui/templates/products.html | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/fg21sim/webui/handlers/index.py b/fg21sim/webui/handlers/index.py index b351619..89d079d 100644 --- a/fg21sim/webui/handlers/index.py +++ b/fg21sim/webui/handlers/index.py @@ -11,6 +11,18 @@ from .base import BaseRequestHandler class IndexHandler(BaseRequestHandler): """ Index page handler of the Web UI. + + Attributes + ---------- + from_localhost : bool + ``True`` if the request is from the localhost, otherwise ``False``. """ + def initialize(self): + """Hook for subclass initialization. Called for each request.""" + if self.request.remote_ip == "127.0.0.1": + self.from_localhost = True + else: + self.from_localhost = False + def get(self): - self.render("index.html") + self.render("index.html", from_localhost=self.from_localhost) diff --git a/fg21sim/webui/templates/products.html b/fg21sim/webui/templates/products.html index e7c7427..a883565 100644 --- a/fg21sim/webui/templates/products.html +++ b/fg21sim/webui/templates/products.html @@ -25,12 +25,14 @@ <input class="form-control code" type="text" id="products-manifest" required /> </div> </div> + {% if from_localhost %} <div class="row"> <div class="column form-group"> <label for="products-ds9">DS9 Executable Path:</label> <input class="form-control code" type="text" id="products-ds9" value="ds9" /> </div> </div> + {% end %} </form> <hr class="hr-thin hr-condensed hr-dashed" /> |