mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
get the changes tied down a little
This commit is contained in:
parent
37ac9c7e30
commit
c728ce4852
4 changed files with 12 additions and 10 deletions
|
@ -93,7 +93,6 @@
|
||||||
<br><br>
|
<br><br>
|
||||||
<br><br>
|
<br><br>
|
||||||
<br><br>
|
<br><br>
|
||||||
<!-- <a class="button" href="http://box.lan/home">{{ btn1 }}</a> -->
|
|
||||||
<a class="button" onclick="homeclick()">{{ btn1 }}</a>
|
<a class="button" onclick="homeclick()">{{ btn1 }}</a>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
[uwsgi]
|
[uwsgi]
|
||||||
uid = {{ apache_user }}
|
uid = {{ apache_user }}
|
||||||
gid = {{ apache_user }}
|
gid = {{ apache_user }}
|
||||||
http-socket = {{ captiveportal_port }}
|
http-socket = :{{ captiveportal_port }}
|
||||||
chdir = /opt/iiab/captiveportal
|
chdir = /opt/iiab/captiveportal
|
||||||
wsgi-file = capture-wsgi.py
|
wsgi-file = capture-wsgi.py
|
||||||
master = true
|
master = true
|
||||||
plugins = python3
|
plugins = python3
|
||||||
log-to = /var/log/apache2/captiveportal.log
|
log-to = /var/log/apache2/portal.log
|
||||||
py-autoreload = 2
|
py-autoreload = 2
|
||||||
|
|
|
@ -13,6 +13,7 @@ import sys
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import re
|
import re
|
||||||
|
from iiab.iiab_lib import get_iiab_env
|
||||||
|
|
||||||
# Notes on timeout strategy
|
# Notes on timeout strategy
|
||||||
# every client timestamp is recorded into current_ts
|
# every client timestamp is recorded into current_ts
|
||||||
|
@ -34,13 +35,12 @@ PORTAL_TO = 20 # delay after triggered by ajax upon click of link to home page
|
||||||
|
|
||||||
|
|
||||||
# Get the IIAB variables
|
# Get the IIAB variables
|
||||||
sys.path.append('/etc/iiab/')
|
|
||||||
from iiab_env import get_iiab_env
|
|
||||||
doc_root = get_iiab_env("WWWROOT")
|
doc_root = get_iiab_env("WWWROOT")
|
||||||
fully_qualified_domain_name = get_iiab_env("FQDN")
|
fully_qualified_domain_name = get_iiab_env("FQDN")
|
||||||
|
|
||||||
|
|
||||||
loggingLevel = "ERROR"
|
#loggingLevel = "ERROR"
|
||||||
|
loggingLevel = "DEBUG"
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
if sys.argv[1] == '-l':
|
if sys.argv[1] == '-l':
|
||||||
loggingLevel = "DEBUG"
|
loggingLevel = "DEBUG"
|
||||||
|
@ -155,24 +155,26 @@ def microsoft(environ,start_response):
|
||||||
# firefox -- seems both mac and Windows use it
|
# firefox -- seems both mac and Windows use it
|
||||||
agent = environ.get('HTTP_USER_AGENT','default_agent')
|
agent = environ.get('HTTP_USER_AGENT','default_agent')
|
||||||
if agent.startswith('Mozilla'):
|
if agent.startswith('Mozilla'):
|
||||||
|
logger.debug("sending microsoft redirect for agent Mozilla")
|
||||||
return home(environ, start_response)
|
return home(environ, start_response)
|
||||||
logger.debug("sending microsoft redirect")
|
|
||||||
response_body = b""
|
response_body = b""
|
||||||
status = '302 Moved Temporarily'
|
status = '302 Moved Temporarily'
|
||||||
response_headers = [('Location','http://box.lan/home'),
|
response_headers = [('Location','http://' + fully_qualified_domain_name + '{{ captiveportal_splash_page }}'),
|
||||||
('Content-type','text/html'),
|
('Content-type','text/html'),
|
||||||
('Content-Length',str(len(response_body)))]
|
('Content-Length',str(len(response_body)))]
|
||||||
start_response(status, response_headers)
|
start_response(status, response_headers)
|
||||||
|
logger.debug("redirect to home. Status: %s Headers: %s"%(status,repr(response_headers)))
|
||||||
return [response_body]
|
return [response_body]
|
||||||
|
|
||||||
def home(environ,start_response):
|
def home(environ,start_response):
|
||||||
logger.debug("sending direct to home")
|
logger.debug("sending direct to home")
|
||||||
response_body = b""
|
response_body = b""
|
||||||
status = '302 Moved Temporarily'
|
status = '302 Moved Temporarily'
|
||||||
response_headers = [('Location','http://' + fully_qualified_domain_name + '/home'),
|
response_headers = [('Location','http://' + fully_qualified_domain_name + '{{ captiveportal_splash_page }}'),
|
||||||
('Content-type','text/html'),
|
('Content-type','text/html'),
|
||||||
('Content-Length',str(len(response_body)))]
|
('Content-Length',str(len(response_body)))]
|
||||||
start_response(status, response_headers)
|
start_response(status, response_headers)
|
||||||
|
logger.debug("redirect to home. Status: %s Headers: %s"%(status,repr(response_headers)))
|
||||||
return [response_body]
|
return [response_body]
|
||||||
|
|
||||||
def android(environ, start_response):
|
def android(environ, start_response):
|
||||||
|
@ -189,7 +191,7 @@ def android(environ, start_response):
|
||||||
location = '/android_splash'
|
location = '/android_splash'
|
||||||
set_204after(ip,0)
|
set_204after(ip,0)
|
||||||
elif system_version[:1] >= '7':
|
elif system_version[:1] >= '7':
|
||||||
location = "http://" + fully_qualified_domain_name + "/home"
|
location = "http://" + fully_qualified_domain_name + '{{ captiveportal_splash_page }}'
|
||||||
else:
|
else:
|
||||||
#set_204after(ip,20)
|
#set_204after(ip,20)
|
||||||
location = '/android_https'
|
location = '/android_https'
|
||||||
|
|
|
@ -147,6 +147,7 @@ dns_jail_enabled: False
|
||||||
captiveportal_install: False
|
captiveportal_install: False
|
||||||
captiveportal_enabled: False
|
captiveportal_enabled: False
|
||||||
captiveportal_port: 9090
|
captiveportal_port: 9090
|
||||||
|
captiveportal_splash_page: /
|
||||||
# In a pinch, disable Captive Portal using instructions in http://FAQ.IIAB.IO
|
# In a pinch, disable Captive Portal using instructions in http://FAQ.IIAB.IO
|
||||||
|
|
||||||
# Bluetooth PAN access to IIAB server
|
# Bluetooth PAN access to IIAB server
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue