Skip to content

Commit

Permalink
Store remote version file URL in metadata resources
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Jan 6, 2021
1 parent 7d5b62c commit 53fb9ed
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CKAN.schema
Expand Up @@ -220,6 +220,11 @@
"type" : "string",
"format" : "uri"
},
"remote-avc" : {
"description" : "Mod's remote hosted version file",
"type" : "string",
"format" : "uri"
},
"store": {
"description" : "Purchase DLC here",
"type" : "string",
Expand Down
8 changes: 6 additions & 2 deletions Core/Types/ResourcesDescriptor.cs
Expand Up @@ -41,11 +41,15 @@ public class ResourcesDescriptor
[JsonConverter(typeof(JsonOldResourceUrlConverter))]
public Uri metanetkan;

[JsonProperty("store", Order = 10, NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty("remote-avc", Order = 10, NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(JsonOldResourceUrlConverter))]
public Uri remoteAvc;

[JsonProperty("store", Order = 11, NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(JsonOldResourceUrlConverter))]
public Uri store;

[JsonProperty("steamstore", Order = 11, NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty("steamstore", Order = 12, NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(JsonOldResourceUrlConverter))]
public Uri steamstore;
}
Expand Down
1 change: 1 addition & 0 deletions GUI/Controls/ModInfo.cs
Expand Up @@ -157,6 +157,7 @@ private void UpdateModInfo(GUIMod gui_module)
AddResourceLink(Properties.Resources.ModInfoLicenseLabel, res.license);
AddResourceLink(Properties.Resources.ModInfoManualLabel, res.manual);
AddResourceLink(Properties.Resources.ModInfoMetanetkanLabel, res.metanetkan);
AddResourceLink(Properties.Resources.ModInfoRemoteAvcLabel, res.remoteAvc);
AddResourceLink(Properties.Resources.ModInfoStoreLabel, res.store);
AddResourceLink(Properties.Resources.ModInfoSteamStoreLabel, res.steamstore);
}
Expand Down
3 changes: 3 additions & 0 deletions GUI/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions GUI/Properties/Resources.resx
Expand Up @@ -285,6 +285,7 @@ If you suspect a bug in the client: https://github.com/KSP-CKAN/CKAN/issues/new/
<data name="ModInfoLicenseLabel" xml:space="preserve"><value>Licence:</value></data>
<data name="ModInfoManualLabel" xml:space="preserve"><value>Manual:</value></data>
<data name="ModInfoMetanetkanLabel" xml:space="preserve"><value>Metanetkan:</value></data>
<data name="ModInfoRemoteAvcLabel" xml:space="preserve"><value>Remote version file:</value></data>
<data name="ModInfoStoreLabel" xml:space="preserve"><value>Store:</value></data>
<data name="ModInfoSteamStoreLabel" xml:space="preserve"><value>Steam store:</value></data>
<data name="MainModListWaitTitle" xml:space="preserve"><value>Loading modules</value></data>
Expand Down
5 changes: 5 additions & 0 deletions Netkan/Transformers/AvcTransformer.cs
Expand Up @@ -73,6 +73,11 @@ public IEnumerable<Metadata> Transform(Metadata metadata, TransformOptions opts)

if (remoteUri != null)
{
if (json["resources"] == null)
json["resources"] = new JObject();
var resourcesJson = (JObject)json["resources"];
resourcesJson.SafeAdd("remote-avc", remoteUri.OriginalString);

try
{
var remoteJson = _github?.DownloadText(remoteUri)
Expand Down
1 change: 1 addition & 0 deletions Spec.md
Expand Up @@ -603,6 +603,7 @@ are described. Unless specified otherwise, these are URLs:
- `curse` : (**v1.20**) The mod on Curse.
- `manual` : The mod's manual, if it exists.
- `metanetkan` : (**v1.27**) URL of the module's remote hosted netkan
- `remote-avc` : URL of remote version file
- `store`: (**v1.28**) URL where you can purchase a DLC
- `steamstore`: (**v1.28**) URL where you can purchase a DLC on Steam

Expand Down

0 comments on commit 53fb9ed

Please sign in to comment.