Merge pull request 'dev' (!48) from dev into master
Reviewed-on: glax/Tranga#48
This commit is contained in:
commit
074b137b5c
2
.github/workflows/docker-image.yml
vendored
2
.github/workflows/docker-image.yml
vendored
@ -37,7 +37,7 @@ jobs:
|
|||||||
- name: Build and push API
|
- name: Build and push API
|
||||||
uses: docker/build-push-action@v4.1.1
|
uses: docker/build-push-action@v4.1.1
|
||||||
with:
|
with:
|
||||||
context: ./
|
context: ./API
|
||||||
file: ./API/Dockerfile
|
file: ./API/Dockerfile
|
||||||
#platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
|
#platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/mips64le,linux/mips64,linux/arm/v7,linux/arm/v6
|
||||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/sdk:7.0 as build-env
|
FROM mcr.microsoft.com/dotnet/sdk:7.0 as build-env
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY . /src/
|
COPY . /src/
|
||||||
|
RUN ls -l /src
|
||||||
RUN dotnet restore /src/API/API.csproj
|
RUN dotnet restore /src/API/API.csproj
|
||||||
RUN dotnet publish -c Release -o /publish
|
RUN dotnet publish -c Release -o /publish
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ public class RequestHandler
|
|||||||
new(HttpMethod.Get, "/Tasks/Types", Array.Empty<string>()),
|
new(HttpMethod.Get, "/Tasks/Types", Array.Empty<string>()),
|
||||||
new(HttpMethod.Post, "/Tasks/CreateMonitorTask",
|
new(HttpMethod.Post, "/Tasks/CreateMonitorTask",
|
||||||
new[] { "connectorName", "internalId", "reoccurrenceTime", "language?" }),
|
new[] { "connectorName", "internalId", "reoccurrenceTime", "language?" }),
|
||||||
new(HttpMethod.Post, "/Tasks/CreateUpdateLibraryTask", new[] { "reoccurrenceTime" }),
|
//DEPRECATED new(HttpMethod.Post, "/Tasks/CreateUpdateLibraryTask", new[] { "reoccurrenceTime" }),
|
||||||
new(HttpMethod.Post, "/Tasks/CreateDownloadChaptersTask",
|
new(HttpMethod.Post, "/Tasks/CreateDownloadChaptersTask",
|
||||||
new[] { "connectorName", "internalId", "chapters", "language?" }),
|
new[] { "connectorName", "internalId", "chapters", "language?" }),
|
||||||
new(HttpMethod.Get, "/Tasks", new[] { "taskType", "connectorName?", "publicationId?" }),
|
new(HttpMethod.Get, "/Tasks", new[] { "taskType", "connectorName?", "publicationId?" }),
|
||||||
@ -162,11 +162,11 @@ public class RequestHandler
|
|||||||
return;
|
return;
|
||||||
_taskManager.AddTask(new MonitorPublicationTask(connectorName1, (Publication)publication1, TimeSpan.Parse(reoccurrenceTime1), language1 ?? "en"));
|
_taskManager.AddTask(new MonitorPublicationTask(connectorName1, (Publication)publication1, TimeSpan.Parse(reoccurrenceTime1), language1 ?? "en"));
|
||||||
break;
|
break;
|
||||||
case "/Tasks/CreateUpdateLibraryTask":
|
case "/Tasks/CreateUpdateLibraryTask": // DEPRECATED
|
||||||
variables.TryGetValue("reoccurrenceTime", out string? reoccurrenceTime2);
|
/*variables.TryGetValue("reoccurrenceTime", out string? reoccurrenceTime2);
|
||||||
if (reoccurrenceTime2 is null)
|
if (reoccurrenceTime2 is null)
|
||||||
return;
|
return;
|
||||||
_taskManager.AddTask(new UpdateLibrariesTask(TimeSpan.Parse(reoccurrenceTime2)));
|
_taskManager.AddTask(new UpdateLibrariesTask(TimeSpan.Parse(reoccurrenceTime2)));*/
|
||||||
break;
|
break;
|
||||||
case "/Tasks/CreateDownloadChaptersTask":
|
case "/Tasks/CreateDownloadChaptersTask":
|
||||||
variables.TryGetValue("connectorName", out string? connectorName2);
|
variables.TryGetValue("connectorName", out string? connectorName2);
|
||||||
|
27
Tranga/Migrate.cs
Normal file
27
Tranga/Migrate.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Tranga;
|
||||||
|
|
||||||
|
public static class Migrate
|
||||||
|
{
|
||||||
|
private static readonly ushort CurrentVersion = 16;
|
||||||
|
public static void Files(TrangaSettings settings)
|
||||||
|
{
|
||||||
|
settings.version ??= 15;
|
||||||
|
switch (settings.version)
|
||||||
|
{
|
||||||
|
case 15:
|
||||||
|
RemoveUpdateLibraryTask(settings);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
settings.version = CurrentVersion;
|
||||||
|
settings.ExportSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void RemoveUpdateLibraryTask(TrangaSettings settings)
|
||||||
|
{
|
||||||
|
List<TrangaTask> tasks = JsonConvert.DeserializeObject<List<TrangaTask>>(settings.tasksFilePath)!;
|
||||||
|
tasks.RemoveAll(t => t.task == TrangaTask.Task.UpdateLibraries);
|
||||||
|
}
|
||||||
|
}
|
@ -37,6 +37,7 @@ public class TaskManager
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
|
Migrate.Files(settings);
|
||||||
ImportData();
|
ImportData();
|
||||||
ExportDataAndSettings();
|
ExportDataAndSettings();
|
||||||
Thread taskChecker = new(TaskCheckerThread);
|
Thread taskChecker = new(TaskCheckerThread);
|
||||||
|
@ -15,6 +15,7 @@ public class TrangaSettings
|
|||||||
[JsonIgnore] public string coverImageCache => Path.Join(workingDirectory, "imageCache");
|
[JsonIgnore] public string coverImageCache => Path.Join(workingDirectory, "imageCache");
|
||||||
public HashSet<LibraryManager> libraryManagers { get; }
|
public HashSet<LibraryManager> libraryManagers { get; }
|
||||||
public HashSet<NotificationManager> notificationManagers { get; }
|
public HashSet<NotificationManager> notificationManagers { get; }
|
||||||
|
public ushort? version { get; set; }
|
||||||
|
|
||||||
public TrangaSettings(string downloadLocation, string workingDirectory, HashSet<LibraryManager>? libraryManagers,
|
public TrangaSettings(string downloadLocation, string workingDirectory, HashSet<LibraryManager>? libraryManagers,
|
||||||
HashSet<NotificationManager>? notificationManagers)
|
HashSet<NotificationManager>? notificationManagers)
|
||||||
|
@ -3,6 +3,9 @@ using Logging;
|
|||||||
|
|
||||||
namespace Tranga.TrangaTasks;
|
namespace Tranga.TrangaTasks;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// LEGACY DEPRECATED
|
||||||
|
/// </summary>
|
||||||
public class UpdateLibrariesTask : TrangaTask
|
public class UpdateLibrariesTask : TrangaTask
|
||||||
{
|
{
|
||||||
public UpdateLibrariesTask(TimeSpan reoccurrence) : base(Task.UpdateLibraries, reoccurrence)
|
public UpdateLibrariesTask(TimeSpan reoccurrence) : base(Task.UpdateLibraries, reoccurrence)
|
||||||
|
Loading…
Reference in New Issue
Block a user