|
|
@ -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'])
|
|
|
|