mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 11:36:16 +00:00
SVG favicons
Image and colour preview for links
This commit is contained in:
parent
3008a55899
commit
f9aeb0955d
5 changed files with 164 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
"""
|
||||
Onlylegs - API endpoints
|
||||
Used intermally by the frontend and possibly by other applications
|
||||
Used internally by the frontend and possibly by other applications
|
||||
"""
|
||||
from uuid import uuid4
|
||||
import os
|
||||
|
@ -32,7 +32,7 @@ db_session = db_session()
|
|||
def get_file(file_name):
|
||||
"""
|
||||
Returns a file from the uploads folder
|
||||
t is the type of file (thumb, etc)
|
||||
t is the type of file (thumb, etc.)
|
||||
w and h are the width and height of the image for resizing
|
||||
f is whether to apply filters to the image, such as blurring NSFW images
|
||||
b is whether to force blur the image, even if it's not NSFW
|
||||
|
@ -43,6 +43,15 @@ def get_file(file_name):
|
|||
height = request.args.get('h', default=0, type=int) # Height of image
|
||||
filtered = request.args.get('f', default=False, type=bool) # Whether to apply filters
|
||||
blur = request.args.get('b', default=False, type=bool) # Whether to force blur
|
||||
|
||||
# Idea: instead if specifying the height and width, pass in a string like "200x200" or "200x" or "x200"
|
||||
# This would remove the need for the if statements below and would be possible to pass in a string
|
||||
# like 'thumb' to get the thumbnail size instead of having to specify the width and height
|
||||
# This would also allow for more flexibility in the future if I wanted to add more sizes
|
||||
# Another idea is to pass in a list of filters to apply to the image
|
||||
# such as "blur,grayscale" or "blur,grayscale,sepia". But this would require a lot more work to implement
|
||||
# and would be a lot more complicated to use, would also implement the risk of the server being overloaded
|
||||
# with requests to apply a lot of filters to a lot of images at once
|
||||
|
||||
file_name = secure_filename(file_name) # Sanitize file name
|
||||
|
||||
|
|
60
gallery/static/images/logo-black.svg
Normal file
60
gallery/static/images/logo-black.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 7.9 KiB |
62
gallery/static/images/logo-white.svg
Normal file
62
gallery/static/images/logo-white.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 8.1 KiB |
|
@ -1,5 +1,10 @@
|
|||
{% extends 'layout.html' %}
|
||||
|
||||
{% block head %}
|
||||
<meta property="og:image" content="/api/file/{{ image.file_name }}"/>
|
||||
<meta name="theme-color" content="#{{ image.image_colours.0.0 }}{{ image.image_colours.0.1 }}{{ image.image_colours.0.2 }}"/>
|
||||
{% endblock %}
|
||||
|
||||
{% block wrapper_class %}image-wrapper{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
|
|
@ -3,13 +3,37 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Gallery</title>
|
||||
<link rel="icon" href="{{url_for('static', filename='images/icon.png')}}">
|
||||
|
||||
<title>{{ config.WEBSITE.name }}</title>
|
||||
<meta name="description" content="{{ config.WEBSITE.motto }}"/>
|
||||
<meta name="author" content="{{ config.WEBSITE.author }}"/>
|
||||
|
||||
<meta property="og:title" content="{{ config.WEBSITE.name }}"/>
|
||||
<meta property="og:description" content="{{ config.WEBSITE.motto }}"/>
|
||||
<meta property="og:type" content="website"/>
|
||||
|
||||
<meta name="twitter:title" content="{{ config.WEBSITE.name }}"/>
|
||||
<meta name="twitter:description" content="{{ config.WEBSITE.motto }}"/>
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
|
||||
<link
|
||||
href="{{url_for('static', filename='images/logo-black.svg')}}"
|
||||
rel="icon"
|
||||
type="image/svg+xml"
|
||||
media="(prefers-color-scheme: light)"/>
|
||||
<link
|
||||
href="{{url_for('static', filename='images/logo-white.svg')}}"
|
||||
rel="icon"
|
||||
type="image/svg+xml"
|
||||
media="(prefers-color-scheme: dark)"/>
|
||||
|
||||
<link rel="stylesheet" href="{{url_for('static', filename='theme/style.css')}}" defer>
|
||||
|
||||
{% assets "js_all" %}
|
||||
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
|
||||
{% endassets %}
|
||||
|
||||
{% block head %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<div class="notifications"></div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue