mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
Add package validation
This commit is contained in:
parent
a8edae1da0
commit
49a2a9192f
@ -98,7 +98,7 @@ class Package(db.Model):
|
||||
author_id = db.Column(db.Integer, db.ForeignKey('user.id'))
|
||||
name = db.Column(db.String(100), nullable=False)
|
||||
title = db.Column(db.String(100), nullable=False)
|
||||
shortDesc = db.Column(db.Text, nullable=True)
|
||||
shortDesc = db.Column(db.String(200), nullable=False)
|
||||
desc = db.Column(db.Text, nullable=True)
|
||||
type = db.Column(db.Enum(PackageType))
|
||||
|
||||
@ -106,7 +106,7 @@ class Package(db.Model):
|
||||
repo = db.Column(db.String(200), nullable=True)
|
||||
website = db.Column(db.String(200), nullable=True)
|
||||
issueTracker = db.Column(db.String(200), nullable=True)
|
||||
forums = db.Column(db.String(200), nullable=False)
|
||||
forums = db.Column(db.Integer, nullable=False)
|
||||
|
||||
# Releases
|
||||
releases = db.relationship('PackageRelease', backref='package',
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
<ul class="buttonset linedbuttonset">
|
||||
{% if package.repo %}<li><a href="{{ package.repo }}">View Source</a></li>{% endif %}
|
||||
{% if package.forums %}<li><a href="{{ package.forums }}">Forums</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 %}
|
||||
{% if package.website %}<li><a href="{{ package.website }}">Website</a></li>{% endif %}
|
||||
{% if package.checkPerm(current_user, "EDIT_PACKAGE") %}
|
||||
|
@ -6,6 +6,7 @@ from app.models import *
|
||||
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import *
|
||||
from wtforms.validators import *
|
||||
|
||||
|
||||
# TODO: the following could be made into one route, except I'm not sure how
|
||||
@ -58,15 +59,15 @@ def package_page(type, author, name):
|
||||
|
||||
|
||||
class PackageForm(FlaskForm):
|
||||
name = StringField("Name")
|
||||
title = StringField("Title")
|
||||
shortDesc = StringField("Short Description")
|
||||
desc = StringField("Long Description")
|
||||
type = SelectField("Type", choices=PackageType.choices(), coerce=PackageType.coerce, default=PackageType.MOD)
|
||||
repo = StringField("Repo URL")
|
||||
website = StringField("Website URL")
|
||||
issueTracker = StringField("Issue Tracker URL")
|
||||
forums = StringField("Forum Topic ID")
|
||||
name = StringField("Name", [InputRequired(), Length(1, 20), Regexp("^[a-z0-9_]", 0, "Lower case letters (a-z), digits (0-9), and underscores (_) only")])
|
||||
title = StringField("Title", [InputRequired(), Length(3, 50)])
|
||||
shortDesc = StringField("Short Description", [InputRequired(), Length(1,200)])
|
||||
desc = TextAreaField("Long Description", [Optional(), Length(0,10000)])
|
||||
type = SelectField("Type", [InputRequired()], choices=PackageType.choices(), coerce=PackageType.coerce, default=PackageType.MOD)
|
||||
repo = StringField("Repo URL", [Optional(), URL()])
|
||||
website = StringField("Website URL", [Optional(), URL()])
|
||||
issueTracker = StringField("Issue Tracker URL", [Optional(), URL()])
|
||||
forums = IntegerField("Forum Topic ID", [InputRequired(), NumberRange(0,999999)])
|
||||
submit = SubmitField('Save')
|
||||
|
||||
@menu.register_menu(app, '.new', 'Create', order=20)
|
||||
@ -110,7 +111,7 @@ class CreatePackageReleaseForm(FlaskForm):
|
||||
class EditPackageReleaseForm(FlaskForm):
|
||||
name = StringField("Name")
|
||||
title = StringField("Title")
|
||||
url = StringField("URL")
|
||||
url = StringField("URL", [URL])
|
||||
approved = BooleanField("Is Approved")
|
||||
submit = SubmitField('Save')
|
||||
|
||||
|
6
setup.py
6
setup.py
@ -28,7 +28,7 @@ if not os.path.isfile("db.sqlite"):
|
||||
mod1.author = ruben
|
||||
mod1.repo = "https://github.com/rubenwardy/awards"
|
||||
mod1.issueTracker = "https://github.com/rubenwardy/awards/issues"
|
||||
mod1.forums = "https://forum.minetest.net/viewtopic.php?t=4870"
|
||||
mod1.forums = 4870
|
||||
mod1.shortDesc = "Adds achievements and an API to register new ones."
|
||||
mod1.desc = """
|
||||
Majority of awards are back ported from Calinou's old fork in Carbone, under same license.
|
||||
@ -59,7 +59,7 @@ awards.register_achievement("award_mesefind",{
|
||||
mod2.author = jeija
|
||||
mod2.repo = "https://github.com/minetest-mods/mesecons/"
|
||||
mod2.issueTracker = "https://github.com/minetest-mods/mesecons/issues"
|
||||
mod2.forums = "https://forum.minetest.net/viewtopic.php?t=628"
|
||||
mod2.forums = 628
|
||||
mod2.shortDesc = "Mesecons adds everything digital, from all kinds of sensors, switches, solar panels, detectors, pistons, lamps, sound blocks to advanced digital circuitry like logic gates and programmable blocks."
|
||||
mod2.desc = """
|
||||
########################################################################
|
||||
@ -155,7 +155,7 @@ No warranty is provided, express or implied, for any part of the project.
|
||||
game1.author = ruben
|
||||
game1.repo = "https://github.com/rubenwardy/capturetheflag"
|
||||
game1.issueTracker = "https://github.com/rubenwardy/capturetheflag/issues"
|
||||
game1.forums = "https://forum.minetest.net/viewtopic.php?t=12835"
|
||||
game1.forums = 12835
|
||||
game1.shortDesc = "Two teams battle to snatch and return the enemy's flag, before the enemy takes their own!"
|
||||
game1.desc = """
|
||||
As seen on the Capture the Flag server (minetest.rubenwardy.com:30000)
|
||||
|
Loading…
Reference in New Issue
Block a user