support reverse_proxy with prefix path like ** handle_path ** in caddy2

pull/35/head
hass-demacia 9 months ago
parent 2695fd4eba
commit f36f14c3d0

@ -31,6 +31,7 @@ config.recent_pastes = int(environ["PASTEY_RECENT_PASTES"]) if "PASTEY_RECENT_PA
config.whitelist_cidr = environ["PASTEY_WHITELIST_CIDR"].split(",") if "PASTEY_WHITELIST_CIDR" in environ else config.whitelist_cidr config.whitelist_cidr = environ["PASTEY_WHITELIST_CIDR"].split(",") if "PASTEY_WHITELIST_CIDR" in environ else config.whitelist_cidr
config.blacklist_cidr = environ["PASTEY_BLACKLIST_CIDR"].split(",") if "PASTEY_BLACKLIST_CIDR" in environ else config.blacklist_cidr config.blacklist_cidr = environ["PASTEY_BLACKLIST_CIDR"].split(",") if "PASTEY_BLACKLIST_CIDR" in environ else config.blacklist_cidr
config.behind_proxy = bool(strtobool(environ["PASTEY_BEHIND_PROXY"])) if "PASTEY_BEHIND_PROXY" in environ else config.behind_proxy config.behind_proxy = bool(strtobool(environ["PASTEY_BEHIND_PROXY"])) if "PASTEY_BEHIND_PROXY" in environ else config.behind_proxy
config.handle_path = environ["PASTEY_HANDLE_PATH"] if "PASTEY_HANDLE_PATH" in environ else config.handle_path
config.default_theme = environ["PASTEY_DEFAULT_THEME"] if "PASTEY_DEFAULT_THEME" in environ else config.default_theme config.default_theme = environ["PASTEY_DEFAULT_THEME"] if "PASTEY_DEFAULT_THEME" in environ else config.default_theme
config.purge_interval = int(environ["PASTEY_PURGE_INTERVAL"]) if "PASTEY_PURGE_INTERVAL" in environ else config.purge_interval config.purge_interval = int(environ["PASTEY_PURGE_INTERVAL"]) if "PASTEY_PURGE_INTERVAL" in environ else config.purge_interval
config.force_show_recent = bool(strtobool(environ["PASTEY_FORCE_SHOW_RECENT"])) if "PASTEY_FORCE_SHOW_RECENT" in environ else config.force_show_recent config.force_show_recent = bool(strtobool(environ["PASTEY_FORCE_SHOW_RECENT"])) if "PASTEY_FORCE_SHOW_RECENT" in environ else config.force_show_recent

@ -106,4 +106,33 @@ def build_url(request, path="/"):
else: else:
protocol = request.url.split('//')[0] if not config.force_https_links else "https:" protocol = request.url.split('//')[0] if not config.force_https_links else "https:"
return protocol + "//" + domain + path if path.startswith("/"):
path = path[1:]
hp = handle_path(request)
return protocol + "//" + domain + "/" + hp + path
def redirect_url(request, path="/"):
if path.startswith("/"):
path = path[1:]
hp = handle_path(request)
return "/" + hp + path
def handle_path(request):
behind_proxy = config.behind_proxy
if not behind_proxy:
return ""
# only detect reverse proxy HEADER, enable **handle_path**
if not 'X-Forwarded-Proto' in request.headers and not 'X-Forwarded-Port' in request.headers:
return ""
handle_path = config.handle_path.strip()
if handle_path:
handle_path += "/"
return handle_path

@ -31,7 +31,10 @@ guess_threshold = 0.20
recent_pastes = 10 recent_pastes = 10
# Try to use X-Real-IP or X-Forwarded-For HTTP headers # Try to use X-Real-IP or X-Forwarded-For HTTP headers
behind_proxy = False behind_proxy = True
# handle path while after reverse proxy,
handle_path = "pastey"
# Default theme to display to users # Default theme to display to users
default_theme = "Light" default_theme = "Light"

@ -36,17 +36,20 @@ def home():
themes=loaded_themes, themes=loaded_themes,
force_show_recent=config.force_show_recent, force_show_recent=config.force_show_recent,
show_cli_button=config.show_cli_button, show_cli_button=config.show_cli_button,
script_url=common.build_url(request, "/pastey")) script_url=common.build_url(request, "/pastey"),
handle_path=common.handle_path(request))
# New paste page # New paste page
@app.route("/new") @app.route("/new")
def new(): def new():
whitelisted = common.verify_whitelist(common.get_source_ip(request)) whitelisted = common.verify_whitelist(common.get_source_ip(request))
print("handle_path: " + common.handle_path(request))
return render_template("new.html", return render_template("new.html",
whitelisted=whitelisted, whitelisted=whitelisted,
languages=supported_languages, languages=supported_languages,
active_theme=common.set_theme(request), active_theme=common.set_theme(request),
themes=loaded_themes) themes=loaded_themes,
handle_path=common.handle_path(request))
# Config page # Config page
@app.route("/config") @app.route("/config")
@ -60,7 +63,8 @@ def config_page():
script_url=common.build_url(request, "/pastey"), script_url=common.build_url(request, "/pastey"),
whitelisted=whitelisted, whitelisted=whitelisted,
active_theme=common.set_theme(request), active_theme=common.set_theme(request),
themes=loaded_themes) themes=loaded_themes,
handle_path=common.handle_path(request))
# View paste page # View paste page
@app.route("/view/<unique_id>") @app.route("/view/<unique_id>")
@ -73,7 +77,8 @@ def view(unique_id):
url=common.build_url(request, "/view/" + unique_id), url=common.build_url(request, "/view/" + unique_id),
whitelisted=common.verify_whitelist(common.get_source_ip(request)), whitelisted=common.verify_whitelist(common.get_source_ip(request)),
active_theme=common.set_theme(request), active_theme=common.set_theme(request),
themes=loaded_themes) themes=loaded_themes,
handle_path=common.handle_path(request))
else: else:
abort(404) abort(404)
@ -96,7 +101,7 @@ def delete(unique_id):
abort(401) abort(401)
functions.delete_paste(unique_id) functions.delete_paste(unique_id)
return redirect("/") return redirect(common.redirect_url(request, "/"))
# Script download # Script download
@app.route("/pastey") @app.route("/pastey")
@ -127,7 +132,7 @@ def paste():
if 'cli' in request.form: if 'cli' in request.form:
abort(400) abort(400)
else: else:
return redirect("/new") return redirect(common.redirect_url(request, "/new"))
else: else:
# Verify form options # Verify form options
@ -145,12 +150,12 @@ def paste():
if 'cli' in request.form: if 'cli' in request.form:
return common.build_url(request, "/view/" + unique_id + "#" + quote(key)), 200 return common.build_url(request, "/view/" + unique_id + "#" + quote(key)), 200
else: else:
return redirect("/view/" + unique_id + "#" + quote(key)) return redirect(common.redirect_url(request, "/view/" + unique_id + "#" + quote(key)))
else: else:
if 'cli' in request.form: if 'cli' in request.form:
return common.build_url(request, "/view/" + unique_id), 200 return common.build_url(request, "/view/" + unique_id), 200
else: else:
return redirect("/view/" + unique_id) return redirect(common.redirect_url(request, "/view/" + unique_id))
# POST new raw paste # POST new raw paste
@app.route('/raw', methods = ['POST']) @app.route('/raw', methods = ['POST'])

@ -4,7 +4,7 @@ body, table.table tr {
} }
.pastey-logo { .pastey-logo {
background-image: url('/static/img/pastey-dark.png'); /* background-image: url('/static/img/pastey-dark.png'); */
} }
.pastey-navbar { .pastey-navbar {

@ -1,5 +1,5 @@
.pastey-logo { .pastey-logo {
background-image: url('/static/img/pastey.png'); /* background-image: url('/static/img/pastey.png'); */
} }
.pastey-link { .pastey-link {

@ -7,11 +7,11 @@
<title>Unauthorized | Pastey</title> <title>Unauthorized | Pastey</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css" /> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" /> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" />
<link rel="stylesheet" href="/static/css/mdb.min.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/css/mdb.min.css" />
<link rel="stylesheet" href="/static/css/style.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/css/style.css" />
<link rel="stylesheet" href="/static/themes/{{ active_theme }}.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/themes/{{ active_theme }}.css" />
<link rel="icon" type="image/x-icon" href="/static/img/favicon.ico"/> <link rel="icon" type="image/x-icon" href="/{{ handle_path }}static/img/favicon.ico"/>
</head> </head>
<body> <body>
<header> <header>
@ -33,21 +33,21 @@
</button> </button>
<!-- Navbar logo --> <!-- Navbar logo -->
<a class="navbar-brand" href="/"> <a class="navbar-brand" href="/{{ handle_path }}">
<div class="pastey-logo" style="margin-top: -3px;"></div> <div class="pastey-logo" style="margin-top: -3px; background-image: url('/{{ handle_path }}static/img/pastey.png')"></div>
</a> </a>
<div class="collapse navbar-collapse" id="pasteyNavbarContainer"> <div class="collapse navbar-collapse" id="pasteyNavbarContainer">
<ul class="navbar-nav me-auto mb-2 mb-lg-0"> <ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item active"> <li class="nav-item active">
<a class="nav-link pastey-link" href="/">Home</a> <a class="nav-link pastey-link" href="/{{ handle_path }}">Home</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link pastey-link" href="/new">New Paste</a> <a class="nav-link pastey-link" href="/{{ handle_path }}new">New Paste</a>
</li> </li>
{% if whitelisted %} {% if whitelisted %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link pastey-link" href="/config">Config</a> <a class="nav-link pastey-link" href="/{{ handle_path }}config">Config</a>
</li> </li>
{% endif %} {% endif %}
<li class="nav-item dropdown"> <li class="nav-item dropdown">
@ -103,7 +103,7 @@
<!--Main layout--> <!--Main layout-->
<!--JS--> <!--JS-->
<script type="text/javascript" src="/static/js/mdb.min.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/mdb.min.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/common.js"></script>
</body> </body>
</html> </html>

@ -7,11 +7,11 @@
<title>Not Found | Pastey</title> <title>Not Found | Pastey</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css" /> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" /> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" />
<link rel="stylesheet" href="/static/css/mdb.min.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/css/mdb.min.css" />
<link rel="stylesheet" href="/static/css/style.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/css/style.css" />
<link rel="stylesheet" href="/static/themes/{{ active_theme }}.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/themes/{{ active_theme }}.css" />
<link rel="icon" type="image/x-icon" href="/static/img/favicon.ico"/> <link rel="icon" type="image/x-icon" href="/{{ handle_path }}static/img/favicon.ico"/>
</head> </head>
<body> <body>
<header> <header>
@ -33,21 +33,21 @@
</button> </button>
<!-- Navbar logo --> <!-- Navbar logo -->
<a class="navbar-brand" href="/"> <a class="navbar-brand" href="/{{ handle_path }}">
<div class="pastey-logo" style="margin-top: -3px;"></div> <div class="pastey-logo" style="margin-top: -3px; background-image: url('/{{ handle_path }}static/img/pastey.png')"></div>
</a> </a>
<div class="collapse navbar-collapse" id="pasteyNavbarContainer"> <div class="collapse navbar-collapse" id="pasteyNavbarContainer">
<ul class="navbar-nav me-auto mb-2 mb-lg-0"> <ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item active"> <li class="nav-item active">
<a class="nav-link pastey-link" href="/">Home</a> <a class="nav-link pastey-link" href="/{{ handle_path }}">Home</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link pastey-link" href="/new">New Paste</a> <a class="nav-link pastey-link" href="/{{ handle_path }}new">New Paste</a>
</li> </li>
{% if whitelisted %} {% if whitelisted %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link pastey-link" href="/config">Config</a> <a class="nav-link pastey-link" href="/{{ handle_path }}config">Config</a>
</li> </li>
{% endif %} {% endif %}
<li class="nav-item dropdown"> <li class="nav-item dropdown">
@ -103,7 +103,7 @@
<!--Main layout--> <!--Main layout-->
<!--JS--> <!--JS-->
<script type="text/javascript" src="/static/js/mdb.min.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/mdb.min.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/common.js"></script>
</body> </body>
</html> </html>

@ -7,11 +7,11 @@
<title>Config | Pastey</title> <title>Config | Pastey</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css" /> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" /> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" />
<link rel="stylesheet" href="/static/css/mdb.min.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/css/mdb.min.css" />
<link rel="stylesheet" href="/static/css/style.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/css/style.css" />
<link rel="stylesheet" href="/static/themes/{{ active_theme }}.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/themes/{{ active_theme }}.css" />
<link rel="icon" type="image/x-icon" href="/static/img/favicon.ico"/> <link rel="icon" type="image/x-icon" href="/{{ handle_path }}static/img/favicon.ico"/>
</head> </head>
<body> <body>
<header> <header>
@ -33,21 +33,21 @@
</button> </button>
<!-- Navbar logo --> <!-- Navbar logo -->
<a class="navbar-brand" href="/"> <a class="navbar-brand" href="/{{ handle_path }}">
<div class="pastey-logo" style="margin-top: -3px;"></div> <div class="pastey-logo" style="margin-top: -3px; background-image: url('/{{ handle_path }}static/img/pastey.png')"></div>
</a> </a>
<div class="collapse navbar-collapse" id="pasteyNavbarContainer"> <div class="collapse navbar-collapse" id="pasteyNavbarContainer">
<ul class="navbar-nav me-auto mb-2 mb-lg-0"> <ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item active"> <li class="nav-item active">
<a class="nav-link pastey-link" href="/">Home</a> <a class="nav-link pastey-link" href="/{{ handle_path }}">Home</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link pastey-link" href="/new">New Paste</a> <a class="nav-link pastey-link" href="/{{ handle_path }}new">New Paste</a>
</li> </li>
{% if whitelisted %} {% if whitelisted %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link pastey-link" aria-current="page" href="/config">Config</a> <a class="nav-link pastey-link" aria-current="page" href="/{{ handle_path }}config">Config</a>
</li> </li>
{% endif %} {% endif %}
<li class="nav-item dropdown"> <li class="nav-item dropdown">
@ -211,7 +211,7 @@
<!--Main layout--> <!--Main layout-->
<!--JS--> <!--JS-->
<script type="text/javascript" src="/static/js/mdb.min.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/mdb.min.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/common.js"></script>
</body> </body>
</html> </html>

@ -8,11 +8,11 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css" /> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" /> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" />
<link rel="stylesheet" href="/static/css/mdb.min.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/css/mdb.min.css" />
<link rel="stylesheet" href="/static/css/style.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/css/style.css" />
<link rel="stylesheet" href="/static/themes/{{ active_theme }}.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/themes/{{ active_theme }}.css" />
<link rel="icon" type="image/x-icon" href="/static/img/favicon.ico"/> <link rel="icon" type="image/x-icon" href="/{{ handle_path }}static/img/favicon.ico"/>
</head> </head>
<body> <body>
<header> <header>
@ -34,21 +34,21 @@
</button> </button>
<!-- Navbar logo --> <!-- Navbar logo -->
<a class="navbar-brand" href="/"> <a class="navbar-brand" href="/{{ handle_path }}">
<div class="pastey-logo" style="margin-top: -3px;"></div> <div class="pastey-logo" style="margin-top: -3px; background-image: url('/{{ handle_path }}static/img/pastey.png')"></div>
</a> </a>
<div class="collapse navbar-collapse" id="pasteyNavbarContainer"> <div class="collapse navbar-collapse" id="pasteyNavbarContainer">
<ul class="navbar-nav me-auto mb-2 mb-lg-0"> <ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item active"> <li class="nav-item active">
<a class="nav-link pastey-link" aria-current="page" href="/">Home</a> <a class="nav-link pastey-link" aria-current="page" href="/{{ handle_path }}">Home</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link pastey-link" href="/new">New Paste</a> <a class="nav-link pastey-link" href="/{{ handle_path }}new">New Paste</a>
</li> </li>
{% if whitelisted %} {% if whitelisted %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link pastey-link" href="/config">Config</a> <a class="nav-link pastey-link" href="/{{ handle_path }}config">Config</a>
</li> </li>
{% endif %} {% endif %}
<li class="nav-item dropdown"> <li class="nav-item dropdown">
@ -93,7 +93,7 @@
<p class="mb-3">A lightweight, self-hosted paste platform</p><br /> <p class="mb-3">A lightweight, self-hosted paste platform</p><br />
<div class="row justify-content-md-center"> <div class="row justify-content-md-center">
<div class="col-md-2"> <div class="col-md-2">
<a class="btn btn-primary text-nowrap m-2" href="/new" role="button" rel="nofollow"><i class="fas fa-plus"></i>&nbsp;&nbsp;&nbsp;New Paste</a> <a class="btn btn-primary text-nowrap m-2" href="/{{ handle_path }}new" role="button" rel="nofollow"><i class="fas fa-plus"></i>&nbsp;&nbsp;&nbsp;New Paste</a>
</div> </div>
{% if show_cli_button %} {% if show_cli_button %}
@ -119,8 +119,8 @@
<div class="row"> <div class="row">
<div class="col-md-4 mb-4"> <div class="col-md-4 mb-4">
<div class="bg-image hover-overlay shadow-1-strong rounded ripple pastey-preview-image" data-mdb-ripple-color="light"> <div class="bg-image hover-overlay shadow-1-strong rounded ripple pastey-preview-image" data-mdb-ripple-color="light">
<img src="/static/img/language/{{ active_theme }}/{{ paste.icon }}.png" onerror="this.src='/static/img/language/{{ active_theme }}/plaintext.png'" class="img-fluid" /> <img src="/{{ handle_path }}static/img/language/{{ active_theme }}/{{ paste.icon }}.png" onerror="this.src='/{{ handle_path }}static/img/language/{{ active_theme }}/plaintext.png'" class="img-fluid" />
<a href="/view/{{ paste.unique_id }}"> <a href="/{{ handle_path }}view/{{ paste.unique_id }}">
<div class="mask" style="background-color: rgba(251, 251, 251, 0.15);"></div> <div class="mask" style="background-color: rgba(251, 251, 251, 0.15);"></div>
</a> </a>
</div> </div>
@ -128,7 +128,7 @@
<div class="col-md-8 mb-4"> <div class="col-md-8 mb-4">
{% if whitelisted %} {% if whitelisted %}
<a class="btn btn-danger m-2" href="/delete/{{ paste.unique_id }}" role="button" style="float:right;"><i class="fas fa-trash"></i>&nbsp;&nbsp;&nbsp;Delete</a> <a class="btn btn-danger m-2" href="/{{ handle_path }}delete/{{ paste.unique_id }}" role="button" style="float:right;"><i class="fas fa-trash"></i>&nbsp;&nbsp;&nbsp;Delete</a>
{% endif %} {% endif %}
<h5>{{ paste.title }}</h5> <h5>{{ paste.title }}</h5>
@ -143,7 +143,7 @@
</main> </main>
<!--JS--> <!--JS-->
<script type="text/javascript" src="/static/js/mdb.min.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/mdb.min.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/common.js"></script>
</body> </body>
</html> </html>

@ -7,11 +7,11 @@
<title>New | Pastey</title> <title>New | Pastey</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css" /> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" /> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" />
<link rel="stylesheet" href="/static/css/mdb.min.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/css/mdb.min.css" />
<link rel="stylesheet" href="/static/css/style.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/css/style.css" />
<link rel="stylesheet" href="/static/themes/{{ active_theme }}.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/themes/{{ active_theme }}.css" />
<link rel="icon" type="image/x-icon" href="/static/img/favicon.ico"/> <link rel="icon" type="image/x-icon" href="/{{ handle_path }}static/img/favicon.ico"/>
</head> </head>
<body> <body>
<header> <header>
@ -33,21 +33,21 @@
</button> </button>
<!-- Navbar logo --> <!-- Navbar logo -->
<a class="navbar-brand" href="/"> <a class="navbar-brand" href="/{{ handle_path }}">
<div class="pastey-logo" style="margin-top: -3px;"></div> <div class="pastey-logo" style="margin-top: -3px; background-image: url('/{{ handle_path }}static/img/pastey.png')"></div>
</a> </a>
<div class="collapse navbar-collapse" id="pasteyNavbarContainer"> <div class="collapse navbar-collapse" id="pasteyNavbarContainer">
<ul class="navbar-nav me-auto mb-2 mb-lg-0"> <ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item active"> <li class="nav-item active">
<a class="nav-link pastey-link" href="/">Home</a> <a class="nav-link pastey-link" href="/{{ handle_path }}">Home</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link pastey-link" aria-current="page" href="/new">New Paste</a> <a class="nav-link pastey-link" aria-current="page" href="/{{ handle_path }}new">New Paste</a>
</li> </li>
{% if whitelisted %} {% if whitelisted %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link pastey-link" href="/config">Config</a> <a class="nav-link pastey-link" href="/{{ handle_path }}config">Config</a>
</li> </li>
{% endif %} {% endif %}
<li class="nav-item dropdown"> <li class="nav-item dropdown">
@ -96,7 +96,7 @@
<!--Main layout--> <!--Main layout-->
<main class="my-5"> <main class="my-5">
<div class="container"> <div class="container">
<form action="/paste" method="POST"> <form action="/{{ handle_path }}paste" method="POST">
<div class="row"> <div class="row">
<div class="col-md-6 mb-4"> <div class="col-md-6 mb-4">
<div class="md-form"> <div class="md-form">
@ -168,7 +168,7 @@
<!--Main layout--> <!--Main layout-->
<!--JS--> <!--JS-->
<script type="text/javascript" src="/static/js/mdb.min.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/mdb.min.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/common.js"></script>
</body> </body>
</html> </html>

@ -7,11 +7,11 @@
<title>{{ paste.title }} | Pastey</title> <title>{{ paste.title }} | Pastey</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css" /> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" /> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" />
<link rel="stylesheet" href="/static/css/mdb.min.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/css/mdb.min.css" />
<link rel="stylesheet" href="/static/css/style.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/css/style.css" />
<link rel="stylesheet" href="/static/themes/{{ active_theme }}.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/themes/{{ active_theme }}.css" />
<link rel="stylesheet" href="/static/css/highlight-{{ active_theme }}.css" /> <link rel="stylesheet" href="/{{ handle_path }}static/css/highlight-{{ active_theme }}.css" />
<link rel="icon" type="image/x-icon" href="/static/img/favicon.ico"/> <link rel="icon" type="image/x-icon" href="/{{ handle_path }}static/img/favicon.ico"/>
</head> </head>
<body> <body>
<header> <header>
@ -34,21 +34,21 @@
</button> </button>
<!-- Navbar logo --> <!-- Navbar logo -->
<a class="navbar-brand" href="/"> <a class="navbar-brand" href="/{{ handle_path }}">
<div class="pastey-logo" style="margin-top: -3px;"></div> <div class="pastey-logo" style="margin-top: -3px; background-image: url('/{{ handle_path }}static/img/pastey.png')"></div>
</a> </a>
<div class="collapse navbar-collapse" id="pasteyNavbarContainer"> <div class="collapse navbar-collapse" id="pasteyNavbarContainer">
<ul class="navbar-nav me-auto mb-2 mb-lg-0"> <ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item active"> <li class="nav-item active">
<a class="nav-link pastey-link" href="/">Home</a> <a class="nav-link pastey-link" href="/{{ handle_path }}">Home</a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link pastey-link" href="/new" rel="nofollow">New Paste</a> <a class="nav-link pastey-link" href="/{{ handle_path }}new" rel="nofollow">New Paste</a>
</li> </li>
{% if whitelisted %} {% if whitelisted %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link pastey-link" href="/config">Config</a> <a class="nav-link pastey-link" href="/{{ handle_path }}config">Config</a>
</li> </li>
{% endif %} {% endif %}
<li class="nav-item dropdown"> <li class="nav-item dropdown">
@ -90,9 +90,9 @@
<!-- Jumbotron --> <!-- Jumbotron -->
<div id="intro" class="p-5 text-center pastey-header"> <div id="intro" class="p-5 text-center pastey-header">
{% if paste.encrypted %} {% if paste.encrypted %}
<img src="/static/img/encrypted.png" width="30px" height="30px" /><br /><br /> <img src="/{{ handle_path }}static/img/encrypted.png" width="30px" height="30px" /><br /><br />
{% else %} {% else %}
<img src="/static/img/unencrypted.png" width="30px" height="30px" /><br /><br /> <img src="/{{ handle_path }}static/img/unencrypted.png" width="30px" height="30px" /><br /><br />
{% endif %} {% endif %}
<div class="pastey-title"> <div class="pastey-title">
<h1 class="mb-3 h2" id="pastey-title">{{ paste.title }}</h1> <h1 class="mb-3 h2" id="pastey-title">{{ paste.title }}</h1>
@ -188,13 +188,13 @@
<!--Main layout--> <!--Main layout-->
<!--JS--> <!--JS-->
<script type="text/javascript" src="/static/js/jquery.min.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/fernet.min.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/fernet.min.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/common.js"></script>
<script type="text/javascript" src="/static/js/qrcode.min.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/qrcode.min.js"></script>
<script type="text/javascript" src="/static/js/mdb.min.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/mdb.min.js"></script>
<script type="text/javascript" src="/static/js/highlight.min.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/highlight.min.js"></script>
<script type="text/javascript" src="/static/js/highlightjs-line-numbers.min.js"></script> <script type="text/javascript" src="/{{ handle_path }}static/js/highlightjs-line-numbers.min.js"></script>
<!-- Decrypt paste and generate QR code --> <!-- Decrypt paste and generate QR code -->
<script type="text/javascript"> <script type="text/javascript">

Loading…
Cancel
Save