fix fix fix

This commit is contained in:
spitkov 2024-09-16 14:10:51 +02:00
parent 2e5fd2024f
commit 7f5c9202bb
2 changed files with 9 additions and 7 deletions

4
app.py
View File

@ -276,6 +276,7 @@ def redirect_vanity(vanity, password=None):
entered_password = request.form.get('password')
if entered_password != stored_password:
return render_template('password_prompt.html', vanity=vanity, error="Incorrect password", content_type=content_type)
password = entered_password # Set the password for use in raw_url
else:
return render_template('password_prompt.html', vanity=vanity, error=None, content_type=content_type)
@ -308,7 +309,8 @@ def redirect_vanity(vanity, password=None):
raw_url=raw_url,
vanity=vanity,
user_id=user_id,
is_private=is_private)
is_private=is_private,
password=password)
elif content_type == 'pastebin':
try:
lexer = guess_lexer(content_data)

View File

@ -115,21 +115,21 @@
{% if is_embeddable %}
<div class="embed-container">
{% if filename.lower().endswith(('.jpg', '.jpeg', '.png', '.gif', '.svg')) %}
<img src="{{ raw_url|replace('/r/', '/') }}" alt="{{ filename }}">
<img src="{{ raw_url }}" alt="{{ filename }}">
{% elif filename.lower().endswith('.pdf') %}
<embed src="{{ raw_url|replace('/r/', '/') }}" type="application/pdf" width="100%" height="600px">
<embed src="{{ raw_url }}" type="application/pdf" width="100%" height="600px">
{% endif %}
</div>
{% endif %}
<div class="btn-container">
<a href="{{ file_url|replace('/r/', '/') }}/download" class="btn">Download</a>
<a href="{{ raw_url|replace('/r/', '/') }}" class="btn">View Raw</a>
<a href="{{ file_url }}/download{% if password %}/{{ password }}{% endif %}" class="btn">Download</a>
<a href="{{ raw_url }}" class="btn">View Raw</a>
{% if current_user.is_authenticated and current_user.id == user_id %}
{% if filename.lower().endswith(('.txt', '.html', '.css', '.js', '.py', '.md')) or '.' not in filename %}
<a href="{{ url_for('edit_content', vanity=vanity)|replace('/r/', '/') }}" class="btn edit-btn">Edit</a>
<a href="{{ url_for('edit_content', vanity=vanity) }}" class="btn edit-btn">Edit</a>
{% endif %}
<form action="{{ url_for('delete_content', vanity=vanity)|replace('/r/', '/') }}" method="post" style="display: inline;">
<form action="{{ url_for('delete_content', vanity=vanity) }}" method="post" style="display: inline;">
<button type="submit" class="btn delete-btn" onclick="return confirm('Are you sure you want to delete this file?')">Delete</button>
</form>
{% endif %}