Compare commits

...

8 Commits

Author SHA1 Message Date
cube
23b0819079 in front log 2026-05-01 19:59:00 +01:00
cube
9fcaf72457 images with same file name wont overwrite each other 2026-05-01 17:26:20 +01:00
cube
0df4bf926b remove potential html from title of member page 2026-05-01 17:09:05 +01:00
cube
fe26621221 remove potential html from title of member page 2026-05-01 17:08:18 +01:00
cube
b47fdac633 allow img tags to be used in member names 2026-05-01 17:03:23 +01:00
cube
b18c83a8ca image asset style update 2026-05-01 16:56:13 +01:00
cube
a21dc5f73f adjusted some styling 2026-05-01 16:11:39 +01:00
cube
0d4eec9c80 misc image uploads for use in custom sections, blog posts, or wherever you want!!!!! 2026-05-01 16:11:32 +01:00
13 changed files with 86 additions and 15 deletions

1
.gitignore vendored
View File

@@ -17,3 +17,4 @@ build/
/myriad/static/blinkies /myriad/static/blinkies
/myriad/static/stamps /myriad/static/stamps
myriad/static/tmp myriad/static/tmp
myriad/static/misc

View File

@@ -1,7 +1,7 @@
import os, datetime import os, datetime
from flask import Flask from flask import Flask
from myriad.utilities import server_time, get_datetime_str from myriad.utilities import server_time, get_datetime_str, remove_html
from myriad.db import get_db from myriad.db import get_db
@@ -45,6 +45,6 @@ def create_app():
return member return member
return dict(get_themes=get_themes, server_time=w_server_time, get_datetime_str=w_get_datetime_str, get_member=get_member) return dict(get_themes=get_themes, server_time=w_server_time, get_datetime_str=w_get_datetime_str, get_member=get_member, remove_html=remove_html)
return app return app

View File

@@ -771,6 +771,22 @@ def assets():
filename = file.filename filename = file.filename
file.save(os.path.join(current_app.config["STAMPS_UPLOAD_FOLDER"], filename)) file.save(os.path.join(current_app.config["STAMPS_UPLOAD_FOLDER"], filename))
if "image" in request.files:
file = request.files["image"]
filename = file.filename
fname, ftype = filename.split(".")
i = 0
if os.path.exists(os.path.join(current_app.config["MISC_UPLOAD_FOLDER"], filename)):
i = 2
while os.path.exists(os.path.join(current_app.config["MISC_UPLOAD_FOLDER"], fname+str(i)+"."+ftype)):
i += 1
if i == 0:
file.save(os.path.join(current_app.config["MISC_UPLOAD_FOLDER"], filename))
else:
file.save(os.path.join(current_app.config["MISC_UPLOAD_FOLDER"], fname+str(i)+"."+ftype))
icons = db.execute("SELECT * FROM icons").fetchall() icons = db.execute("SELECT * FROM icons").fetchall()
icon_storage = os.listdir(current_app.config["ICON_UPLOAD_FOLDER"]) icon_storage = os.listdir(current_app.config["ICON_UPLOAD_FOLDER"])
@@ -793,8 +809,9 @@ def assets():
blinkies = os.listdir(current_app.config["BLINKIES_UPLOAD_FOLDER"]) blinkies = os.listdir(current_app.config["BLINKIES_UPLOAD_FOLDER"])
stamps = os.listdir(current_app.config["STAMPS_UPLOAD_FOLDER"]) stamps = os.listdir(current_app.config["STAMPS_UPLOAD_FOLDER"])
images = os.listdir(current_app.config["MISC_UPLOAD_FOLDER"])
return render_template("manage/assets.html", icons=unlinked_icons, icon_storage=i_storage, blinkies=blinkies, stamps=stamps) return render_template("manage/assets.html", icons=unlinked_icons, icon_storage=i_storage, blinkies=blinkies, stamps=stamps, images=images)
@bp.route("/delete_idb") @bp.route("/delete_idb")
@login_required @login_required

View File

@@ -95,6 +95,12 @@ form textarea{
height:100px; height:100px;
float:left; float:left;
} }
.manage_images_3{
display:block;
width:180px;
height:100px;
float:left;
}
@@ -108,6 +114,14 @@ form textarea{
height:56px; height:56px;
width:auto; width:auto;
} }
.mng_img
{
height:56px;
width:auto;
object-fit:scale-down;
max-width:180px;
overflow:hidden;
}

View File

@@ -34,7 +34,7 @@
} }
body.pink{ body.pink{
background: linear-gradient(90deg, #f8a1e5 0%, #d55ff3 50%, #f5c35e 100%); background: linear-gradient(90deg, rgba(235, 202, 202, 1) 0%, rgba(201, 77, 255, 1) 50%, rgba(242, 234, 124, 1) 100%);
scrollbar-color:#a414da #d991f4; scrollbar-color:#a414da #d991f4;
} }
.pink .container, .pink #mobile-nav{ .pink .container, .pink #mobile-nav{

View File

@@ -13,7 +13,7 @@
{% for member in memberlist %} {% for member in memberlist %}
{% if not g.user and member[9]==0 %} {% if not g.user and member[9]==0 %}
{% else %} {% else %}
<a href="#m{{ member[0] }}">{{ member[3] }}</a> | <a href="#m{{ member[0] }}">{{ member[3]|safe }}</a> |
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>

View File

@@ -14,7 +14,7 @@
{% for member in group_members[group[0]] %} {% for member in group_members[group[0]] %}
{% if not g.user and member[9]==0 %} {% if not g.user and member[9]==0 %}
{% else %} {% else %}
&#10032; <a href="{{ url_for('home.page', mid=member[0]) }}">{{ member[3] }}</a> <br> &#10032; <a href="{{ url_for('home.page', mid=member[0]) }}">{{ member[3]|safe }}</a> <br>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}

View File

@@ -6,7 +6,7 @@
<div id="frontbanner" class="heading"> <div id="frontbanner" class="heading">
{% if front_list|length > 0 %} {% if front_list|length > 0 %}
<b>currently fronting: </b> {% for member in front_list %}{% if not g.user and member[9]==0 %}{% else %}<a href="{{ url_for('home.page', mid=member[0]) }}">{{ member[3] }}</a> {% if front_list.index(member) != front_list|length -1 %}&{% endif %}{% endif %} {% endfor %} <b>currently fronting: </b> {% for member in front_list %}{% if not g.user and member[9]==0 %}{% else %}<a href="{{ url_for('home.page', mid=member[0]) }}">{{ member[3]|safe }}</a> {% if front_list.index(member) != front_list|length -1 %}&{% endif %}{% endif %} {% endfor %}
{% else %} {% else %}
<i><sub>There are currently no members listed as fronting</sub></i> <i><sub>There are currently no members listed as fronting</sub></i>
{% endif %} {% endif %}

View File

@@ -17,7 +17,7 @@
<div class="maintext">Front change history</div> <div class="maintext">Front change history</div>
<div class="log"> <div class="log">
{% for front in front_log %} {% for front in front_log %}
<p><b>{{ get_datetime_str(front[2]) }}</b> - {{ get_member(front[1])[3] }}{% if front[3] %} <i>(ended: {{ get_datetime_str(front[3]) }})</i> | <a class="danger" href="{{ url_for('manage.delete_front_log', fid=front[0]) }}">delete</a>{% endif %}</p> <p><b>{{ get_datetime_str(front[2]) }}</b> - {{ get_member(front[1])[3]|safe }}{% if front[3] %} <i>(ended: {{ get_datetime_str(front[3]) }})</i> | <a class="danger" href="{{ url_for('manage.delete_front_log', fid=front[0]) }}">delete</a>{% endif %}</p>
{% endfor %} {% endfor %}
</div> </div>

View File

@@ -36,9 +36,44 @@
{% endif %} {% endif %}
<div class="heading big">Blinkies</div> <div class="heading big">Blinkies</div>
<p>Not implemented yet (sorry!)</p>
<div class="heading big">Stamps</div> <div class="heading big">Stamps</div>
<p>Not implemented yet (sorry!)</p>
<hr>
<div class="heading big">Upload Images</div>
<p>Upload images for use in pages and custom sections.
Just right click, copy image URL, then use it in the HTML
however you like. You can use style tags to customize how the
images look/behave on your page, just be careful not to use class or
id selectors that already exist (or do, if you are wanting to overwrite
their behaviour!). We will make a list of in-use class and ids here, soon.
</p>
<form method="post" enctype="multipart/form-data" id="image">
<input type="file" name="image" class="mobile-edit">
<input type="submit" value="Upload to Site">
</form>
<div class="manage_images">
<div class="manage_images_2">
{% for image in images %}
<div class="manage_images_3">
<img class="mng_img" src="{{ url_for('static', filename='misc/'+image) }}">
<br class="clear" />
{% set imgurl = url_for('static', filename='misc/'+image) %}
<a href="" onclick="copyURL('{{imgurl}}')">Copy Image URL</a> &#9734 <a href="">Delete</a>
</div>
{% endfor %}
</div>
</div>
<script>
function copyURL(a) {
navigator.clipboard.writeText(a);
}
</script>
</div> </div>

View File

@@ -1,13 +1,13 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block header %} {% block header %}
<div class="title">{% block title %}Edit {{ member[3] }}{% endblock %}</div> <div class="title">{% block title %}Edit {{ remove_html(member[3]) }}{% endblock %}</div>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div class="container"> <div class="container">
<a href="{{url_for('home.page', mid=member[0])}}">View {{member[3]}}'s page</a> <a href="{{url_for('home.page', mid=member[0])}}">View {{member[3]|safe}}'s page</a>
<br class="clear" /> <br class="clear" />
<div class="heading">Edit Details</div> <div class="heading">Edit Details</div>

View File

@@ -1,5 +1,5 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}{{ member[3] }}{% endblock %} {% block title %}{{ remove_html(member[3]) }}{% endblock %}
{% block content %} {% block content %}
@@ -23,7 +23,7 @@
{% else %} {% else %}
<img class="icon" src="{{ url_for('static', filename='any.jpg') }}"> <img class="icon" src="{{ url_for('static', filename='any.jpg') }}">
{% endif %} {% endif %}
<div class="title">{% if member[9]==0 %}<img class="lock" src="{{ url_for('static', filename='lock.png') }}">{% endif %}{{member[3]}}</div> <div class="title">{% if member[9]==0 %}<img class="lock" src="{{ url_for('static', filename='lock.png') }}">{% endif %}{{member[3]|safe}}</div>
<div class="maintext"> <div class="maintext">
{{member[5].replace('\n', '<br>')|safe}} {{member[5].replace('\n', '<br>')|safe}}
</div> </div>

View File

@@ -1,4 +1,4 @@
import datetime import datetime, re
def server_time(): def server_time():
raw = datetime.datetime.now() raw = datetime.datetime.now()
@@ -18,4 +18,8 @@ def get_datetime_obj(dt_string):
return dt_obj return dt_obj
def get_datetime_str(dt_obj): def get_datetime_str(dt_obj):
return dt_obj.strftime("%d/%m/%Y, %H:%M:%S") return dt_obj.strftime("%d/%m/%Y, %H:%M:%S")
def remove_html(mystring):
newstring = re.sub('<[^<]+?>', '', mystring)
return newstring