Difference between revisions of "CampaignServerWML"
(Update [request_campaign_list] documentation) |
m (→Request) |
||
Line 12: | Line 12: | ||
** '''name''': If specified and not empty, return information only for a single add-on matching this name. | ** '''name''': If specified and not empty, return information only for a single add-on matching this name. | ||
** '''language''': Return information only about add-ons that appear to be translated into this language. These names will normally be POSIX locale names. Typically you will want to either use a two letter language code (e.g. <code>de</code>) or a two letter language code followed by a two character region code (e.g. <code>pt_BR</code>). Note that <code>pt</code> will not match <code>pt_BR</code>. | ** '''language''': Return information only about add-ons that appear to be translated into this language. These names will normally be POSIX locale names. Typically you will want to either use a two letter language code (e.g. <code>de</code>) or a two letter language code followed by a two character region code (e.g. <code>pt_BR</code>). Note that <code>pt</code> will not match <code>pt_BR</code>. | ||
− | ** '''times_relative_to''': | + | ** '''times_relative_to''': <code>now</code> means that '''before''' and '''after''' below are understood to be measured in seconds relative to the time when the request is processed by campaignd. If unset or set to any other value, '''before''' and '''after''' are assumed to be in seconds relative to the [https://en.wikipedia.org/wiki/Unix_epoch Unix epoch]. |
− | ** '''after''': Only select add-ons last updated after the indicated time. For example, to select add-ons last updated after Mon Oct 10 21:42:41 2005 UTC, you could leave ''times_relative_to'' unset and specify <syntaxhighlight lang="wml" inline>after=1128980561</syntaxhighlight>. | + | ** '''after''': Only select add-ons last updated after the indicated time. For example, to select add-ons last updated after Mon Oct 10 21:42:41 2005 UTC, you could leave '''times_relative_to''' unset and specify <syntaxhighlight lang="wml" inline>after=1128980561</syntaxhighlight>. |
** '''before''': Only select add-ons last updated before the indicated time. For example, to select add-ons last updated over a day ago, you could specify <syntaxhighlight lang="wml" inline>times_relative_to="now"</syntaxhighlight> and <syntaxhighlight lang="wml" inline>before=-86400</syntaxhighlight>. | ** '''before''': Only select add-ons last updated before the indicated time. For example, to select add-ons last updated over a day ago, you could specify <syntaxhighlight lang="wml" inline>times_relative_to="now"</syntaxhighlight> and <syntaxhighlight lang="wml" inline>before=-86400</syntaxhighlight>. | ||
Revision as of 22:25, 23 June 2018
This page describes the WML commands exchanged between the add-ons server (campaignd) and clients.
Contents
[request_campaign_list]: Listing server contents
This request is used to retrieve a list of add-ons available on the server and some overview information about them.
There are a few attributes both in the request and response WML that use timestamps. These are expected to be in secodns relative
Request
- [request_campaign_list]
- name: If specified and not empty, return information only for a single add-on matching this name.
- language: Return information only about add-ons that appear to be translated into this language. These names will normally be POSIX locale names. Typically you will want to either use a two letter language code (e.g.
de
) or a two letter language code followed by a two character region code (e.g.pt_BR
). Note thatpt
will not matchpt_BR
. - times_relative_to:
now
means that before and after below are understood to be measured in seconds relative to the time when the request is processed by campaignd. If unset or set to any other value, before and after are assumed to be in seconds relative to the Unix epoch. - after: Only select add-ons last updated after the indicated time. For example, to select add-ons last updated after Mon Oct 10 21:42:41 2005 UTC, you could leave times_relative_to unset and specify
after=1128980561
. - before: Only select add-ons last updated before the indicated time. For example, to select add-ons last updated over a day ago, you could specify
times_relative_to="now"
andbefore=-86400
.
Response
- timestamp: The time in seconds relative to the Unix epoch that the add-ons server reported when generating the response. You shouldn't count on this as a guarantee that no new add-ons will appear with previous update times. This could be used to detect significant clock skew or possibly used as an approximate time for how far you need to look back for updated campaigns.
- [campaigns]
- [campaign]: The add-on metadata. The attributes within are primarily the same as those found in PblWML.
- author: Authors or maintainers of the add-on.
- dependencies: Comma-separated list of add-on names this add-on depends on.
- description: Description of the add-on.
- downloads: The number times the add-on (including previous versions) has been downloaded directly from the add-ons server. This does not include updates, which are handled by the official clients using the increase_downloads option to avoid bumping the downloads count; nor does it include downloads from the add-ons server web, which is handled by the web server independently.
- feedback_url: URL to the add-on's feedback URL specified by the author in the pbl [feedback] tag and formatted according to the server's own rules. For the current add-ons server, this is a forum thread URL in the format
https://r.wesnoth.org/t<TOPIC_ID>
. - filename: The name of the file used to store the add-on archive on the server (currently the same as name).
- icon: Path to an image in the standard image directory for Wesnoth. This path must use forward slashes
/
. It cannot refer to custom images provided by the add-on. It is allowed to use ImagePathFunctionWML. This image is displayed as an icon by the add-ons client built into Wesnoth, as well as the add-ons web (although the latter is unable to process image path functions). - name: The name of the add-on. Note this is not the title and shouldn't have spaces in it. This corresponds to the add-on directory name on the client side.
- original_timestamp: When the first version of the add-on was uploaded. If the add-on was previously deleted from the server, this will be the time of the first reupload after the last deletion.
- size: The on-disk size of the add-on pack in bytes on the server. If the add-on pack is stored in a compressed format, this will be the compressed size, not the uncompressed size. Because the network format currently used to send the file uses the same compression and nearly identical structure, this also happens to be almost exactly the same size transferred over the network when downloading the add-on.
- tags: Comma-separated list of free-form tags used when filtering add-ons in the add-ons client UI.
- timestamp: When the current version of the add-on was uploaded.
- title: The add-on's user-visible title. This is not a translatable string.
- translate: Whether the add-on will be automatically sent to WesCamp. (Currently unused due to the discontinuation of the WesCamp project.)
- type: indicates the type of the add-on, used for the downloads manager dialog. Possible values are described in PblWML.
- uploads: Number of uploads, including the initial upload.
- version: Add-on version.
- [translation]
- language: The name of a locale that this add-on appears to have been at least partially translated into. The following heuristic is used when an add-on is uploaded to extract a list of languages:
The list of directories in the uploaded campaign is recursively searched. If a directory namedLC_MESSAGES
is found then the name of the object containing this [dir] (normally the parent directory, but could be the add-on name if someone did something silly) is added to the list of translations. Directories namedLC_MESSAGES
are not searched for further matches.
The normal naming convention is to use POSIX locale names. This will usually be a two letter language code (e.g.de
) or a two letter language code followed by a two letter region code (e.g.pt_BR
). Sinceen_US
is the base language, this language will not be listed as an available translation.
- language: The name of a locale that this add-on appears to have been at least partially translated into. The following heuristic is used when an add-on is uploaded to extract a list of languages:
- [campaign]: The add-on metadata. The attributes within are primarily the same as those found in PblWML.
Downloading a Campaign
This command is used to download a specified campaign from the campaign server.
- Request
- [request_campaign]
- name: the name of the campaign. Note this is not the title and shouldn't have spaces in it.
- [request_campaign]
- Response
- author: author(s) of the campaign.
- campaign_name: the name of the campaign. Note this is not the title and shouldn't have spaces in it.
- description: description of the campaign. For pre 1.0 campaigns this should also describe the playability.
- icon: path to an image in the standard image directory for Wesnoth. This path must use forward slashes (/). It cannot refer to custom images included with the campaign. It is allowed to use ImagePathFunctionWML. This image is displayed as an icon by the campaign client built into Wesnoth.
- name: this field will always be empty. Client code would treat it as a directory name if it was not empty.
- timestamp: the time the campaign was last uploaded to the campaign server. This is a decimal string containing the number of seconds since the unix epoch.
- title: the title of the campaign. This is not a translatable string.
- version: version of the campaign. The recommended format is x.y.z where x, y and z are decimal strings. x should be 0 for campaigns that are not yet complete.
- type: indicates the type of the add-on, used for the downloads manager dialog. Possible values are described in PblWML.
- [file]
- name: the name of the file. This does not include any path information.
- contents: the content of the file (binary data). This data should have no zero bytes. A byte with the code of 1 is an escape byte. The next byte will be data, but its value should be reduced by 1. Normally only byte codes of 0 and 1 are escaped.
- [dir]
- name: the name of the directory. This does not include any path information.
- This tag may contain [file] or [dir] subtags (the latter are recursive).
Uploading a Campaign
This command is used to upload a new or updated version of an add on campaign to the campaign server.
- Request
- [upload]
- author: author(s) of the campaign.
- description: description of the campaign. For pre 1.0 campaigns this should also describe the playability.
- icon: path to an image in the standard image directory for Wesnoth. This path must use forward slashes (/). It cannot refer to custom images included with the campaign. It is allowed to use ImagePathFunctionWML. This image is displayed as an icon by the campaign client built into Wesnoth.
- name: the name of the campaign. Note this is not the title and shouldn't have spaces in it.
- passphrase: this is used to control updates to campaigns on the server. For existing campaigns, if the passphrase doesn't match, the update will be rejected. You can't easily change the passphrase yourself. If you lose or need to change the passphrase you need to contact the server administrator.
- email: it is used by campaign server administrators to contact authors in case of important problems with their add-ons (incompatibilities, broken data files, violation of server policies, etc.).
- title: the title of the campaign. This is not a translatable string.
- version: version of the campaign. The recommended format is x.y.z where x, y and z are decimal strings. x should be 0 for campaigns that are not yet complete.
- type: indicates the type of the add-on, used for the downloads manager dialog. Possible values are described in PblWML.
- [data]
- [file]
- name: the name of the file. This does not include any path information.
- contents: the content of the file (binary data). This data should have no zero bytes. A byte with the code of 1 is an escape byte. The next byte will be data, but its value should be reduced by 1. Normally only byte codes of 0 and 1 are escaped.
- [dir]
- name: the name of the directory. This does not include any path information.
- This tag may contain [file] or [dir] subtags (the latter are recursive).
- [file]
- [upload]
- Response
- [message]
- message: translatable string that indicates that the campaign upload was successful.
- [message]
Changing the Passphrase for a Campaign
This command is used to change the passphrase for a campaign. Currently the normal client doesn't have a way to use this. However, you can use the perl script campaign_passphrase.pl to do it, if you have a copy of the source tree.
- Request
- [change_passphrase]
- name: The name of campaign.
- passphrase: The old passphrase.
- new_passphrase: The new passphrase.
- [change_passphrase]
- Respose
- [message]
- message: Translatable string that says that the passphrase was changed.
- [message]
Deleting a Campaign
This command is used to delete an existing campaign from the campaign server.
- Request
- [delete]
- name: The name of the campaign to delete.
- passphrase: This must match the passphrase on record for the campaign or the master_password in order for the campaign to be deleted. Master_password.
- [delete]
- Response
- [message]
- message: Translatable string that says that the campaign was deleted.
- [message]
Request License Information
Retrieve the terms of the license used for any uploaded campaigns. You may not upload a campaign if you don't (or can't) aggree to the license. Wesnoth requires campaigns (including images and sound) to be licensed under the GPL. For more information on licensing, see Wesnoth:Copyrights.
- Request
- [request_terms]
- Response
- [message]
- message: translatable string containing the text of the license.
- [message]
Developer commands
- Request
- [validate_scripts]
- name: The name of the campaign to sign.
- master_password: The signing password.
- [validate_scripts]
- Response
- [message]
- message: Translatable(?) string that says that the campaign was signed.
- [message]