Skip to content

Commit

Permalink
Merge #4272 Restore default version support for SpaceDock
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Dec 6, 2024
2 parents c70b5cd + 3b29b0d commit 92fe172
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ All notable changes to this project will be documented in this file.
- [Netkan] Tests for Newtonsoft.Json's handling of octal literals in version files (#4227 by: HebaruSan)
- [Netkan] Create netkan schema (#4254, #4258 by: HebaruSan, Danny2462; reviewed: HebaruSan)
- [Netkan] Handle raw GitHub URLs containing refs/heads/ (#4263 by: HebaruSan)
- [Netkan] Restore default version support for SpaceDock (#4272 by: HebaruSan)

## v1.35.2 (Penrose)

Expand Down
19 changes: 5 additions & 14 deletions Netkan/Sources/Spacedock/SpacedockMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,13 @@ internal class SpacedockMod
[JsonProperty] public Uri? background;

public SDVersion Latest()
{
// The version we want is specified by `default_version_id`, it's not just
// the latest. See GH #214. Thanks to @Starstrider42 for spotting this.

var latest =
from release in versions
where release.id == default_version_id
select release
;

// There should only ever be one.
return latest.First();
}
=> All().First();

public IEnumerable<SDVersion> All()
=> versions ?? Enumerable.Empty<SDVersion>();
// The version we want is specified by `default_version_id`, it's not just
// the latest. See GH #214. Thanks to @Starstrider42 for spotting this.
=> versions?.OrderByDescending(v => v.id == default_version_id)
?? Enumerable.Empty<SDVersion>();

/// <summary>
/// Returns the path to the mod's home on SpaceDock
Expand Down

0 comments on commit 92fe172

Please sign in to comment.