mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 11:36:16 +00:00
Rename routes to gallery
Move methods to api.py Remove old db manager as its unused Remove old db tables as theres a new schema file Rename onlylegsSass to sassy, unused for now Update example.env to reflect new layout
This commit is contained in:
parent
a499e6c840
commit
e395139656
13 changed files with 146 additions and 326 deletions
64
gallery/gallery.py
Normal file
64
gallery/gallery.py
Normal file
|
@ -0,0 +1,64 @@
|
|||
from flask import (
|
||||
Blueprint, flash, g, redirect, render_template, request, url_for, jsonify
|
||||
)
|
||||
from werkzeug.exceptions import abort
|
||||
from werkzeug.utils import secure_filename
|
||||
from gallery.auth import login_required
|
||||
from gallery.db import get_db
|
||||
blueprint = Blueprint('gallery', __name__)
|
||||
|
||||
|
||||
@blueprint.route('/')
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
|
||||
@blueprint.route('/image/<request_id>')
|
||||
def image(request_id):
|
||||
# Check if request_id is valid
|
||||
try:
|
||||
request_id = int(request_id)
|
||||
except ValueError:
|
||||
abort(404)
|
||||
|
||||
result = onlylegsDB.getImage(request_id)
|
||||
|
||||
return render_template('image.html', fileName=result[1], id=request_id)
|
||||
|
||||
|
||||
@blueprint.route('/group')
|
||||
def groups():
|
||||
return render_template('groups/group.html', group_id='gwa gwa')
|
||||
|
||||
@blueprint.route('/group/<int:id>')
|
||||
def group(id):
|
||||
return render_template('groups/group.html', group_id=id)
|
||||
|
||||
|
||||
@blueprint.route('/upload', methods=('GET', 'POST'))
|
||||
@login_required
|
||||
def upload():
|
||||
if request.method == 'POST':
|
||||
file = request.files['file']
|
||||
form = request.form
|
||||
|
||||
if secure_filename(file.filename) == '':
|
||||
flash('No selected file')
|
||||
return redirect('gallery.upload')
|
||||
|
||||
return render_template('upload.html')
|
||||
|
||||
|
||||
@blueprint.route('/profile')
|
||||
def profile():
|
||||
return render_template('profile.html', user_id='gwa gwa')
|
||||
|
||||
|
||||
@blueprint.route('/profile/<int:id>')
|
||||
def profile_id(id):
|
||||
return render_template('profile.html', user_id=id)
|
||||
|
||||
|
||||
@blueprint.route('/settings')
|
||||
@login_required
|
||||
def settings():
|
||||
return render_template('settings.html')
|
Loading…
Add table
Add a link
Reference in a new issue