-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82ccc13
commit 3836ee5
Showing
9 changed files
with
306 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from flask import request, render_template_string | ||
|
||
DOMAIN = "override.test" | ||
|
||
HTML_TEMPLATE = """ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Override Control</title> | ||
</head> | ||
<body> | ||
<h1>Override Control</h1> | ||
<form method="post"> | ||
<input type="submit" name="action" value="Enable Override"> | ||
<input type="submit" name="action" value="Disable Override"> | ||
</form> | ||
<p>Current status: {{ status }}</p> | ||
{% if override_active %} | ||
<p>Requested URL: {{ requested_url }}</p> | ||
{% endif %} | ||
</body> | ||
</html> | ||
""" | ||
|
||
override_active = False | ||
|
||
def get_override_status(): | ||
global override_active | ||
return override_active | ||
|
||
def handle_request(req): | ||
global override_active | ||
|
||
if req.method == 'POST': | ||
action = req.form.get('action') | ||
if action == 'Enable Override': | ||
override_active = True | ||
elif action == 'Disable Override': | ||
override_active = False | ||
|
||
status = "Override Active" if override_active else "Override Inactive" | ||
|
||
requested_url = req.url if override_active else "" | ||
|
||
return render_template_string(HTML_TEMPLATE, | ||
status=status, | ||
override_active=override_active, | ||
requested_url=requested_url) |
Oops, something went wrong.