Skip to content

Commit

Permalink
kill me pls
Browse files Browse the repository at this point in the history
  • Loading branch information
fixator10 committed Jan 23, 2021
1 parent 96aa070 commit 9dd2735
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 15 deletions.
4 changes: 4 additions & 0 deletions reddash/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
add_constants,
initialize_babel,
startup_message,
ReverseProxied,
)


Expand Down Expand Up @@ -81,6 +82,9 @@ def create_app(host, port, rpcport, interval, debug, dev):
app.rpcversion = 0
app.interval = interval

# Reverse proxy path support
app.wsgi_app = ReverseProxied(app.wsgi_app)

# Initialize core variables
app.task_manager = TaskManager(app, console, progress_bar)
app.dashlog = dashlog
Expand Down
9 changes: 5 additions & 4 deletions reddash/app/base/templates/base-site.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<title>
{{ meta['title'] }} -{% block title %}{% endblock %}
</title>
<base href="{{ basepath }}/">
<!-- Meta tags -->
<meta content="{{ meta['title'] }} -{{ self.title() }}" property="og:title">
<meta content="{{ meta['description'] }}" property="og:description">
Expand All @@ -39,11 +40,11 @@
<!-- Fonts and icons -->
<link href="https://fonts.googleapis.com/css?family=Poppins:200,300,400,600,700,800" rel="stylesheet" />
<link href="https://use.fontawesome.com/releases/v5.0.6/css/all.css" rel="stylesheet">
<link rel="stylesheet" href="/static/assets/css/bootstrap-select.min.css?v=1.0.0">
<link rel="stylesheet" href="static/assets/css/bootstrap-select.min.css?v=1.0.0">
<!-- Nucleo Icons -->
<link href="/static/assets/css/nucleo-icons.css" rel="stylesheet" />
<link href="static/assets/css/nucleo-icons.css" rel="stylesheet" />
<!-- CSS Files -->
<link href="/static/assets/css/black-dashboard.min.css?v=1.0.0" rel="stylesheet" />
<link href="static/assets/css/black-dashboard.min.css?v=1.0.0" rel="stylesheet" />

<!-- Specific Page CSS goes HERE -->
{% block stylesheets %}{% endblock stylesheets %}
Expand Down Expand Up @@ -104,7 +105,7 @@
// Add white border to seleted color
$("span[data-color={{ color }}").addClass("active")
</script>
<script src="/static/assets/js/bootstrap-select.min.js"></script>
<script src="static/assets/js/bootstrap-select.min.js"></script>
</body>

</html>
12 changes: 6 additions & 6 deletions reddash/app/base/templates/site_template/scripts.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!-- Core JS Files -->
<script src="/static/assets/js/core/jquery.min.js"></script>
<script src="/static/assets/js/core/popper.min.js"></script>
<script src="/static/assets/js/core/bootstrap.min.js"></script>
<script src="/static/assets/js/plugins/perfect-scrollbar.jquery.min.js"></script>
<script src="static/assets/js/core/jquery.min.js"></script>
<script src="static/assets/js/core/popper.min.js"></script>
<script src="static/assets/js/core/bootstrap.min.js"></script>
<script src="static/assets/js/plugins/perfect-scrollbar.jquery.min.js"></script>
<!-- Notifications Plugin -->
<script src="/static/assets/js/plugins/bootstrap-notify.js"></script>
<script src="static/assets/js/plugins/bootstrap-notify.js"></script>
<!-- Control Center for Black Dashboard: parallax effects, scripts for the example pages etc -->
<script src="/static/assets/js/black-dashboard.min.js?v=1.0.0"></script>
<script src="static/assets/js/black-dashboard.min.js?v=1.0.0"></script>
2 changes: 1 addition & 1 deletion reddash/app/base/templates/site_template/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</a>
</li>
<li>
<a href="{{ url_for('base_blueprint.logout') }}"">
<a href="{{ url_for('base_blueprint.logout') }}">
<i class=" tim-icons icon-user-run"></i>
<p>{{ _('Logout') }}</p>
</a>
Expand Down
8 changes: 4 additions & 4 deletions reddash/app/home/templates/guild.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ <h5 class="card-category text-gray">
<div class="col-6">
<h4>
{{ _('{members} Members | {humans} Humans | {bots} Bots').format(members=data['data']['members'], humans=data['data']['humans'], bots=data['data']['bots']) }}<br>
<img src="/static/assets/img/online.png" class="status">
<img src="static/assets/img/online.png" class="status">
{{ data['data']['online'] }}<br>
<img src="/static/assets/img/idle.png" class="status">
<img src="static/assets/img/idle.png" class="status">
{{ data['data']['idle'] }}<br>
<img src="/static/assets/img/dnd.png" class="status">
<img src="static/assets/img/dnd.png" class="status">
{{ data['data']['dnd'] }}<br>
<img src="/static/assets/img/offline.png" class="status">
<img src="static/assets/img/offline.png" class="status">
{{ data['data']['offline'] }}<br>
</h4>
</div>
Expand Down
24 changes: 24 additions & 0 deletions reddash/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def inject_variables():
variables["safelocales"] = json.dumps(app.config["LOCALE_DICT"])
variables["selectedlocale"] = session.get("lang_code")
variables["color"] = request.cookies.get("color", variables["color"])
variables["basepath"] = request.environ.get("HTTP_X_SCRIPT_NAME", "")
variables = process_meta_tags(variables)
return dict(version=__version__, **variables)

Expand Down Expand Up @@ -270,3 +271,26 @@ def notify_owner_of_blacklist(app, ip):
continue
break
time.sleep(1)


class ReverseProxied(object):
def __init__(self, app, script_name=None, scheme=None, server=None):
self.app = app
self.script_name = script_name
self.scheme = scheme
self.server = server

def __call__(self, environ, start_response):
script_name = environ.get("HTTP_X_SCRIPT_NAME", "") or self.script_name
if script_name:
environ["SCRIPT_NAME"] = script_name
path_info = environ["PATH_INFO"]
if path_info.startswith(script_name):
environ["PATH_INFO"] = path_info[len(script_name) :]
scheme = environ.get("HTTP_X_SCHEME", "") or self.scheme
if scheme:
environ["wsgi.url_scheme"] = scheme
server = environ.get("HTTP_X_FORWARDED_HOST", "") or self.server
if server:
environ["HTTP_HOST"] = server
return self.app(environ, start_response)

0 comments on commit 9dd2735

Please sign in to comment.