Update docs, rename desc to long_description

This commit is contained in:
rubenwardy 2021-02-03 00:11:48 +00:00
parent 8225e4098b
commit 05c140da78
5 changed files with 24 additions and 13 deletions

View File

@ -49,7 +49,7 @@ Tokens can be attained by visiting [Settings > API Tokens](/user/tokens/).
* `content_Warnings`: List of content warning names, see [misc](#misc). * `content_Warnings`: List of content warning names, see [misc](#misc).
* `license`: A license name. * `license`: A license name.
* `media_license`: A license name. * `media_license`: A license name.
* `desc`: Long markdown description. * `long_description`: Long markdown description.
* `repo`: Git repo URL. * `repo`: Git repo URL.
* `website`: Website URL. * `website`: Website URL.
* `issue_tracker`: Issue tracker URL. * `issue_tracker`: Issue tracker URL.
@ -63,7 +63,7 @@ Examples:
# Edit packages # Edit packages
curl -X PUT http://localhost:5123/api/packages/username/name/ \ curl -X PUT http://localhost:5123/api/packages/username/name/ \
-H "Authorization: Bearer YOURTOKEN" -H "Content-Type: application/json" \ -H "Authorization: Bearer YOURTOKEN" -H "Content-Type: application/json" \
-d '{ "title": "Foo bar", "tags": ["pvp", "survival"], "license": "WTFPL" }' -d '{ "title": "Foo bar", "tags": ["pvp", "survival"], "license": "MIT" }'
# Remove website URL # Remove website URL
curl -X PUT http://localhost:5123/api/packages/username/name/ \ curl -X PUT http://localhost:5123/api/packages/username/name/ \

View File

@ -44,17 +44,17 @@ and for mods only:
You can include a `.cdb.json` file in the root of your content directory (ie: next to a .conf) You can include a `.cdb.json` file in the root of your content directory (ie: next to a .conf)
to update the package meta. to update the package meta.
It should be a JSON dictionary with one or more of the following optional keys. It should be a JSON dictionary with one or more of the following optional keys:
* `type`: One of `GAME`, `MOD`, `TXP`. * `type`: One of `GAME`, `MOD`, `TXP`.
* `title`: Human-readable title. * `title`: Human-readable title.
* `name`: Technical name (needs permission if already approved). * `name`: Technical name (needs permission if already approved).
* `short_description` * `short_description`
* `tags`: List of tag names, see [/api/tags/](/api/tags/). * `tags`: List of tag names, see [/api/tags/](/api/tags/).
* `content_Warnings`: List of content warning names, see [/api/content_warnings/](/api/content_warnings/). * `content_warnings`: List of content warning names, see [/api/content_warnings/](/api/content_warnings/).
* `license`: A license name, see [/api/licenses/](/api/licenses/). * `license`: A license name, see [/api/licenses/](/api/licenses/).
* `media_license`: A license name. * `media_license`: A license name.
* `desc`: Long markdown description. * `description`: Long markdown description.
* `repo`: Git repo URL. * `repo`: Git repo URL.
* `website`: Website URL. * `website`: Website URL.
* `issue_tracker`: Issue tracker URL. * `issue_tracker`: Issue tracker URL.
@ -68,7 +68,8 @@ Example:
{ {
"title": "Foo bar", "title": "Foo bar",
"tags": ["pvp", "survival"], "tags": ["pvp", "survival"],
"license": "WTFPL" "license": "MIT",
"website": null
} }
``` ```
@ -83,8 +84,9 @@ choose Git as the method when creating a release.
### Automatic Release Creation ### Automatic Release Creation
The preferred way is to use [webhooks from GitLab or GitHub](/help/release_webhooks/). See [Git Update Detection](/help/update_config/).
You can also use the [API](/help/api/) to create releases. You can also use [GitLab/GitHub webhooks](/help/release_webhooks/) or the [API](/help/api/)
to create releases.
### Min and Max Minetest Versions ### Min and Max Minetest Versions

View File

@ -34,9 +34,10 @@ There are some situations where the settings are correct, but you want to mark a
up-to-date - for example, if you don't want to make a release for a particular tag. up-to-date - for example, if you don't want to make a release for a particular tag.
Clicking "Save" on "Update Settings" will mark a package as up-to-date. Clicking "Save" on "Update Settings" will mark a package as up-to-date.
## Configuring ## Configuring Release Creation
See the [Package Configuration and Releases Guide](/help/package_config/) for See the [Package Configuration and Releases Guide](/help/package_config/) for
documentation on configuring the release creation. 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.

View File

@ -51,6 +51,7 @@ ALLOWED_FIELDS = {
"content_warnings": list, "content_warnings": list,
"license": any, "license": any,
"media_license": any, "media_license": any,
"long_description": str,
"desc": str, "desc": str,
"repo": str, "repo": str,
"website": str, "website": str,
@ -59,6 +60,13 @@ ALLOWED_FIELDS = {
"forums": int, "forums": int,
} }
ALIASES = {
"short_description": "short_desc",
"issue_tracker": "issueTracker",
"long_description": "desc"
}
def is_int(val): def is_int(val):
try: try:
int(val) int(val)
@ -98,7 +106,7 @@ def do_edit_package(user: User, package: Package, was_new: bool, data: dict, rea
not package.checkPerm(user, Permission.CHANGE_NAME): not package.checkPerm(user, Permission.CHANGE_NAME):
raise LogicError(403, "You do not have permission to change the package name") raise LogicError(403, "You do not have permission to change the package name")
for alias, to in { "short_description": "short_desc", "issue_tracker": "issueTracker" }.items(): for alias, to in ALIASES.items():
if alias in data: if alias in data:
data[to] = data[alias] data[to] = data[alias]

View File

@ -407,7 +407,7 @@ class Package(db.Model):
"name": self.name, "name": self.name,
"title": self.title, "title": self.title,
"short_description": self.short_desc, "short_description": self.short_desc,
"desc": self.desc, "long_description": self.desc,
"type": self.type.toName(), "type": self.type.toName(),
"created_at": self.created_at.isoformat(), "created_at": self.created_at.isoformat(),