Ross Mountjoy 2020-02-06 07:12:47 -05:00
parent e3dd6f2a68
commit b4764d1046
3 changed files with 7 additions and 6 deletions

View File

@ -4,7 +4,7 @@ from secrets import token_hex
from htmlmin.main import minify from htmlmin.main import minify
from flask import render_template, url_for, redirect, request, Blueprint, jsonify from flask import render_template, url_for, redirect, request, Blueprint, jsonify
from flask_login import current_user from flask_login import current_user
from dashmachine.main.models import Files from dashmachine.main.models import Files, Apps
from dashmachine.main.utils import get_rest_data, public_route, check_groups from dashmachine.main.utils import get_rest_data, public_route, check_groups
from dashmachine.settings_system.models import Settings from dashmachine.settings_system.models import Settings
from dashmachine.paths import cache_folder from dashmachine.paths import cache_folder
@ -60,9 +60,10 @@ def home():
return render_template("main/home.html") return render_template("main/home.html")
@main.route("/app_view?<url>", methods=["GET"]) @main.route("/app_view?<app_id>", methods=["GET"])
def app_view(url): def app_view(app_id):
return render_template("main/app-view.html", url=f"https://{url}") app_db = Apps.query.filter_by(id=app_id).first()
return render_template("main/app-view.html", url=f"{app_db.prefix}{app_db.url}")
@main.route("/load_rest_data", methods=["GET"]) @main.route("/load_rest_data", methods=["GET"])

View File

@ -33,7 +33,7 @@
{% for app in apps %} {% for app in apps %}
{% if app.open_in == 'iframe' %} {% if app.open_in == 'iframe' %}
<a href="{{ url_for('main.app_view', url=app.url) }}" class="app-a" data-name="{{ app.name }}" data-description="{{ app.description }}"> <a href="{{ url_for('main.app_view', app_id=app.id) }}" class="app-a" data-name="{{ app.name }}" data-description="{{ app.description }}">
{% elif app.open_in == 'this_tab' %} {% elif app.open_in == 'this_tab' %}
<a href="{{ app.prefix }}{{ app.url }}" class="app-a" data-name="{{ app.name }}" data-description="{{ app.description }}"> <a href="{{ app.prefix }}{{ app.url }}" class="app-a" data-name="{{ app.name }}" data-description="{{ app.description }}">
{% elif app.open_in == "new_tab" %} {% elif app.open_in == "new_tab" %}

View File

@ -37,7 +37,7 @@
{% for app in apps %} {% for app in apps %}
<li class="bold"> <li class="bold">
{% if app.open_in == 'iframe' %} {% if app.open_in == 'iframe' %}
<a id="dashboard-sidenav" class="waves-effect waves-cyan" href="{{ url_for('main.app_view', url=app.url) }}"> <a id="dashboard-sidenav" class="waves-effect waves-cyan" href="{{ url_for('main.app_view', app_id=app.id) }}">
{% elif app.open_in == "this_tab" %} {% elif app.open_in == "this_tab" %}
<a id="dashboard-sidenav" class="waves-effect waves-cyan" href="{{ app.prefix }}{{ app.url }}"> <a id="dashboard-sidenav" class="waves-effect waves-cyan" href="{{ app.prefix }}{{ app.url }}">
{% elif app.open_in == "new_tab" %} {% elif app.open_in == "new_tab" %}