Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
273 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,5 +191,5 @@ flycheck_*.el | |
# network security | ||
/network-security.data | ||
|
||
|
||
|
||
.flaskenv | ||
app/app.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import mimetypes | ||
from os.path import join, basename, dirname | ||
from werkzeug.utils import secure_filename | ||
from slugify import slugify | ||
mimetypes.init() | ||
|
||
def get_url_for(file, username, collection_slug, piece_slug): | ||
name = f'{username}-{collection_slug}-{piece_slug}-{secure_filename(basename(file.filename))}' | ||
path = join(dirname(__file__), "static", name) | ||
file.save(path) | ||
|
||
return f"/static/{name}" | ||
|
||
def get_type_for(file): | ||
return mimetypes.guess_type(file.filename)[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<h3> | ||
<a href="/{{piece.collection.copyright_holder.username}}/{{piece.collection.slug}}/{{piece.slug}}">{{piece.name}}</a> | ||
</h3> | ||
{{piece.description}} | ||
<a href="{{piece.url}}" download>download</a> | ||
{% autoescape false %} | ||
{{piece.html}} | ||
{% endautoescape %} | ||
|
||
{% if piece.type.startswith("audio/") %} | ||
<audio controls src="{{piece.url}}"></audio> | ||
{% endif %} | ||
|
||
{% if piece.type.startswith("image/") %} | ||
<img src="{{piece.url}}"> | ||
{% endif %} | ||
|
||
{% if piece.type.startswith("video/") %} | ||
<video controls src="{{piece.url}}"></video> | ||
{% endif %} | ||
|
||
<p xmlns:dct="http://purl.org/dc/terms/" | ||
xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#"> | ||
<a rel="license" | ||
href="https://creativecommons.org/publicdomain/zero/1.0/"> | ||
<img src="https://i.creativecommons.org/p/zero/1.0/88x31.png" | ||
style="border-style: none;" | ||
alt="CC0" /> | ||
</a> | ||
<br /> | ||
To the extent possible under law, | ||
<a rel="dct:publisher" | ||
href="https://cc0.snoot.club"> | ||
<span property="dct:title"> | ||
{{collection.copyright_holder.legal_name}} | ||
</span> | ||
</a> | ||
has waived all copyright and related or neighboring rights to | ||
|
||
<span property="dct:title"> | ||
{{piece.name}} | ||
</span>. | ||
This work is published from: | ||
<span property="vcard:Country" | ||
datatype="dct:ISO3166" | ||
content="{{collection.country_code}}" | ||
about="{{collection.country}}"> | ||
{{collection.country}} | ||
</span>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,14 @@ | ||
{% extends "base.html" %} | ||
{% if current_user.is_authenticated and current_user.id == collection.copyright_holder_id %} | ||
<a href="{{url_for('new_piece', username=current_user.username, slug=collection.slug)}}"> | ||
new piece | ||
</a> | ||
{% endif %} | ||
{% block nav %} | ||
{% if current_user.is_authenticated and current_user.id == copyright_holder.id %} | ||
<a href="{{url_for('new_piece', username=current_user.username, slug=collection.slug)}}"> | ||
new piece | ||
</a> | ||
{% endif %} | ||
{% endblock %} | ||
{% block content %} | ||
<h2>pieces</h2> | ||
{% for item in collection.pieces %} | ||
<h3><a href="{{item.url}}"</a></h3> | ||
{{item.description}} | ||
{% autoescape false %} | ||
{{item.html}} | ||
{% endautoescape %} | ||
|
||
<p xmlns:dct="http://purl.org/dc/terms/" | ||
xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#"> | ||
<a rel="license" | ||
href="https://creativecommons.org/publicdomain/zero/1.0/"> | ||
<img src="https://i.creativecommons.org/p/zero/1.0/88x31.png" | ||
style="border-style: none;" | ||
alt="CC0" /> | ||
</a> | ||
<br /> | ||
To the extent possible under law, | ||
<a rel="dct:publisher" | ||
href="https://cc0.snoot.club"> | ||
<span property="dct:title"> | ||
{{collection.copyright_holder}} | ||
</span> | ||
</a> | ||
has waived all copyright and related or neighboring rights to | ||
|
||
<span property="dct:title"> | ||
{{item.name}} | ||
</span>. | ||
This work is published from: | ||
<span property="vcard:Country" | ||
datatype="dct:ISO3166" | ||
content="{{collection.country_code}}" | ||
about="{{collection.country}}"> | ||
{{collection.country}} | ||
</span>. | ||
{% endfor %} | ||
{% endblock %} | ||
<p>{{collection.description}}</p> | ||
{% for piece in collection.pieces %} | ||
{% include '_piece.html' %} | ||
{% endfor %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
{% extends "base.html" %} | ||
{% block nav %} | ||
{% if current_user.is_authenticated and current_user.id == copyright_holder.id %} | ||
<a href="{{url_for('new_collection', username=copyright_holder.username)}}"> | ||
new collection | ||
</a> | ||
{% endif %} | ||
{% if current_user.is_authenticated and current_user.id == copyright_holder.id %} | ||
<a href="{{url_for('new_collection', username=copyright_holder.username)}}"> | ||
new collection | ||
</a> | ||
{% endif %} | ||
{% endblock %} | ||
{% block content %} | ||
<h2>collections</h2> | ||
{% for collection in copyright_holder.collections %} | ||
<ul> | ||
<ul> | ||
{% for collection in copyright_holder.collections %} | ||
|
||
<li> | ||
|
||
<a href="{{url_for('collection', collection)}}"> | ||
<a href="{{url_for('collection', username=copyright_holder.username, slug=collection.slug)}}"> | ||
{{collection.name}} | ||
</a> — <span class="collection-description">{{collection.description}}</span> | ||
</li> | ||
</ul> | ||
{% endfor %} | ||
{% endfor %} | ||
</ul> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.