mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 03:26:16 +00:00
Fixing random crap Deepsource complained about
This commit is contained in:
parent
5cb8c1dd13
commit
f4ea1984b0
3 changed files with 7 additions and 49 deletions
|
@ -51,48 +51,6 @@ def file(file_name):
|
||||||
return send_from_directory(os.path.dirname(thumb), os.path.basename(thumb))
|
return send_from_directory(os.path.dirname(thumb), os.path.basename(thumb))
|
||||||
|
|
||||||
|
|
||||||
# @blueprint.route('/page', methods=['get'])
|
|
||||||
# def page():
|
|
||||||
# """
|
|
||||||
# Returns a json object with all the images
|
|
||||||
# info required to generate a page
|
|
||||||
# """
|
|
||||||
# page_num = request.args.get('page', default=1, type=int)
|
|
||||||
# limit = current_app.config['UPLOAD_CONF']['max-load']
|
|
||||||
|
|
||||||
# if not page_num:
|
|
||||||
# abort(400, 'No page number specified')
|
|
||||||
# if not isinstance(page_num, int):
|
|
||||||
# abort(400, 'Page number is not a number')
|
|
||||||
# if int(page_num) < 1:
|
|
||||||
# abort(400, 'Page number is less than 1')
|
|
||||||
|
|
||||||
# # get the total number of images in the database
|
|
||||||
# # calculate the total number of pages, and make sure the page number is valid
|
|
||||||
# total_images = db_session.query(db.Posts.id).count()
|
|
||||||
# pages = ceil(max(total_images, limit) / limit)
|
|
||||||
# if page_num > pages:
|
|
||||||
# abort(404, 'You have gone above and beyond, but this isnt a fairy tale.')
|
|
||||||
|
|
||||||
# # get the images for the current page
|
|
||||||
# images = (db_session.query(db.Posts.filename, db.Posts.alt, db.Posts.colours,
|
|
||||||
# db.Posts.created_at, db.Posts.id)
|
|
||||||
# .order_by(db.Posts.id.desc())
|
|
||||||
# .offset((page_num - 1) * limit)
|
|
||||||
# .limit(limit)
|
|
||||||
# .all())
|
|
||||||
# image_list = []
|
|
||||||
# for image in images:
|
|
||||||
# image_list.append({
|
|
||||||
# 'id': image.id,
|
|
||||||
# 'filename': image.filename,
|
|
||||||
# 'alt': image.alt,
|
|
||||||
# 'colours': image.colours,
|
|
||||||
# 'created_at': image.created_at,
|
|
||||||
# })
|
|
||||||
# return jsonify(image_list)
|
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route("/upload", methods=["POST"])
|
@blueprint.route("/upload", methods=["POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def upload():
|
def upload():
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// fade in images
|
// fade in images
|
||||||
async function imgFade(obj, time = 250) {
|
function imgFade(obj, time = 250) {
|
||||||
obj.style.transition = `opacity ${time}ms`;
|
obj.style.transition = `opacity ${time}ms`;
|
||||||
obj.style.opacity = 1;
|
obj.style.opacity = 1;
|
||||||
}
|
}
|
||||||
// Lazy load images when they are in view
|
// Lazy load images when they are in view
|
||||||
async function loadOnView() {
|
function loadOnView() {
|
||||||
const lazyLoad = document.querySelectorAll('#lazy-load');
|
const lazyLoad = document.querySelectorAll('#lazy-load');
|
||||||
const webpSupport = checkWebpSupport();
|
const webpSupport = checkWebpSupport();
|
||||||
|
|
||||||
|
@ -65,9 +65,9 @@ window.onload = function () {
|
||||||
}
|
}
|
||||||
infoButton.onclick = function () {
|
infoButton.onclick = function () {
|
||||||
popUpShow('OnlyLegs',
|
popUpShow('OnlyLegs',
|
||||||
'Using <a href="https://phosphoricons.com/">Phosphoricons</a> and Flask<br>' +
|
'<a href="https://github.com/Fluffy-Bean/onlylegs">V23.04.08</a> ' +
|
||||||
'Made by Fluffy and others with ❤️ <br>' +
|
'using <a href="https://phosphoricons.com/">Phosphoricons</a> and Flask.' +
|
||||||
'<a href="https://github.com/Fluffy-Bean/onlylegs">V23.04.08</a>');
|
'<br>Made by Fluffy and others with ❤️');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
async function checkWebpSupport() {
|
function checkWebpSupport() {
|
||||||
var webpSupport = false;
|
var webpSupport = false;
|
||||||
try {
|
try {
|
||||||
webpSupport = document.createElement('canvas').toDataURL('image/webp').indexOf('data:image/webp') == 0;
|
webpSupport = document.createElement('canvas').toDataURL('image/webp').indexOf('data:image/webp') === 0;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
webpSupport = false;
|
webpSupport = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue