mirror of
https://github.com/iFargle/headscale-webui.git
synced 2026-01-06 04:33:58 +01:00
test
This commit is contained in:
13
server.py
13
server.py
@@ -12,6 +12,19 @@ DEBUG_STATE = False
|
||||
AUTH_TYPE = os.environ["AUTH_TYPE"].replace('"', '')
|
||||
STATIC_URL_PATH = "/static"
|
||||
|
||||
class PrefixMiddleware(object):
|
||||
def __init__(self, app, prefix=''):
|
||||
self.app = app
|
||||
self.prefix = prefix
|
||||
def __call__(self, environ, start_response):
|
||||
if environ['PATH_INFO'].startswith(self.prefix):
|
||||
environ['PATH_INFO'] = environ['PATH_INFO'][len(self.prefix):]
|
||||
environ['SCRIPT_NAME'] = self.prefix
|
||||
return self.app(environ, start_response)
|
||||
else:
|
||||
start_response('404', [('Content-Type', 'text/plain')])
|
||||
return ["This url does not belong to the app.".encode()]
|
||||
|
||||
# Set Authentication type:
|
||||
if AUTH_TYPE.lower() == "oidc":
|
||||
# Load OIDC libraries
|
||||
|
||||
Reference in New Issue
Block a user