removing auth temporarily for easier usage

This commit is contained in:
Bryan Van Deusen
2025-12-21 18:51:38 -05:00
parent a77724dccc
commit 71d16dbfb3
2 changed files with 26 additions and 21 deletions
+20 -19
View File
@@ -17,20 +17,21 @@ main = Blueprint('main', __name__)
@main.route('/')
def index():
from random import choice # (kept from your original)
image = ImageRecord.query.order_by(func.random()).first()
background_url = None
return redirect(url_for("gallery"))
# from random import choice # (kept from your original)
# image = ImageRecord.query.order_by(func.random()).first()
# background_url = None
if image:
path = image.thumb_path or image.filepath
filename = path.replace('/images/', '')
background_url = url_for('main.serve_image', filename=filename)
# if image:
# path = image.thumb_path or image.filepath
# filename = path.replace('/images/', '')
# background_url = url_for('main.serve_image', filename=filename)
return render_template('index.html', background_url=background_url)
# return render_template('index.html', background_url=background_url)
@main.route('/gallery')
@login_required
# @login_required
def gallery():
"""
Gallery with pagination and optional tag filter (?tag=artist:NAME or any tag name).
@@ -71,7 +72,7 @@ def serve_image(filename):
@main.route('/tags')
@login_required
# @login_required
def tag_list():
"""
Generic tag explorer:
@@ -110,20 +111,20 @@ def tag_list():
active_kind=kind)
@main.route('/artists')
@login_required
# @login_required
def artist_list():
# Backward-compatible route that now shows the Tag Explorer filtered to artist tags
return redirect(url_for('main.tag_list', kind='artist'))
@main.route('/artist/<artist_name>')
@login_required
# @login_required
def artist_gallery(artist_name):
# Backward-compatible: go to gallery filtered by artist tag
return redirect(url_for('main.gallery', tag=f"artist:{artist_name}"))
@main.route('/settings')
@login_required
# @login_required
def settings():
if not current_user.is_admin:
abort(403)
@@ -131,7 +132,7 @@ def settings():
@main.route('/trigger-thumbnail-generation', methods=['POST'])
@login_required
# @login_required
def trigger_thumbnail_generation():
if not current_user.is_admin:
flash("You do not have permission to perform this action.", "danger")
@@ -148,7 +149,7 @@ def trigger_thumbnail_generation():
@main.route('/import-images')
@login_required
# @login_required
def trigger_image_import():
with open('/import/trigger.flag', 'w') as f:
f.write('start')
@@ -157,7 +158,7 @@ def trigger_image_import():
@main.route('/reset-db', methods=['POST'])
@login_required
# @login_required
def reset_db():
"""
Safe reset that works with Postgres (TRUNCATE ... CASCADE).
@@ -194,7 +195,7 @@ def reset_db():
# ----------------------------
@main.get("/image/<int:image_id>/tags")
@login_required
# @login_required
def list_tags(image_id):
from app.models import ImageRecord
img = ImageRecord.query.get_or_404(image_id)
@@ -202,7 +203,7 @@ def list_tags(image_id):
@main.post("/image/<int:image_id>/tags/add")
@login_required
# @login_required
def add_tag(image_id):
"""
Minimal JSON endpoint to add a tag to an image.
@@ -233,7 +234,7 @@ def add_tag(image_id):
@main.post("/image/<int:image_id>/tags/remove")
@login_required
# @login_required
def remove_tag(image_id):
"""
Minimal JSON endpoint to remove a tag from an image.
+6 -2
View File
@@ -11,7 +11,11 @@
<header>
<nav class="navbar">
<a class="nav-button" href="{{ url_for('main.gallery') if current_user.is_authenticated else url_for('main.index') }}">Home</a>
<a class="nav-button" href="{{ url_for('main.gallery') }}">Home</a>
<a class="nav-button" href="{{ url_for('main.tag_list', kind='artist') }}">Artists</a>
<a class="nav-button" href="{{ url_for('main.tag_list') }}">Tags</a>
<a class="nav-button" href="{{ url_for('main.settings') }}">Settings</a>
<!-- <a class="nav-button" href="{{ url_for('main.gallery') if current_user.is_authenticated else url_for('main.index') }}">Home</a>
{% if current_user.is_authenticated and current_user.is_admin %}
<a class="nav-button" href="{{ url_for('main.settings') }}">Settings</a>
@@ -24,7 +28,7 @@
{% else %}
<a class="nav-button" href="{{ url_for('auth.login') }}">Login</a>
<a class="nav-button" href="{{ url_for('auth.register') }}">Register</a>
{% endif %}
{% endif %} -->
</nav>
</header>