Difference between revisions of "CampaignServerWML"

From The Battle for Wesnoth Wiki
(Changing the Passphrase for a Campaign: Update stuff)
Line 1: Line 1:
 
This page describes the WML commands exchanged between the add-ons server (<b>campaignd</b>) and clients.
 
This page describes the WML commands exchanged between the add-ons server (<b>campaignd</b>) and clients.
 +
 +
For historical reason, both the server software's name and the WML tags which are part of its communication protocol make exclusive reference to "campaigns" instead of "add-ons". However, in practice there is no real difference between any kind of add-ons as far as the server is concerned.
  
 
== Common responses ==
 
== Common responses ==

Revision as of 22:58, 23 June 2018

This page describes the WML commands exchanged between the add-ons server (campaignd) and clients.

For historical reason, both the server software's name and the WML tags which are part of its communication protocol make exclusive reference to "campaigns" instead of "add-ons". However, in practice there is no real difference between any kind of add-ons as far as the server is concerned.

Common responses

These are WML messages sent by the server in response to any of the commands listed below.

[message]: Informational messages

This response is typically sent to confirm that an operation succeeded.

  • [message]
    • message: String containing a message for the client to display to the user.

[error]: Error messages

This response is sent when an operation has failed for any reason, whether it be a user error or an issue with the server. It is also sent upon receiving an unrecognized request.

  • [error]
    • message: String containing an error message for the client to display to the user.
    • extra_data: String containing additional information for the client to display. This is often a log of some kind (such a list of illegal filenames found during an upload request), so a client should be prepared for this to be an overlong string that might not completely fit in the screen.

[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 that pt will not match pt_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" and before=-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 named LC_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 named LC_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). Since en_US is the base language, this language will not be listed as an available translation.

[request_campaign]: Downloading an add-on

This command is used to download the specified add-on from the server.

Request

  • [request_campaign]
    • name: The name of the add-on. Note this is not the user-visible title and should not have spaces in it.

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).

[upload]: Uploading an add-on

This command is used to upload a new add-on or an updated version of an existing one to the 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).

Response

See Common responses.

[change_passphrase]: Changing the passphrase for an add-on

This command is used to change the passphrase for an add-on. Currently the game does not have a user interface to make use of this function. However, the Python-based wesnoth_addon_manager client included under data/tools has a --change-passphrase switch that accomplishes the same purpose.

Request

  • [change_passphrase]
    • name: The name of the add-on.
    • passphrase: The old passphrase.
    • new_passphrase: The new passphrase.

Response

See Common responses. The [message] response confirms a successful passphrase change.

[delete]: Deleting an add-on

This command is used to delete an existing add-on from the server.

Request

  • [delete]
    • name: The name of the add-on to delete.
    • passphrase: The passphrase for the add-on. It must match the passphrase on record in order for the operation to succeed.

Response

See Common responses. The [message] response confirms the successful deletion of the add-on.

[request_terms]: Requesting upload terms

Retrieve the upload terms that users must accept before uploading add-ons to the server. Wesnoth requires add-ons be licensed under the GNU GPL v2 or later, with assets allowed to be licensed under the same license or a Creative Commons license. See Wesnoth:Copyrights for more information.

Request

  • [request_terms]

Response

See Common responses. The [message] response contains the upload terms. This action never fails.

See Also