From 3ce653ba7488b771086a70c699e3686ee803d44a Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 5 Feb 2021 15:29:44 +0000 Subject: [PATCH] Update documentation --- app/blueprints/packages/releases.py | 3 ++ app/flatpages/help/api.md | 53 +++++++++++++++++----- app/flatpages/help/release_webhooks.md | 12 +++-- app/models/packages.py | 4 +- app/templates/packages/create_edit.html | 8 ++++ app/templates/packages/release_wizard.html | 38 +++++++++++++--- 6 files changed, 95 insertions(+), 23 deletions(-) diff --git a/app/blueprints/packages/releases.py b/app/blueprints/packages/releases.py index 71d913d..3b5d263 100644 --- a/app/blueprints/packages/releases.py +++ b/app/blueprints/packages/releases.py @@ -280,6 +280,9 @@ def update_config(package): form.trigger.data = PackageUpdateTrigger.COMMIT form.action.data = "notification" + if "trigger" in request.args: + form.trigger.data = PackageUpdateTrigger.get(request.args["trigger"]) + if form.validate_on_submit(): if form.disable.data: flash("Deleted update configuration", "success") diff --git a/app/flatpages/help/api.md b/app/flatpages/help/api.md index 6805ef6..95d4f37 100644 --- a/app/flatpages/help/api.md +++ b/app/flatpages/help/api.md @@ -46,10 +46,10 @@ Tokens can be attained by visiting [Settings > API Tokens](/user/tokens/). * `title`: Human-readable title. * `name`: Technical name (needs permission if already approved). * `short_description` - * `tags`: List of tag names, see [misc](#misc). - * `content_warnings`: List of content warning names, see [misc](#misc). - * `license`: A license name. - * `media_license`: A license name. + * `tags`: List of [tag](#tags) names. + * `content_warnings`: List of [content warning](#content-warnings) names. + * `license`: A [license](#licenses) name. + * `media_license`: A [license](#licenses) name. * `long_description`: Long markdown description. * `repo`: Git repo URL. * `website`: Website URL. @@ -187,7 +187,7 @@ curl -X POST https://content.minetest.net/api/packages/username/name/screenshots ## Topics -* GET `/api/topics/`: Supports [Package Queries](#package-queries), and the following two options: +* GET `/api/topics/` ([View](/api/topics/)): Supports [Package Queries](#package-queries), and the following two options: * `show_added`: Show topics which exist as packages, default true. * `show_discarded`: Show topics which have been marked as outdated, default false. @@ -206,19 +206,49 @@ Supported query parameters: * `show_discarded`: Show topics marked as discarded. * `limit`: Return at most `limit` topics. +## Types -## Misc +### Tags -* GET `/api/scores/` - * See [Package Queries](#package-queries) -* GET `/api/tags/`: List of: +* GET `/api/tags/` ([View](/api/tags/)): List of: * `name`: technical name * `title`: human-readable title * `description`: tag description or null -* GET `/api/licenses/`: List of: + +### Content Warnings + +* GET `/api/content_warnings/` ([View](/api/content_warnings/)): List of: + * `name`: technical name + * `title`: human-readable title + * `description`: tag description or null + +### Licenses + +* GET `/api/licenses/` ([View](/api/licenses/)): List of: * `name` * `is_foss`: whether the license is foss -* GET `/api/homepage/` + +### Minetest Versions + +* GET `/api/minetest_versions/` ([View](/api/minetest_versions/)) + * `name`: Version name. + * `is_dev`: boolean, is dev version. + * `protocol_version`: protocol version umber. + + +## Misc + +* GET `/api/scores/` ([View](/api/scores/)) + * See [Top Packages Algorithm](/help/top_packages/). + * Supports [Package Queries](#package-queries). + * Returns list of: + * `author`: package author name. + * `name`: package technical name. + * `downloads`: number of downloads. + * `score`: total package score. + * `score_reviews`: score from reviews. + * `score_downloads`: score from downloads. +* GET `/api/homepage/` ([View](/api/homepage/)) - get contents of homepage. * `count`: number of packages * `downloads`: get number of downloads * `new`: new packages @@ -227,4 +257,3 @@ Supported query parameters: * `pop_txp`: popular textures * `pop_game`: popular games * `high_reviewed`: highest reviewed -* GET `/api/minetest_versions/` diff --git a/app/flatpages/help/release_webhooks.md b/app/flatpages/help/release_webhooks.md index a9ddd8c..467064f 100644 --- a/app/flatpages/help/release_webhooks.md +++ b/app/flatpages/help/release_webhooks.md @@ -20,6 +20,11 @@ The process is as follows: 3. The git host posts a webhook notification to ContentDB, using the API token assigned to it. 4. ContentDB checks the API token and issues a new release. +

+ "New commit" or "push" based webhooks are currently broken as they don't check the branch name. + This means that releases will be created for pushes to non-default branches. +

+ ## Setting up ### GitHub @@ -49,9 +54,10 @@ The process is as follows: choose "Tag push events". 8. Add webhook. -## Configuring +## Configuring Release Creation See the [Package Configuration and Releases Guide](/help/package_config/) for documentation on configuring the release creation. -You can set the min/max Minetest version from the Git repository, and also -configure what files are included. + +From the Git repository, you can set the min/max Minetest versions, which files are included, +and update the package meta. diff --git a/app/models/packages.py b/app/models/packages.py index d89eb8d..565be43 100644 --- a/app/models/packages.py +++ b/app/models/packages.py @@ -502,9 +502,9 @@ class Package(db.Model): return url_for("packages.bulk_change_release", author=self.author.username, name=self.name) - def getUpdateConfigURL(self, action=None): + def getUpdateConfigURL(self, trigger=None, action=None): return url_for("packages.update_config", - author=self.author.username, name=self.name, action=action) + author=self.author.username, name=self.name, trigger=trigger, action=action) def getSetupReleasesURL(self): return url_for("packages.setup_releases", diff --git a/app/templates/packages/create_edit.html b/app/templates/packages/create_edit.html index 0973390..3cb8f03 100644 --- a/app/templates/packages/create_edit.html +++ b/app/templates/packages/create_edit.html @@ -29,6 +29,14 @@ {{ _("Have you read the Package Inclusion Policy and Guidance yet?") }} + {% if package %} +
+ {{ _("Read more") }} + + {{ _("You can include a .cdb.json file in your %(type)s to update these details automatically.", type=package.type.value.lower()) }} +
+ {% endif %} + {% if package and package.checkPerm(current_user, "REIMPORT_META") and package.releases.first() %}
diff --git a/app/templates/packages/release_wizard.html b/app/templates/packages/release_wizard.html index b2875ca..8afaa8a 100644 --- a/app/templates/packages/release_wizard.html +++ b/app/templates/packages/release_wizard.html @@ -5,6 +5,9 @@ {% endblock %} {% block content %} + + {{ _("Later") }} +

{{ self.title() }}

@@ -22,12 +25,35 @@ {{ _("This can be changed later.") }}

-

- Automatically - Manually, enable reminders - Manually, no reminders - Later -

+ + {% else %}

{{ _("Using Git would allow you to create releases automatically when you push code or tags.") }}