mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 14:02:24 +01:00
Add non-free warning
This commit is contained in:
parent
fa2f17526f
commit
1600687449
@ -186,9 +186,11 @@ class Notification(db.Model):
|
||||
class License(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
name = db.Column(db.String(50), nullable=False, unique=True)
|
||||
is_foss = db.Column(db.Boolean, nullable=False, default=True)
|
||||
|
||||
def __init__(self, v):
|
||||
def __init__(self, v, is_foss=True):
|
||||
self.name = v
|
||||
self.is_foss = is_foss
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
@ -8,6 +8,21 @@
|
||||
<p>
|
||||
{{ package.shortDesc }}
|
||||
</p>
|
||||
|
||||
|
||||
{% if not package.license.is_foss and not package.media_license.is_foss and package.type != package.type.TXP %}
|
||||
<p style="color:#f33;">
|
||||
<b>Warning:</b> Non-free code and media.
|
||||
</p>
|
||||
{% elif not package.license.is_foss and package.type != package.type.TXP %}
|
||||
<p style="color:#f33;">
|
||||
<b>Warning:</b> Non-free code.
|
||||
</p>
|
||||
{% elif not package.media_license.is_foss %}
|
||||
<p style="color:#f33;">
|
||||
<b>Warning:</b> Non-free media.
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</a></li>
|
||||
{% endmacro %}
|
||||
|
@ -26,7 +26,9 @@
|
||||
{{ render_field(form.shortDesc, class_="pkg_meta") }}
|
||||
{{ render_field(form.desc, class_="pkg_meta") }}
|
||||
{{ render_multiselect_field(form.tags, class_="pkg_meta") }}
|
||||
{{ render_field(form.license, class_="pkg_meta") }}
|
||||
<div class="pkg_meta">
|
||||
{{ render_field(form.license, class_="not_txp") }}
|
||||
</div>
|
||||
{{ render_field(form.media_license, class_="pkg_meta") }}
|
||||
|
||||
<div class="pkg_meta">
|
||||
|
@ -61,7 +61,21 @@
|
||||
|
||||
<aside class="asideright box box_grey">
|
||||
<h3>Details</h3>
|
||||
|
||||
<div class="box-body">
|
||||
{% if not package.license.is_foss and not package.media_license.is_foss and package.type != package.type.TXP %}
|
||||
<div class="box box_grey alert alert-error" style="margin-top: 0;">
|
||||
<b>Warning:</b> Non-free code and media.
|
||||
</div>
|
||||
{% elif not package.license.is_foss and package.type != package.type.TXP %}
|
||||
<div class="box box_grey alert alert-error" style="margin-top: 0;">
|
||||
<b>Warning:</b> Non-free code.
|
||||
</div>
|
||||
{% elif not package.media_license.is_foss %}
|
||||
<div class="box box_grey alert alert-error" style="margin-top: 0;">
|
||||
<b>Warning:</b> Non-free media.
|
||||
</div>
|
||||
{% endif %}
|
||||
<table>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
@ -93,11 +107,13 @@
|
||||
<tr>
|
||||
<td>License</td>
|
||||
<td>
|
||||
{% if package.license != package.media_license %}
|
||||
{% if package.license == package.media_license %}
|
||||
{{ package.license.name }}
|
||||
{% elif package.type == package.type.TXP %}
|
||||
{{ package.media_license.name }}
|
||||
{% else %}
|
||||
{{ package.license.name }} for code,<br />
|
||||
{{ package.media_license.name }} for media.
|
||||
{% else %}
|
||||
{{ package.license.name }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
@ -108,7 +124,7 @@
|
||||
</table>
|
||||
|
||||
<ul class="buttonset linedbuttonset">
|
||||
{% if package.getDownloadRelease() %}<li><a href="{{ package.getDownloadURL() }}">Download</a></li>{% endif %}
|
||||
{% if package.getDownloadRelease() %}<li><a href="{{ package.getDownloadURL() }}" class="btn_green">Download</a></li>{% endif %}
|
||||
{% if package.repo %}<li><a href="{{ package.repo }}">View Source</a></li>{% endif %}
|
||||
{% if package.forums %}<li><a href="https://forum.minetest.net/viewtopic.php?t={{ package.forums }}">Forums</a></li>{% endif %}
|
||||
{% if package.issueTracker %}<li><a href="{{ package.issueTracker }}">Issue Tracker</a></li>{% endif %}
|
||||
|
28
migrations/versions/d0bec9e5698e_.py
Normal file
28
migrations/versions/d0bec9e5698e_.py
Normal file
@ -0,0 +1,28 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: d0bec9e5698e
|
||||
Revises: aa6d7b595a94
|
||||
Create Date: 2018-05-29 21:23:43.847738
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'd0bec9e5698e'
|
||||
down_revision = 'aa6d7b595a94'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('license', sa.Column('is_foss', sa.Boolean(), nullable=False, server_default="true"))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('license', 'is_foss')
|
||||
# ### end Alembic commands ###
|
7
setup.py
7
setup.py
@ -359,11 +359,16 @@ for tag in ["Inventory", "Mapgen", "Building", \
|
||||
licenses = {}
|
||||
for license in ["GPLv2.1", "GPLv3", "LGPLv2.1", "LGPLv3", "AGPLv2.1", "AGPLv3",
|
||||
"Apache", "BSD 3-Clause", "BSD 2-Clause", "CC0", "CC-BY-SA",
|
||||
"CC-BY", "CC-BY-NC-SA", "MIT", "ZLib"]:
|
||||
"CC-BY", "MIT", "ZLib"]:
|
||||
row = License(license)
|
||||
licenses[row.name] = row
|
||||
db.session.add(row)
|
||||
|
||||
for license in ["CC-BY-NC-SA"]:
|
||||
row = License(license, False)
|
||||
licenses[row.name] = row
|
||||
db.session.add(row)
|
||||
|
||||
if test_data:
|
||||
defineDummyData(licenses, tags, ruben)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user