Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework app cast handling; add JSON compatibility; add AppCastItem.Channel; built-in channel-based app cast filter implementation #605

Merged
merged 68 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
a6f5cd4
ParseAppCast returns list of items now
Deadpikle Jul 28, 2024
5ec3e6b
Refactor app cast handling
Deadpikle Jul 28, 2024
8cd4129
Add JSON app cast capabilities
Deadpikle Jul 29, 2024
c81de1e
Adjust output properties for json
Deadpikle Jul 29, 2024
686b855
Don't write nulls to json
Deadpikle Jul 29, 2024
dcc9c91
Fix order of operations for signature manager
Deadpikle Jul 29, 2024
de6cd4c
Adjust app cast maker tests to test some json configs
Deadpikle Jul 29, 2024
b6cd14b
Add async methods to app cast generators
Deadpikle Jul 30, 2024
2b79ec4
Fix tests not building
Deadpikle Jul 30, 2024
a050aa4
Continue refactor of app cast handling; WIP
Deadpikle Jul 30, 2024
5f88311
Rename "Read..." methods to "Deserialize..."
Deadpikle Jul 31, 2024
d13ec7f
Remove IAppCastHandler
Deadpikle Jul 31, 2024
ec22d15
Remove GetFilteredUpdates with no param
Deadpikle Jul 31, 2024
3ba84c4
Fix missing sort in JsonAppCastGenerator
Deadpikle Aug 1, 2024
5b06923
Remove empty line
Deadpikle Aug 1, 2024
7d04d33
Update docs
Deadpikle Aug 1, 2024
9e64d47
Rename AppCastHandler to AppCastHelper; refactor
Deadpikle Aug 1, 2024
488fbe1
Make sure ChannelAppCastFilter sorts
Deadpikle Aug 1, 2024
ae183b2
Add missing doc
Deadpikle Aug 1, 2024
84e9564
Make AppCastHelper.SetupAppCastHelper virtual
Deadpikle Aug 1, 2024
6f75eee
Forgot to finish some help text
Deadpikle Aug 2, 2024
348baea
Fix bug causing tests to run forever
Deadpikle Aug 2, 2024
60ccbc2
Add KeepItemsWithNoSuffix , docs to ChannelAppCastFilter
Deadpikle Aug 2, 2024
d83ffc5
Update UPGRADING.md
Deadpikle Aug 2, 2024
88c7a1d
Switch to NetSparkleUpdater.Chaos.NaCl 0.9.2
Deadpikle Aug 2, 2024
0667a82
Cache most recently downloaded app cast
Deadpikle Aug 2, 2024
97e3e1c
Resolve documentation needs
Deadpikle Aug 2, 2024
cc3b935
Fix app cast maker tests
Deadpikle Aug 2, 2024
b083136
Make UI compile again (NOTE: intentional bug added)
Deadpikle Aug 2, 2024
2b7de53
Fix typo
Deadpikle Aug 2, 2024
eb95431
Document .NET 8 AssemblyInformationalVersionAttribute change
Deadpikle Aug 4, 2024
878228f
Fix UI not showing right info due to app cast item changes
Deadpikle Aug 4, 2024
98f5450
Update UPGRADING.md
Deadpikle Aug 4, 2024
d330a81
Fix bad var name
Deadpikle Aug 4, 2024
b728c73
Allow multiple channel names in ChannelAppCastFilter
Deadpikle Aug 4, 2024
bb21c9c
Add some tests for ChannelAppCastFilter
Deadpikle Aug 4, 2024
d3f753d
Fix array syntax
Deadpikle Aug 4, 2024
53aa4d6
Fix nullability issue in xml app cast gen
Deadpikle Aug 4, 2024
be63cd8
Finish channel app cast filter tests
Deadpikle Aug 5, 2024
2c365b5
Allow outputting edSignature instead of signature to XML app cast
Deadpikle Aug 5, 2024
61fbf8e
Read in more tags for sparkle compat (#275)
Deadpikle Aug 5, 2024
b096766
Don't write version, shortVersion, or critical to XML enclosure
Deadpikle Aug 5, 2024
708d293
Update UPGRADING.md
Deadpikle Aug 5, 2024
a401244
Fix app gen issues with critical updates
Deadpikle Aug 5, 2024
2176565
Revert "Don't write version, shortVersion, or critical to XML enclosure"
Deadpikle Aug 5, 2024
ab09ac0
Update UPGRADING.md
Deadpikle Aug 5, 2024
2b67a56
Update UPGRADING.md
Deadpikle Aug 5, 2024
4f242af
Add channel property to app cast item
Deadpikle Aug 6, 2024
0df5f5a
Read/write app cast channel from/to xml
Deadpikle Aug 6, 2024
50b9333
Add channel output to app cast gen
Deadpikle Aug 6, 2024
a14d0be
Add app cast gen test for setting channel option
Deadpikle Aug 6, 2024
837ab1e
Finish adding json tests to app cast gen tests
Deadpikle Aug 7, 2024
fd6441b
Add test for signature enclosure change
Deadpikle Aug 7, 2024
0944856
Fix bugs where JSON gen output not sorted
Deadpikle Aug 8, 2024
c72d6f2
Add unit tests for sorting after deserialization
Deadpikle Aug 8, 2024
735da9f
Try to make tests happy
Deadpikle Aug 8, 2024
2c9bfce
Slight refactor just to make test code a little cleaner
Deadpikle Aug 8, 2024
3272d37
Fix async XML writing bug
Deadpikle Aug 9, 2024
b51bd71
Add unit tests for serializing app cast data
Deadpikle Aug 9, 2024
fa2c4d0
Add deserialize tests for app cast gen
Deadpikle Aug 9, 2024
69f8b0a
Remove unneeded console write in test
Deadpikle Aug 9, 2024
ca08772
Set dates on json deserialize test
Deadpikle Aug 9, 2024
297533a
Add json converter to always write timezone to UTC, read to local time
Deadpikle Aug 9, 2024
176e5aa
Try setting timezone to local
Deadpikle Aug 9, 2024
d3af02f
In unit tests, read/write as UTC
Deadpikle Aug 9, 2024
2b7fb2f
Update AppCastGeneratorTests.cs
Deadpikle Aug 9, 2024
3be83b3
Write serialized app cast to str for debugging
Deadpikle Aug 9, 2024
f111aeb
Fix write file async not working
Deadpikle Aug 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ In your project file, make sure you set up a few things so that the library can
</PropertyGroup>
```

IMPORTANT NOTE: In .NET 8+, a change was made that causes your git/source code commit hash to be included in your app's `<Version>` number. This behavior cannot be avoided by NetSparkleUpdater at this time as we rely on `AssemblyInformationalVersionAttribute`, and this attribute's behavior was changed. Your users may be told that they are currently running `1.0.0+commitHashHere` by NetSparkleUpdater (and your native app itself!). We recommend adding the following lines to your project file (in a new `<PropertyGroup>` or an existing one):

```xml
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
```

### Code

```csharp
Expand Down Expand Up @@ -426,7 +432,7 @@ Having just the latest version of your software in the app cast has the added si
3. If you don't want to generate signatures because you trust your AppCenter builds, use `SecurityMode.Unsafe` or the following `IAppCastHandler` override:

```csharp
public bool DownloadAndParse()
public override bool DownloadAndParse()
{
try
{
Expand All @@ -435,7 +441,8 @@ public bool DownloadAndParse()
var appCast = _dataDownloader.DownloadAndGetAppCastData(_castUrl);
if (!string.IsNullOrWhiteSpace(appCast))
{
ParseAppCast(appCast);
Items.Clear();
Items.AddRange(ParseAppCast(appcast));
return true;
}
}
Expand Down Expand Up @@ -504,7 +511,7 @@ Contributions are ALWAYS welcome! If you see a new feature you'd like to add, pl

* Unit tests for all parts of the project
* Extensive testing on macOS/Linux
* More built-in app cast parsers (e.g. natively support using/creating JSON feeds) -- possible via interfaces but not built-in yet
* More built-in app cast parsers
* More options in the app cast generator
* See the [issues list](https://github.com/NetSparkleUpdater/NetSparkle/issues) for more

Expand Down
27 changes: 26 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,25 @@
* By default, timestamps are now output along with the `Tag` and actual log item
* `RegistryConfiguration` has changed its default final path to `NetSparkleUpdater` instead of `AutoUpdate`. Please migrate saved configuration data yourself if you need to do so for your users (probably not necessary).
* `ShowUpdateNeededUI` no longer shows an update window if the number of update items is 0. (Arguably a bug fix, but technically a breaking change.)

* Major refactoring for app cast handling/parsing to clean up logic / make new formats easier
* New `AppCast` model class that holds info on the actual app cast and its items
* `AppCastItem` no longer contains information on serializing or parsing to/from XML
* App cast parsing/serializing is now handled by an `IAppCastGenerator` implementation
* `XMLAppCast` renamed to `AppCastHelper`
* `SparkleUpdater` now has an `AppCastGenerator` member that handles deserializing the app cast rather than `AppCastHelper`
* `AppCastItem` serialization now expects the full download link to already be known (serialization will not consider the overall app cast URL)
* `IAppCastHandler` is no longer available/used.
* App cast downloading and item filtering is now handled by `AppCastHelper`.
* If you want to manage downloads, implement `IAppCastDataDownloader` and set `SparkleUpdater.AppCastDataDownloader`
* If you want to manage deserializing/serializing the app cast, implement `IAppCastGenerator` and set `SparkleUpdater.AppCastGenerator`
* If you want to manage filtering on your own, implement `IAppCastFilter` and set `SparkleUpdater.AppCastHelper.AppCastFilter`
* `AppCastHelper` also has two new properties: `FilterOutItemsWithNoVersion` and `FilterOutItemsWithNoDownloadLink`, which both default to `true`.
* If you need absolute control more than the above, you can subclass `AppCastHelper` and override methods: `SetupAppCastHelper`, `DownloadAppCast`, and `FilterUpdates`. This probably is not necessary, however, and you can do what you want through the interfaces, most likely.
* `AppCastHelper.SetupAppCastHelper` signature is now `SetupAppCastHelper(IAppCastDataDownloader dataDownloader, string castUrl, string? installedVersion, ISignatureVerifier? signatureVerifier, ILogger? logWriter = null)` (note: no longer takes a `Configuration` object)
* Renamed `AppCastItem.OperatingSystemString` to `OperatingSystem`
* XML app casts write `version`, `shortVersion`, and `criticalUpdate` to the `<item>` tag and the `<enclosure>` (both for backwards/Sparkle compat; we'd rather not write to `<enclosure>` but we don't want to break anyone that updates their app cast gen without updating the main library).
* If both the overall `<item>` and the `<enclosure>` have this data, the info from the `<item>` is prioritized.
* JSON app casts are not affected.

**Changes/Fixes**

Expand Down Expand Up @@ -64,6 +82,13 @@
* Added `nullability` compatibility to core and UI libraries (#595)
* Base language version is now 8.0 (9.0 for Avalonia), but this is only used for nullability compatibility (compile-time), so this shouldn't affect older projects (`.NET 4.6.2`, `netstandard2.0`) and is thus a non-breaking change
* Fixed initialization issue in DownloadProgressWindow (WinForms) icon use
* Added `JsonAppCastGenerator` to read/write app casts from/to JSON (use with app cast generator option `--output-type`)
* Added `ChannelAppCastFilter` (implements `IAppCastFilter`) for easy way to filter your app cast items by a channel, e.g. `beta` or `alpha`. Use by setting `AppCastHelper.AppCastFilter`. Uses simple `string.Contains` invariant lowercase string check to search for channels in the `AppCastItem`'s version information.
* If you want to allow versions like `2.0.0-beta.1`, set `ChannelSearchNames` to `new List<string>() {"beta"}`
* Set `RemoveOlderItems` to `false` if you want to keep old versions when filtering, e.g. for rolling back to an old version
* Set `KeepItemsWithNoSuffix` to `false` if you want to remove all items that don't match the given channel (doing this will not let people on a beta version update to a non-beta version!)
* `AppCast? SparkleUpdater.AppCastCache` holds the most recently deserialized app cast information.
* `AppCastItem` has a new `Channel` property. Use it along with `ChannelAppCastFilter` if you want to use channels that way instead of via your `<Version>` property. In the app cast generator, use the `--channel` option to set this.

## Updating from 0.X or 1.X to 2.X

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<ApplicationIcon>software-update-available.ico</ApplicationIcon>
<RootNamespace>NetSparkleUpdater.Samples.Avalonia</RootNamespace>
<AssemblyName>NetSparkleUpdater.Samples.Avalonia</AssemblyName>
<Version>1.0.0-beta1</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\*" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<ApplicationIcon>software-update-available.ico</ApplicationIcon>
<RootNamespace>NetSparkleUpdater.Samples.Avalonia</RootNamespace>
<AssemblyName>NetSparkleUpdater.Samples.Avalonia</AssemblyName>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\*" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
<ApplicationIcon>software-update-available.ico</ApplicationIcon>
<RootNamespace>NetSparkleUpdater.Samples.Avalonia</RootNamespace>
<AssemblyName>NetSparkleUpdater.Samples.Avalonia</AssemblyName>
<PublishTrimmed>true</PublishTrimmed>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
<PublishTrimmed>true</PublishTrimmed>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\*" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFrameworks>net7.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
<ApplicationIcon>software-update-available.ico</ApplicationIcon>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFrameworks>net7.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>software-update-available.ico</ApplicationIcon>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading