Compare commits
4 Commits
df78aafebe
...
6a42dbe53e
Author | SHA1 | Date | |
---|---|---|---|
6a42dbe53e | |||
44890f51ee | |||
7f2849e5fd | |||
![]() |
21d0e37bda |
9
OF DL/Entities/LatestReleaseAPIResponse.cs
Normal file
9
OF DL/Entities/LatestReleaseAPIResponse.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace OF_DL.Entities;
|
||||||
|
|
||||||
|
public class LatestReleaseAPIResponse
|
||||||
|
{
|
||||||
|
[JsonProperty(PropertyName = "tag_name")]
|
||||||
|
public string TagName { get; set; } = "";
|
||||||
|
}
|
52
OF DL/Helpers/VersionHelper.cs
Normal file
52
OF DL/Helpers/VersionHelper.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using OF_DL.Entities;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace OF_DL.Helpers;
|
||||||
|
|
||||||
|
public static class VersionHelper
|
||||||
|
{
|
||||||
|
public static string? GetLatestReleaseTag()
|
||||||
|
{
|
||||||
|
Log.Debug("Calling GetLatestReleaseTag");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HttpClient client = new();
|
||||||
|
HttpRequestMessage request = new(HttpMethod.Get, "https://git.ofdl.tools/api/v1/repos/sim0n00ps/OF-DL/releases/latest");
|
||||||
|
using var response = client.Send(request);
|
||||||
|
|
||||||
|
if (!response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
Log.Debug("GetLatestReleaseTag did not return a Success Status Code");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var body = response.Content.ReadAsStringAsync().Result;
|
||||||
|
|
||||||
|
Log.Debug("GetLatestReleaseTag API Response: ");
|
||||||
|
Log.Debug(body);
|
||||||
|
|
||||||
|
var versionCheckResponse = JsonConvert.DeserializeObject<LatestReleaseAPIResponse>(body);
|
||||||
|
|
||||||
|
if (versionCheckResponse == null || versionCheckResponse.TagName == "")
|
||||||
|
{
|
||||||
|
Log.Debug("GetLatestReleaseTag did not return a valid tag name");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return versionCheckResponse.TagName;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Exception caught: {0}\n\nStackTrace: {1}", ex.Message, ex.StackTrace);
|
||||||
|
Log.Error("Exception caught: {0}\n\nStackTrace: {1}", ex.Message, ex.StackTrace);
|
||||||
|
if (ex.InnerException != null)
|
||||||
|
{
|
||||||
|
Console.WriteLine("\nInner Exception:");
|
||||||
|
Console.WriteLine("Exception caught: {0}\n\nStackTrace: {1}", ex.InnerException.Message, ex.InnerException.StackTrace);
|
||||||
|
Log.Error("Inner Exception: {0}\n\nStackTrace: {1}", ex.InnerException.Message, ex.InnerException.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -19,7 +19,6 @@
|
|||||||
<PackageReference Include="HtmlAgilityPack" Version="1.12.0" />
|
<PackageReference Include="HtmlAgilityPack" Version="1.12.0" />
|
||||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.3" />
|
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.3" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="Octokit" Version="14.0.0" />
|
|
||||||
<PackageReference Include="protobuf-net" Version="3.2.46" />
|
<PackageReference Include="protobuf-net" Version="3.2.46" />
|
||||||
<PackageReference Include="PuppeteerSharp" Version="20.1.3" />
|
<PackageReference Include="PuppeteerSharp" Version="20.1.3" />
|
||||||
<PackageReference Include="Serilog" Version="4.2.0" />
|
<PackageReference Include="Serilog" Version="4.2.0" />
|
||||||
|
@ -9,7 +9,6 @@ using OF_DL.Entities.Streams;
|
|||||||
using OF_DL.Enumerations;
|
using OF_DL.Enumerations;
|
||||||
using OF_DL.Enumurations;
|
using OF_DL.Enumurations;
|
||||||
using OF_DL.Helpers;
|
using OF_DL.Helpers;
|
||||||
using Octokit;
|
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using Serilog.Core;
|
using Serilog.Core;
|
||||||
using Serilog.Events;
|
using Serilog.Events;
|
||||||
@ -281,7 +280,7 @@ public class Program
|
|||||||
DownloadDateSelection = Enum.Parse<DownloadDateSelection>(hoconConfig.GetString("Download.DownloadDateSelection"), true),
|
DownloadDateSelection = Enum.Parse<DownloadDateSelection>(hoconConfig.GetString("Download.DownloadDateSelection"), true),
|
||||||
CustomDate = !string.IsNullOrWhiteSpace(hoconConfig.GetString("Download.CustomDate")) ? DateTime.Parse(hoconConfig.GetString("Download.CustomDate")) : null,
|
CustomDate = !string.IsNullOrWhiteSpace(hoconConfig.GetString("Download.CustomDate")) ? DateTime.Parse(hoconConfig.GetString("Download.CustomDate")) : null,
|
||||||
ShowScrapeSize = hoconConfig.GetBoolean("Download.ShowScrapeSize"),
|
ShowScrapeSize = hoconConfig.GetBoolean("Download.ShowScrapeSize"),
|
||||||
DownloadVideoResolution = ParseVideoResolution(hoconConfig.GetString("Download.DownloadVideoResolution")),
|
DownloadVideoResolution = ParseVideoResolution(hoconConfig.GetString("Download.DownloadVideoResolution", "source")),
|
||||||
|
|
||||||
// File Settings
|
// File Settings
|
||||||
PaidPostFileNameFormat = hoconConfig.GetString("File.PaidPostFileNameFormat"),
|
PaidPostFileNameFormat = hoconConfig.GetString("File.PaidPostFileNameFormat"),
|
||||||
@ -515,14 +514,54 @@ public class Program
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Only run the version check if not in DEBUG mode
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
Version localVersion = Assembly.GetEntryAssembly()?.GetName().Version; //Only tested with numeric values.
|
Version localVersion = Assembly.GetEntryAssembly()?.GetName().Version; //Only tested with numeric values.
|
||||||
|
String? latestReleaseTag = VersionHelper.GetLatestReleaseTag();
|
||||||
|
|
||||||
|
if (latestReleaseTag == null)
|
||||||
|
{
|
||||||
|
AnsiConsole.Markup("[yellow]Failed to verify that OF-DL is up-to-date.\n[/]");
|
||||||
|
Log.Error("Failed to get the latest release tag.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Version latestGiteaRelease = new Version(latestReleaseTag.Replace("OFDLV", ""));
|
||||||
|
|
||||||
|
// Compare the Versions
|
||||||
|
int versionComparison = localVersion.CompareTo(latestGiteaRelease);
|
||||||
|
if (versionComparison < 0)
|
||||||
|
{
|
||||||
|
// The version on GitHub is more up to date than this local release.
|
||||||
AnsiConsole.Markup("[red]You are running OF-DL version " + $"{localVersion.Major}.{localVersion.Minor}.{localVersion.Build}\n[/]");
|
AnsiConsole.Markup("[red]You are running OF-DL version " + $"{localVersion.Major}.{localVersion.Minor}.{localVersion.Build}\n[/]");
|
||||||
|
AnsiConsole.Markup("[red]Please update to the current release, " + $"{latestGiteaRelease.Major}.{latestGiteaRelease.Minor}.{latestGiteaRelease.Build}: [link]https://git.ofdl.tools/sim0n00ps/OF-DL/releases[/]\n[/]");
|
||||||
|
Log.Debug("Detected outdated client running version " + $"{localVersion.Major}.{localVersion.Minor}.{localVersion.Build}");
|
||||||
|
Log.Debug("Latest release version " + $"{latestGiteaRelease.Major}.{latestGiteaRelease.Minor}.{latestGiteaRelease.Build}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This local version is greater than the release version on GitHub.
|
||||||
|
AnsiConsole.Markup("[green]You are running OF-DL version " + $"{localVersion.Major}.{localVersion.Minor}.{localVersion.Build}\n[/]");
|
||||||
|
AnsiConsole.Markup("[green]Latest Release version: " + $"{latestGiteaRelease.Major}.{latestGiteaRelease.Minor}.{latestGiteaRelease.Build}\n[/]");
|
||||||
|
Log.Debug("Detected client running version " + $"{localVersion.Major}.{localVersion.Minor}.{localVersion.Build}");
|
||||||
|
Log.Debug("Latest release version " + $"{latestGiteaRelease.Major}.{latestGiteaRelease.Minor}.{latestGiteaRelease.Build}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
AnsiConsole.Markup("[yellow]Running in Debug/Local mode. Version check skipped.\n[/]");
|
AnsiConsole.Markup("[yellow]Running in Debug/Local mode. Version check skipped.\n[/]");
|
||||||
Log.Debug("Running in Debug/Local mode. Version check skipped.");
|
Log.Debug("Running in Debug/Local mode. Version check skipped.");
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
AnsiConsole.Markup("[red]Error checking latest release on GitHub:\n[/]");
|
||||||
|
Console.WriteLine(e);
|
||||||
|
Log.Error("Error checking latest release on GitHub.", e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (File.Exists("auth.json"))
|
if (File.Exists("auth.json"))
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ To run OF-DL in a docker container, follow these steps:
|
|||||||
Adjust `$HOME/ofdl` as desired (including in the commands below) if you want the files stored elsewhere.
|
Adjust `$HOME/ofdl` as desired (including in the commands below) if you want the files stored elsewhere.
|
||||||
4. Run the following command to start the docker container:
|
4. Run the following command to start the docker container:
|
||||||
```bash
|
```bash
|
||||||
docker run --rm -it -v $HOME/ofdl/data/:/data -v $HOME/ofdl/config/:/config -p 8080:8080 ghcr.io/sim0n00ps/of-dl:latest
|
docker run --rm -it -v $HOME/ofdl/data/:/data -v $HOME/ofdl/config/:/config -p 8080:8080 git.ofdl.tools/sim0n00ps/of-dl:latest
|
||||||
```
|
```
|
||||||
If `config.json` and/or `rules.json` don't exist in the `config` directory, files with default values will be created when you run the docker container.
|
If `config.json` and/or `rules.json` don't exist in the `config` directory, files with default values will be created when you run the docker container.
|
||||||
If you have your own Widevine keys, those files should be placed under `$HOME/ofdl/config/cdm/devices/chrome_1610/`.
|
If you have your own Widevine keys, those files should be placed under `$HOME/ofdl/config/cdm/devices/chrome_1610/`.
|
||||||
@ -29,14 +29,14 @@ To run OF-DL in a docker container, follow these steps:
|
|||||||
When a new version of OF-DL is released, you can download the latest docker image by executing:
|
When a new version of OF-DL is released, you can download the latest docker image by executing:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker pull ghcr.io/sim0n00ps/of-dl:latest
|
docker pull git.ofdl.tools/sim0n00ps/of-dl:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
You can then run the new version of OF-DL by executing the `docker run` command in the [Running OF-DL](#running-of-dl) section above.
|
You can then run the new version of OF-DL by executing the `docker run` command in the [Running OF-DL](#running-of-dl) section above.
|
||||||
|
|
||||||
## Building the Docker Image (Optional)
|
## Building the Docker Image (Optional)
|
||||||
|
|
||||||
Since official docker images are provided for OF-DL through GitHub Container Registry (ghcr.io), you do not need to build the docker image yourself.
|
Since official docker images are provided for OF-DL through Gitea (git.ofdl.tools), you do not need to build the docker image yourself.
|
||||||
If you would like to build the docker image yourself, however, start by cloning the OF-DL repository and opening a terminal in the root directory of the repository.
|
If you would like to build the docker image yourself, however, start by cloning the OF-DL repository and opening a terminal in the root directory of the repository.
|
||||||
Then, execute the following command while replacing `x.x.x` with the current version of OF-DL:
|
Then, execute the following command while replacing `x.x.x` with the current version of OF-DL:
|
||||||
|
|
||||||
@ -45,4 +45,4 @@ VERSION="x.x.x" docker build --build-arg VERSION=$VERSION -t of-dl .
|
|||||||
```
|
```
|
||||||
|
|
||||||
You can then run a container using the image you just built by executing the `docker run` command in the
|
You can then run a container using the image you just built by executing the `docker run` command in the
|
||||||
[Running OF-DL](#running-of-dl) section above while replacing `ghcr.io/sim0n00ps/of-dl:latest` with `of-dl`.
|
[Running OF-DL](#running-of-dl) section above while replacing `git.ofdl.tools/sim0n00ps/of-dl:latest` with `of-dl`.
|
||||||
|
@ -27,7 +27,7 @@ sudo apt-get install libicu-dev
|
|||||||
- Clone the repo
|
- Clone the repo
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/sim0n00ps/OF-DL.git
|
git clone https://git.ofdl.tools/sim0n00ps/OF-DL.git
|
||||||
cd 'OF-DL'
|
cd 'OF-DL'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ you will need to specify the path to `ffmpeg.exe` in the config file (see the `F
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Navigate to the OF-DL [releases page](https://github.com/sim0n00ps/OF-DL/releases), and download the latest release zip file. The zip file will be named `OFDLVx.x.x.zip` where `x.x.x` is the version number.
|
1. Navigate to the OF-DL [releases page](https://git.ofdl.tools/sim0n00ps/OF-DL/releases), and download the latest release zip file. The zip file will be named `OFDLVx.x.x.zip` where `x.x.x` is the version number.
|
||||||
2. Unzip the downloaded file. The destination folder can be anywhere on your computer, preferably somewhere where you want to download content to/already have content downloaded.
|
2. Unzip the downloaded file. The destination folder can be anywhere on your computer, preferably somewhere where you want to download content to/already have content downloaded.
|
||||||
3. Your folder should contain a folder named `cdm` as well as the following files:
|
3. Your folder should contain a folder named `cdm` as well as the following files:
|
||||||
- OF DL.exe
|
- OF DL.exe
|
||||||
|
Loading…
x
Reference in New Issue
Block a user