diff --git a/Azaion.Annotator/Annotator.xaml.cs b/Azaion.Annotator/Annotator.xaml.cs
index 5e88471..22970ac 100644
--- a/Azaion.Annotator/Annotator.xaml.cs
+++ b/Azaion.Annotator/Annotator.xaml.cs
@@ -14,7 +14,6 @@ using Azaion.Common.DTO.Config;
using Azaion.Common.Events;
using Azaion.Common.Extensions;
using Azaion.Common.Services;
-using Azaion.CommonSecurity.DTO.Commands;
using LibVLCSharp.Shared;
using MediatR;
using Microsoft.WindowsAPICodePack.Dialogs;
diff --git a/Azaion.Annotator/AnnotatorEventHandler.cs b/Azaion.Annotator/AnnotatorEventHandler.cs
index c316b17..b8bcbfa 100644
--- a/Azaion.Annotator/AnnotatorEventHandler.cs
+++ b/Azaion.Annotator/AnnotatorEventHandler.cs
@@ -2,7 +2,6 @@
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
-using System.Windows.Threading;
using Azaion.Annotator.Controls;
using Azaion.Annotator.DTO;
using Azaion.Common;
@@ -12,8 +11,6 @@ using Azaion.Common.DTO.Config;
using Azaion.Common.Events;
using Azaion.Common.Extensions;
using Azaion.Common.Services;
-using Azaion.CommonSecurity.DTO;
-using Azaion.CommonSecurity.Services;
using GMap.NET;
using GMap.NET.WindowsPresentation;
using LibVLCSharp.Shared;
diff --git a/Azaion.Common/Azaion.Common.csproj b/Azaion.Common/Azaion.Common.csproj
index 301ad17..ca47d48 100644
--- a/Azaion.Common/Azaion.Common.csproj
+++ b/Azaion.Common/Azaion.Common.csproj
@@ -7,7 +7,9 @@
+
+
@@ -15,17 +17,15 @@
+
+
-
-
-
-
diff --git a/Azaion.Common/Controls/DetectionClasses.xaml.cs b/Azaion.Common/Controls/DetectionClasses.xaml.cs
index 7b2500a..8f7d4ce 100644
--- a/Azaion.Common/Controls/DetectionClasses.xaml.cs
+++ b/Azaion.Common/Controls/DetectionClasses.xaml.cs
@@ -4,7 +4,6 @@ using System.Windows.Controls;
using System.Windows.Input;
using Azaion.Common.DTO;
using Azaion.Common.Extensions;
-using Azaion.CommonSecurity.DTO;
namespace Azaion.Common.Controls;
diff --git a/Azaion.Common/DTO/AnnotationThumbnail.cs b/Azaion.Common/DTO/AnnotationThumbnail.cs
index f3e00e4..54a1572 100644
--- a/Azaion.Common/DTO/AnnotationThumbnail.cs
+++ b/Azaion.Common/DTO/AnnotationThumbnail.cs
@@ -4,7 +4,6 @@ using System.Runtime.CompilerServices;
using System.Windows.Media.Imaging;
using Azaion.Common.Database;
using Azaion.Common.Extensions;
-using Azaion.CommonSecurity.DTO;
namespace Azaion.Common.DTO;
diff --git a/Azaion.CommonSecurity/DTO/ApiCredentials.cs b/Azaion.Common/DTO/ApiCredentials.cs
similarity index 91%
rename from Azaion.CommonSecurity/DTO/ApiCredentials.cs
rename to Azaion.Common/DTO/ApiCredentials.cs
index 92f0eb6..d11ab90 100644
--- a/Azaion.CommonSecurity/DTO/ApiCredentials.cs
+++ b/Azaion.Common/DTO/ApiCredentials.cs
@@ -1,7 +1,7 @@
using CommandLine;
using MessagePack;
-namespace Azaion.CommonSecurity.DTO;
+namespace Azaion.Common.DTO;
[MessagePackObject]
public class ApiCredentials : EventArgs
diff --git a/Azaion.CommonSecurity/DTO/BusinessExceptionDto.cs b/Azaion.Common/DTO/BusinessExceptionDto.cs
similarity index 57%
rename from Azaion.CommonSecurity/DTO/BusinessExceptionDto.cs
rename to Azaion.Common/DTO/BusinessExceptionDto.cs
index 5315856..5a64178 100644
--- a/Azaion.CommonSecurity/DTO/BusinessExceptionDto.cs
+++ b/Azaion.Common/DTO/BusinessExceptionDto.cs
@@ -1,6 +1,6 @@
-namespace Azaion.CommonSecurity.DTO;
+namespace Azaion.Common.DTO;
-internal class BusinessExceptionDto
+public class BusinessExceptionDto
{
public int ErrorCode { get; set; }
public string Message { get; set; } = string.Empty;
diff --git a/Azaion.Common/DTO/Config/AppConfig.cs b/Azaion.Common/DTO/Config/AppConfig.cs
index 74f8298..b4e2275 100644
--- a/Azaion.Common/DTO/Config/AppConfig.cs
+++ b/Azaion.Common/DTO/Config/AppConfig.cs
@@ -1,7 +1,6 @@
using System.IO;
using System.Text;
using Azaion.CommonSecurity;
-using Azaion.CommonSecurity.DTO;
using Newtonsoft.Json;
namespace Azaion.Common.DTO.Config;
diff --git a/Azaion.CommonSecurity/DTO/DirectoriesConfig.cs b/Azaion.Common/DTO/DirectoriesConfig.cs
similarity index 92%
rename from Azaion.CommonSecurity/DTO/DirectoriesConfig.cs
rename to Azaion.Common/DTO/DirectoriesConfig.cs
index 2624485..c4d6f73 100644
--- a/Azaion.CommonSecurity/DTO/DirectoriesConfig.cs
+++ b/Azaion.Common/DTO/DirectoriesConfig.cs
@@ -1,4 +1,4 @@
-namespace Azaion.CommonSecurity.DTO;
+namespace Azaion.Common.DTO;
public class DirectoriesConfig
diff --git a/Azaion.CommonSecurity/DTO/ExternalClientsConfig.cs b/Azaion.Common/DTO/ExternalClientsConfig.cs
similarity index 92%
rename from Azaion.CommonSecurity/DTO/ExternalClientsConfig.cs
rename to Azaion.Common/DTO/ExternalClientsConfig.cs
index e522c68..4b9ccad 100644
--- a/Azaion.CommonSecurity/DTO/ExternalClientsConfig.cs
+++ b/Azaion.Common/DTO/ExternalClientsConfig.cs
@@ -1,4 +1,4 @@
-namespace Azaion.CommonSecurity.DTO;
+namespace Azaion.Common.DTO;
public abstract class ExternalClientConfig
{
diff --git a/Azaion.CommonSecurity/DTO/IEnumerableExtensions.cs b/Azaion.Common/DTO/IEnumerableExtensions.cs
similarity index 77%
rename from Azaion.CommonSecurity/DTO/IEnumerableExtensions.cs
rename to Azaion.Common/DTO/IEnumerableExtensions.cs
index 32157b9..5386daa 100644
--- a/Azaion.CommonSecurity/DTO/IEnumerableExtensions.cs
+++ b/Azaion.Common/DTO/IEnumerableExtensions.cs
@@ -1,4 +1,4 @@
-namespace Azaion.CommonSecurity.DTO;
+namespace Azaion.Common.DTO;
public static class EnumerableExtensions
{
diff --git a/Azaion.CommonSecurity/DTO/InitConfig.cs b/Azaion.Common/DTO/InitConfig.cs
similarity index 89%
rename from Azaion.CommonSecurity/DTO/InitConfig.cs
rename to Azaion.Common/DTO/InitConfig.cs
index d424f88..74fb984 100644
--- a/Azaion.CommonSecurity/DTO/InitConfig.cs
+++ b/Azaion.Common/DTO/InitConfig.cs
@@ -1,4 +1,4 @@
-namespace Azaion.CommonSecurity.DTO;
+namespace Azaion.Common.DTO;
public class InitConfig
{
diff --git a/Azaion.CommonSecurity/DTO/LoginResponse.cs b/Azaion.Common/DTO/LoginResponse.cs
similarity index 67%
rename from Azaion.CommonSecurity/DTO/LoginResponse.cs
rename to Azaion.Common/DTO/LoginResponse.cs
index a9d070f..b2a027b 100644
--- a/Azaion.CommonSecurity/DTO/LoginResponse.cs
+++ b/Azaion.Common/DTO/LoginResponse.cs
@@ -1,4 +1,4 @@
-namespace Azaion.CommonSecurity.DTO;
+namespace Azaion.Common.DTO;
public class LoginResponse
{
diff --git a/Azaion.Common/DTO/Queue/AnnotationCreatedMessage.cs b/Azaion.Common/DTO/Queue/AnnotationCreatedMessage.cs
index 6bcf78e..1f130f9 100644
--- a/Azaion.Common/DTO/Queue/AnnotationCreatedMessage.cs
+++ b/Azaion.Common/DTO/Queue/AnnotationCreatedMessage.cs
@@ -1,5 +1,4 @@
using Azaion.Common.Database;
-using Azaion.CommonSecurity.DTO;
namespace Azaion.Common.DTO.Queue;
using MessagePack;
diff --git a/Azaion.CommonSecurity/DTO/Commands/RemoteCommand.cs b/Azaion.Common/DTO/RemoteCommand.cs
similarity index 91%
rename from Azaion.CommonSecurity/DTO/Commands/RemoteCommand.cs
rename to Azaion.Common/DTO/RemoteCommand.cs
index 923cdf1..5edeea9 100644
--- a/Azaion.CommonSecurity/DTO/Commands/RemoteCommand.cs
+++ b/Azaion.Common/DTO/RemoteCommand.cs
@@ -1,6 +1,6 @@
using MessagePack;
-namespace Azaion.CommonSecurity.DTO.Commands;
+namespace Azaion.Common.DTO;
[MessagePackObject]
public class RemoteCommand(CommandType commandType, byte[]? data = null, string? message = null)
@@ -39,7 +39,11 @@ public enum CommandType
None = 0,
Ok = 3,
Login = 10,
+ ListRequest = 15,
+ ListFiles = 18,
Load = 20,
+ LoadBigSmall = 22,
+ UploadBigSmall = 24,
DataBytes = 25,
Inference = 30,
InferenceData = 35,
diff --git a/Azaion.CommonSecurity/DTO/RoleEnum.cs b/Azaion.Common/DTO/RoleEnum.cs
similarity index 92%
rename from Azaion.CommonSecurity/DTO/RoleEnum.cs
rename to Azaion.Common/DTO/RoleEnum.cs
index 5f65539..558bfff 100644
--- a/Azaion.CommonSecurity/DTO/RoleEnum.cs
+++ b/Azaion.Common/DTO/RoleEnum.cs
@@ -1,4 +1,4 @@
-namespace Azaion.CommonSecurity.DTO;
+namespace Azaion.Common.DTO;
public enum RoleEnum
{
diff --git a/Azaion.CommonSecurity/DTO/User.cs b/Azaion.Common/DTO/User.cs
similarity index 93%
rename from Azaion.CommonSecurity/DTO/User.cs
rename to Azaion.Common/DTO/User.cs
index 2254574..e0ffb08 100644
--- a/Azaion.CommonSecurity/DTO/User.cs
+++ b/Azaion.Common/DTO/User.cs
@@ -1,4 +1,4 @@
-namespace Azaion.CommonSecurity.DTO;
+namespace Azaion.Common.DTO;
public class User
{
diff --git a/Azaion.Common/Database/Annotation.cs b/Azaion.Common/Database/Annotation.cs
index 42c780c..c89f2ab 100644
--- a/Azaion.Common/Database/Annotation.cs
+++ b/Azaion.Common/Database/Annotation.cs
@@ -2,7 +2,6 @@
using Azaion.Common.DTO;
using Azaion.Common.DTO.Config;
using Azaion.Common.DTO.Queue;
-using Azaion.CommonSecurity.DTO;
using MessagePack;
namespace Azaion.Common.Database;
diff --git a/Azaion.CommonSecurity/Exceptions/BusinessException.cs b/Azaion.Common/Exceptions/BusinessException.cs
similarity index 100%
rename from Azaion.CommonSecurity/Exceptions/BusinessException.cs
rename to Azaion.Common/Exceptions/BusinessException.cs
diff --git a/Azaion.CommonSecurity/SecurityConstants.cs b/Azaion.Common/SecurityConstants.cs
similarity index 97%
rename from Azaion.CommonSecurity/SecurityConstants.cs
rename to Azaion.Common/SecurityConstants.cs
index f18a610..b251dcb 100644
--- a/Azaion.CommonSecurity/SecurityConstants.cs
+++ b/Azaion.Common/SecurityConstants.cs
@@ -1,7 +1,8 @@
-using Azaion.CommonSecurity.DTO;
+using System.IO;
+using Azaion.Common.DTO;
using Newtonsoft.Json;
-namespace Azaion.CommonSecurity;
+namespace Azaion.Common;
public class SecurityConstants
{
diff --git a/Azaion.Common/Services/AnnotationService.cs b/Azaion.Common/Services/AnnotationService.cs
index 4f3e1af..9143691 100644
--- a/Azaion.Common/Services/AnnotationService.cs
+++ b/Azaion.Common/Services/AnnotationService.cs
@@ -8,8 +8,6 @@ using Azaion.Common.DTO.Config;
using Azaion.Common.DTO.Queue;
using Azaion.Common.Events;
using Azaion.Common.Extensions;
-using Azaion.CommonSecurity.DTO;
-using Azaion.CommonSecurity.Services;
using LinqToDB;
using LinqToDB.Data;
using MediatR;
diff --git a/Azaion.CommonSecurity/Services/AuthProvider.cs b/Azaion.Common/Services/AuthProvider.cs
similarity index 97%
rename from Azaion.CommonSecurity/Services/AuthProvider.cs
rename to Azaion.Common/Services/AuthProvider.cs
index be47e62..841a35e 100644
--- a/Azaion.CommonSecurity/Services/AuthProvider.cs
+++ b/Azaion.Common/Services/AuthProvider.cs
@@ -1,10 +1,12 @@
-using System.Net;
+using System.IO;
+using System.Net;
+using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
-using Azaion.CommonSecurity.DTO;
+using Azaion.Common.DTO;
using Newtonsoft.Json;
-namespace Azaion.CommonSecurity.Services;
+namespace Azaion.Common.Services;
public interface IAzaionApi
{
diff --git a/Azaion.CommonSecurity/Services/Cache.cs b/Azaion.Common/Services/Cache.cs
similarity index 94%
rename from Azaion.CommonSecurity/Services/Cache.cs
rename to Azaion.Common/Services/Cache.cs
index b98d8a3..a1454db 100644
--- a/Azaion.CommonSecurity/Services/Cache.cs
+++ b/Azaion.Common/Services/Cache.cs
@@ -1,6 +1,6 @@
using LazyCache;
-namespace Azaion.CommonSecurity.Services;
+namespace Azaion.Common.Services;
public interface ICache
{
diff --git a/Azaion.Common/Services/FailsafeProducer.cs b/Azaion.Common/Services/FailsafeProducer.cs
index a570a65..8d49bca 100644
--- a/Azaion.Common/Services/FailsafeProducer.cs
+++ b/Azaion.Common/Services/FailsafeProducer.cs
@@ -1,11 +1,10 @@
using System.IO;
using System.Net;
using Azaion.Common.Database;
+using Azaion.Common.DTO;
using Azaion.Common.DTO.Config;
using Azaion.Common.DTO.Queue;
using Azaion.Common.Extensions;
-using Azaion.CommonSecurity.DTO;
-using Azaion.CommonSecurity.Services;
using LinqToDB;
using MessagePack;
using Microsoft.Extensions.Logging;
diff --git a/Azaion.Common/Services/GPSMatcherService.cs b/Azaion.Common/Services/GPSMatcherService.cs
index 29b0d98..79aae9d 100644
--- a/Azaion.Common/Services/GPSMatcherService.cs
+++ b/Azaion.Common/Services/GPSMatcherService.cs
@@ -1,6 +1,5 @@
using System.IO;
-using Azaion.CommonSecurity;
-using Azaion.CommonSecurity.DTO;
+using Azaion.Common.DTO;
using Microsoft.Extensions.Options;
namespace Azaion.Common.Services;
diff --git a/Azaion.Common/Services/GalleryService.cs b/Azaion.Common/Services/GalleryService.cs
index 548e3a1..bf15376 100644
--- a/Azaion.Common/Services/GalleryService.cs
+++ b/Azaion.Common/Services/GalleryService.cs
@@ -9,7 +9,6 @@ using Azaion.Common.DTO;
using Azaion.Common.DTO.Config;
using Azaion.Common.DTO.Queue;
using Azaion.Common.Extensions;
-using Azaion.CommonSecurity.DTO;
using LinqToDB;
using LinqToDB.Data;
using Microsoft.Extensions.Logging;
diff --git a/Azaion.Common/Services/GpsMatcherClient.cs b/Azaion.Common/Services/GpsMatcherClient.cs
index 81a6211..1ee902a 100644
--- a/Azaion.Common/Services/GpsMatcherClient.cs
+++ b/Azaion.Common/Services/GpsMatcherClient.cs
@@ -1,8 +1,7 @@
using System.Diagnostics;
using System.IO;
+using Azaion.Common.DTO;
using Azaion.Common.Events;
-using Azaion.CommonSecurity;
-using Azaion.CommonSecurity.DTO;
using MediatR;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
diff --git a/Azaion.Common/Services/InferenceClient.cs b/Azaion.Common/Services/InferenceClient.cs
index 97c66be..c0f46ef 100644
--- a/Azaion.Common/Services/InferenceClient.cs
+++ b/Azaion.Common/Services/InferenceClient.cs
@@ -1,13 +1,6 @@
using System.Diagnostics;
-using System.IO;
using System.Text;
-using Azaion.Common.Database;
-using Azaion.Common.Extensions;
-using Azaion.CommonSecurity;
-using Azaion.CommonSecurity.DTO;
-using Azaion.CommonSecurity.DTO.Commands;
-using Azaion.CommonSecurity.Exceptions;
-using Azaion.CommonSecurity.Services;
+using Azaion.Common.DTO;
using MessagePack;
using Microsoft.Extensions.Options;
using NetMQ;
diff --git a/Azaion.Common/Services/InferenceService.cs b/Azaion.Common/Services/InferenceService.cs
index 9dee7e6..8ae9949 100644
--- a/Azaion.Common/Services/InferenceService.cs
+++ b/Azaion.Common/Services/InferenceService.cs
@@ -1,9 +1,8 @@
using Azaion.Common.Database;
+using Azaion.Common.DTO;
using Azaion.Common.DTO.Config;
using Azaion.Common.Events;
using Azaion.Common.Extensions;
-using Azaion.CommonSecurity.DTO.Commands;
-using Azaion.CommonSecurity.Services;
using MediatR;
using MessagePack;
using Microsoft.Extensions.Logging;
diff --git a/Azaion.CommonSecurity/Services/LoaderClient.cs b/Azaion.Common/Services/LoaderClient.cs
similarity index 96%
rename from Azaion.CommonSecurity/Services/LoaderClient.cs
rename to Azaion.Common/Services/LoaderClient.cs
index e1cfbc4..a37e12c 100644
--- a/Azaion.CommonSecurity/Services/LoaderClient.cs
+++ b/Azaion.Common/Services/LoaderClient.cs
@@ -1,14 +1,14 @@
using System.Diagnostics;
+using System.IO;
using System.Text;
-using Azaion.CommonSecurity.DTO;
-using Azaion.CommonSecurity.DTO.Commands;
+using Azaion.Common.DTO;
using MessagePack;
using NetMQ;
using NetMQ.Sockets;
using Serilog;
using Exception = System.Exception;
-namespace Azaion.CommonSecurity.Services;
+namespace Azaion.Common.Services;
public class LoaderClient(LoaderClientConfig config, ILogger logger, CancellationToken ct = default) : IDisposable
{
diff --git a/Azaion.Common/Services/SatelliteDownloader.cs b/Azaion.Common/Services/SatelliteDownloader.cs
index ad527ef..6be344d 100644
--- a/Azaion.Common/Services/SatelliteDownloader.cs
+++ b/Azaion.Common/Services/SatelliteDownloader.cs
@@ -8,7 +8,6 @@ using Azaion.Common.DTO.Config;
using Azaion.Common.Events;
using Azaion.Common.Extensions;
using Azaion.CommonSecurity;
-using Azaion.CommonSecurity.DTO;
using MediatR;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
diff --git a/Azaion.CommonSecurity/Azaion.CommonSecurity.csproj b/Azaion.CommonSecurity/Azaion.CommonSecurity.csproj
deleted file mode 100644
index e48a1e7..0000000
--- a/Azaion.CommonSecurity/Azaion.CommonSecurity.csproj
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
- net8.0-windows
- enable
- enable
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Azaion.CommonSecurity/DTO/HardwareInfo.cs b/Azaion.CommonSecurity/DTO/HardwareInfo.cs
deleted file mode 100644
index 4b87a34..0000000
--- a/Azaion.CommonSecurity/DTO/HardwareInfo.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace Azaion.CommonSecurity.DTO;
-
-public class HardwareInfo
-{
- public string CPU { get; set; } = null!;
- public string GPU { get; set; } = null!;
- public string MacAddress { get; set; } = null!;
- public string Memory { get; set; } = null!;
-}
\ No newline at end of file
diff --git a/Azaion.Dataset/DatasetExplorer.xaml.cs b/Azaion.Dataset/DatasetExplorer.xaml.cs
index 7266a2c..4c8125d 100644
--- a/Azaion.Dataset/DatasetExplorer.xaml.cs
+++ b/Azaion.Dataset/DatasetExplorer.xaml.cs
@@ -8,8 +8,6 @@ using Azaion.Common.DTO.Config;
using Azaion.Common.Events;
using Azaion.Common.Extensions;
using Azaion.Common.Services;
-using Azaion.CommonSecurity.DTO;
-using Azaion.CommonSecurity.Services;
using LinqToDB;
using MediatR;
using Microsoft.Extensions.Logging;
diff --git a/Azaion.Dataset/DatasetExplorerEventHandler.cs b/Azaion.Dataset/DatasetExplorerEventHandler.cs
index f0cd874..e074623 100644
--- a/Azaion.Dataset/DatasetExplorerEventHandler.cs
+++ b/Azaion.Dataset/DatasetExplorerEventHandler.cs
@@ -3,8 +3,6 @@ using Azaion.Common.Database;
using Azaion.Common.DTO;
using Azaion.Common.Events;
using Azaion.Common.Services;
-using Azaion.CommonSecurity.DTO;
-using Azaion.CommonSecurity.Services;
using MediatR;
using Microsoft.Extensions.Logging;
diff --git a/Azaion.Inference/inference.pyx b/Azaion.Inference/inference.pyx
index a781642..785665d 100644
--- a/Azaion.Inference/inference.pyx
+++ b/Azaion.Inference/inference.pyx
@@ -72,6 +72,7 @@ cdef class Inference:
if res.err is None:
print('tensor rt engine is here, no need to build')
self.is_building_engine = False
+ updater_callback('enabled')
return
print(res.err)
diff --git a/Azaion.Loader/api_client.pxd b/Azaion.Loader/api_client.pxd
index b93f7df..69bfec0 100644
--- a/Azaion.Loader/api_client.pxd
+++ b/Azaion.Loader/api_client.pxd
@@ -14,7 +14,7 @@ cdef class ApiClient:
cdef set_token(self, str token)
cdef get_user(self)
- cdef post(self, url, json)
+ cdef request(self, str method, str url, object payload, bint is_stream)
cdef list_files(self, str folder, str search_file)
cdef load_bytes(self, str filename, str folder)
cdef upload_file(self, str filename, bytes resource, str folder)
diff --git a/Azaion.Loader/api_client.pyx b/Azaion.Loader/api_client.pyx
index abf1119..c8d29bf 100644
--- a/Azaion.Loader/api_client.pyx
+++ b/Azaion.Loader/api_client.pyx
@@ -47,7 +47,7 @@ cdef class ApiClient:
token = response.json()["token"]
self.set_token(token)
except HTTPError as e:
- print(response.json())
+ constants.log(response.json())
if response.status_code == HTTPStatus.CONFLICT:
res = response.json()
raise Exception(res['Message'])
@@ -98,9 +98,9 @@ cdef class ApiClient:
constants.log(f"Upload fail: {e}")
cdef list_files(self, str folder, str search_file):
- response = self.post(f'{self.api_url}/resources/list/{folder}', {
+ response = self.request('get', f'{self.api_url}/resources/list/{folder}', {
"search": search_file
- })
+ }, is_stream=False)
constants.log( f'Get files list by {folder}')
return response.json()
@@ -114,14 +114,14 @@ cdef class ApiClient:
"hardware": hardware,
"fileName": filename
}, indent=4)
- response = self.post(f'{self.api_url}/resources/get/{folder}', payload)
+ response = self.request('post', f'{self.api_url}/resources/get/{folder}', payload, is_stream=True)
resp_bytes = response.raw.read()
data = Security.decrypt_to(resp_bytes, key)
constants.log(f'Downloaded file: {filename}, {len(data)} bytes')
return data
- cdef post(self, url, payload):
+ cdef request(self, str method, str url, object payload, bint is_stream):
if self.token is None:
self.login()
headers = {
@@ -129,14 +129,14 @@ cdef class ApiClient:
"Content-Type": "application/json"
}
- response = requests.post(url, data=payload, headers=headers, stream=True)
+ response = requests.request(method, url, data=payload, headers=headers, stream=is_stream)
if response.status_code == HTTPStatus.UNAUTHORIZED or response.status_code == HTTPStatus.FORBIDDEN:
self.login()
headers = {
"Authorization": f"Bearer {self.token}",
"Content-Type": "application/json"
}
- response = requests.post(url, data=payload, headers=headers, stream=True)
+ response = requests.request(method, url, data=payload, headers=headers, stream=is_stream)
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
raise Exception(f'Internal API error! {response.text}')
@@ -148,7 +148,7 @@ cdef class ApiClient:
return response
cdef load_big_file_cdn(self, str folder, str big_part):
- print(f'downloading file {folder}\\{big_part} from cdn...')
+ constants.log(f'downloading file {folder}\\{big_part} from cdn...')
if self.cdn_manager.download(folder, big_part):
with open(path.join( folder, big_part), 'rb') as binary_file:
encrypted_bytes_big = binary_file.read()
@@ -164,16 +164,16 @@ cdef class ApiClient:
key = Security.get_resource_encryption_key()
- print(f'checking on existence for {folder}\\{big_part}')
+ constants.log(f'checking on existence for {folder}\\{big_part}')
if os.path.exists(os.path.join( folder, big_part)):
with open(path.join( folder, big_part), 'rb') as binary_file:
local_bytes_big = binary_file.read()
- print(f'local file {folder}\\{big_part} is found!')
+ constants.log(f'local file {folder}\\{big_part} is found!')
try:
resource = Security.decrypt_to(encrypted_bytes_small + local_bytes_big, key)
return resource
except Exception as ex:
- print('Local file doesnt match with api file, old version')
+ constants.log('Local file {folder}\\{big_part} doesnt match with api file, old version')
remote_bytes_big = self.load_big_file_cdn(folder, big_part)
return Security.decrypt_to(encrypted_bytes_small + remote_bytes_big, key)
diff --git a/Azaion.LoaderUI/ApiCredentials.cs b/Azaion.LoaderUI/ApiCredentials.cs
new file mode 100644
index 0000000..360b3c6
--- /dev/null
+++ b/Azaion.LoaderUI/ApiCredentials.cs
@@ -0,0 +1,10 @@
+namespace Azaion.LoaderUI;
+
+public class ApiCredentials(string email, string pw)
+{
+ public string Email { get; set; } = email;
+ public string Password { get; set; } = pw;
+
+ public bool IsValid() =>
+ !string.IsNullOrWhiteSpace(Email) && !string.IsNullOrWhiteSpace(Password);
+}
\ No newline at end of file
diff --git a/Azaion.LoaderUI/App.xaml.cs b/Azaion.LoaderUI/App.xaml.cs
index 176608b..b415754 100644
--- a/Azaion.LoaderUI/App.xaml.cs
+++ b/Azaion.LoaderUI/App.xaml.cs
@@ -1,18 +1,14 @@
using System.Windows;
-using Azaion.CommonSecurity;
-using Azaion.CommonSecurity.Services;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Options;
using Serilog;
namespace Azaion.LoaderUI;
public partial class App
{
- private LoaderClient _loaderClient = null!;
- private readonly CancellationTokenSource _loaderUITokenSource = new();
-
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
@@ -30,19 +26,21 @@ public partial class App
rollingInterval: RollingInterval.Day)
.CreateLogger();
- var initConfig = SecurityConstants.ReadInitConfig();
- _loaderClient = new LoaderClient(initConfig.LoaderClientConfig, Log.Logger, _loaderUITokenSource.Token);
- _loaderClient.StartClient();
- _loaderClient.Connect();
-
var host = Host.CreateDefaultBuilder()
.ConfigureAppConfiguration((_, config) => config
.AddCommandLine(Environment.GetCommandLineArgs())
- .AddJsonFile(SecurityConstants.CONFIG_PATH, optional: true, reloadOnChange: true))
+ .AddJsonFile(Constants.CONFIG_JSON_FILE))
.UseSerilog()
.ConfigureServices((context, services) =>
{
services.AddSingleton();
+ services.Configure(context.Configuration.GetSection(nameof(DirectoriesConfig)));
+ services.AddHttpClient((sp, client) =>
+ {
+ client.BaseAddress = new Uri(Constants.API_URL);
+ client.DefaultRequestHeaders.Add("Accept", "application/json");
+ client.DefaultRequestHeaders.Add("User-Agent", "Azaion.LoaderUI");
+ });
})
.Build();
host.Start();
diff --git a/Azaion.LoaderUI/Azaion.LoaderUI.csproj b/Azaion.LoaderUI/Azaion.LoaderUI.csproj
index 35c3af2..64319e5 100644
--- a/Azaion.LoaderUI/Azaion.LoaderUI.csproj
+++ b/Azaion.LoaderUI/Azaion.LoaderUI.csproj
@@ -8,14 +8,11 @@
true
-
-
-
-
+
@@ -23,4 +20,11 @@
+
+
+
+ PreserveNewest
+
+
+
diff --git a/Azaion.LoaderUI/AzaionApi.cs b/Azaion.LoaderUI/AzaionApi.cs
new file mode 100644
index 0000000..f2ddfe7
--- /dev/null
+++ b/Azaion.LoaderUI/AzaionApi.cs
@@ -0,0 +1,118 @@
+using System.IO;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text;
+using Newtonsoft.Json;
+
+namespace Azaion.LoaderUI;
+
+public interface IAzaionApi
+{
+ void Login(ApiCredentials credentials);
+ string GetLastInstallerName(string folder);
+ (string name, Stream stream) DownloadInstaller(string folder);
+}
+
+public class AzaionApi(HttpClient client) : IAzaionApi
+{
+ private string _jwtToken = null!;
+ const string APP_JSON = "application/json";
+ private ApiCredentials _credentials = null!;
+
+ public void Login(ApiCredentials credentials)
+ {
+ _credentials = credentials;
+ }
+
+ public string GetLastInstallerName(string folder)
+ {
+ var res = Get>($"/resources/list/{folder}");
+ return res?.FirstOrDefault() ?? "";
+ }
+
+ public (string name, Stream stream) DownloadInstaller(string folder)
+ {
+ var response = Send(new HttpRequestMessage(HttpMethod.Get, $"resources/get-installer/{folder}"));
+ var fileStream = response.Content.ReadAsStream();
+ var fileName = response.Content.Headers.ContentDisposition?.FileName?.Trim('"') ?? "installer.exe";
+ return (fileName, fileStream);
+ }
+
+ private HttpResponseMessage Send(HttpRequestMessage request)
+ {
+ if (string.IsNullOrEmpty(_jwtToken))
+ Authorize();
+ request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", _jwtToken);
+ var response = client.Send(request);
+
+ if (response.StatusCode == HttpStatusCode.Unauthorized)
+ {
+ Authorize();
+ request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", _jwtToken);
+ response = client.Send(request);
+ }
+
+ if (response.IsSuccessStatusCode)
+ return response;
+
+ var stream = response.Content.ReadAsStream();
+ var content = new StreamReader(stream).ReadToEnd();
+ if (response.StatusCode == HttpStatusCode.Conflict)
+ {
+ var result = JsonConvert.DeserializeObject(content);
+ throw new Exception($"Failed: {response.StatusCode}! Error Code: {result?.ErrorCode}. Message: {result?.Message}");
+ }
+ throw new Exception($"Failed: {response.StatusCode}! Result: {content}");
+ }
+
+ private T? Get(string url)
+ {
+ var response = Send(new HttpRequestMessage(HttpMethod.Get, url));
+ var stream = response.Content.ReadAsStream();
+ var json = new StreamReader(stream).ReadToEnd();
+ return JsonConvert.DeserializeObject(json);
+ }
+
+ private void Put(string url, T obj)
+ {
+ Send(new HttpRequestMessage(HttpMethod.Put, url)
+ {
+ Content = new StringContent(JsonConvert.SerializeObject(obj), Encoding.UTF8, APP_JSON)
+ });
+ }
+
+ private void Authorize()
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(_credentials.Email) || _credentials.Password.Length == 0)
+ throw new Exception("Email or password is empty! Please do EnterCredentials first!");
+
+ var content = new StringContent(JsonConvert.SerializeObject(new
+ {
+ email = _credentials.Email,
+ password = _credentials.Password
+ }), Encoding.UTF8, APP_JSON);
+ var message = new HttpRequestMessage(HttpMethod.Post, "login") { Content = content };
+ var response = client.Send(message);
+
+ if (!response.IsSuccessStatusCode)
+ throw new Exception($"EnterCredentials failed: {response.StatusCode}");
+
+ var stream = response.Content.ReadAsStream();
+ var json = new StreamReader(stream).ReadToEnd();
+ var result = JsonConvert.DeserializeObject(json);
+
+ if (string.IsNullOrEmpty(result?.Token))
+ throw new Exception("JWT Token not found in response");
+
+ _jwtToken = result.Token;
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e);
+ throw;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Azaion.LoaderUI/BusinessExceptionDto.cs b/Azaion.LoaderUI/BusinessExceptionDto.cs
new file mode 100644
index 0000000..bb9afee
--- /dev/null
+++ b/Azaion.LoaderUI/BusinessExceptionDto.cs
@@ -0,0 +1,7 @@
+namespace Azaion.LoaderUI;
+
+public class BusinessExceptionDto
+{
+ public int ErrorCode { get; set; }
+ public string Message { get; set; } = string.Empty;
+}
\ No newline at end of file
diff --git a/Azaion.LoaderUI/Constants.cs b/Azaion.LoaderUI/Constants.cs
new file mode 100644
index 0000000..6206a1c
--- /dev/null
+++ b/Azaion.LoaderUI/Constants.cs
@@ -0,0 +1,8 @@
+namespace Azaion.LoaderUI;
+
+public static class Constants
+{
+ public const string CONFIG_JSON_FILE = "loaderconfig.json";
+ public const string API_URL = "http://localhost:5219"; //"https://api.azaion.com";
+ public const string AZAION_SUITE_EXE = "Azaion.Suite.exe";
+}
\ No newline at end of file
diff --git a/Azaion.LoaderUI/LoaderConfig.cs b/Azaion.LoaderUI/LoaderConfig.cs
new file mode 100644
index 0000000..169e376
--- /dev/null
+++ b/Azaion.LoaderUI/LoaderConfig.cs
@@ -0,0 +1,6 @@
+namespace Azaion.LoaderUI;
+
+public class DirectoriesConfig
+{
+ public string SuiteInstallerDirectory {get;set;} = null!;
+}
\ No newline at end of file
diff --git a/Azaion.LoaderUI/Login.xaml.cs b/Azaion.LoaderUI/Login.xaml.cs
index 20dd6d7..09fea29 100644
--- a/Azaion.LoaderUI/Login.xaml.cs
+++ b/Azaion.LoaderUI/Login.xaml.cs
@@ -1,29 +1,79 @@
using System.Diagnostics;
+using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
-using Azaion.CommonSecurity.DTO;
+using Microsoft.Extensions.Options;
namespace Azaion.LoaderUI;
public partial class Login
{
- public Login()
+ private readonly IAzaionApi _azaionApi;
+ private readonly DirectoriesConfig _dirConfig;
+
+ public Login(IAzaionApi azaionApi, IOptions directoriesConfig)
{
+ _azaionApi = azaionApi;
+ _dirConfig = directoriesConfig.Value;
InitializeComponent();
}
private void LoginClick(object sender, RoutedEventArgs e)
{
+ var creds = new ApiCredentials(TbEmail.Text, TbPassword.Password);
+ if (!creds.IsValid())
+ return;
+
LoginBtn.Cursor = Cursors.Wait;
Cursor = Cursors.Wait;
- Process.Start("Azaion.Suite.exe", $"-e {TbEmail.Text} -p {TbPassword.Password}");
+
+ _azaionApi.Login(creds);
+
+ if (GetInstallerVer() > GetLocalVer())
+ DownloadAndRunInstaller();
+
+ Process.Start(Constants.AZAION_SUITE_EXE, $"-e {creds.Email} -p {creds.Password}");
Close();
}
+ private void DownloadAndRunInstaller()
+ {
+ var (installerName, stream) = _azaionApi.DownloadInstaller(_dirConfig.SuiteInstallerDirectory);
+ var localFileStream = new FileStream(installerName, FileMode.Create, FileAccess.Write);
+ stream.CopyTo(localFileStream);
+ localFileStream.Close();
+ stream.Close();
+
+ var processInfo = new ProcessStartInfo(installerName)
+ {
+ UseShellExecute = true,
+ Verb = "runas"
+ };
+
+ Process.Start(processInfo);
+ }
+
+ private Version GetInstallerVer()
+ {
+ var installerName = _azaionApi.GetLastInstallerName(_dirConfig.SuiteInstallerDirectory);
+ var version = installerName
+ .Replace("AzaionSuite.Iterative.", "")
+ .Replace(".exe", "");
+ return new Version(version);
+ }
+
+ private Version GetLocalVer()
+ {
+ var localFileInfo = FileVersionInfo.GetVersionInfo(Constants.AZAION_SUITE_EXE);
+ if (string.IsNullOrWhiteSpace(localFileInfo.ProductVersion))
+ throw new Exception($"Can't find {Constants.AZAION_SUITE_EXE} and its version");
+ return new Version(localFileInfo.FileVersion!);
+ }
+
private void CloseClick(object sender, RoutedEventArgs e) => Close();
- private void MainMouseMove(object sende0r, MouseEventArgs e)
+ private void MainMouseMove(object sender, MouseEventArgs e)
{
if (e.OriginalSource is Button || e.OriginalSource is TextBox)
return;
diff --git a/Azaion.LoaderUI/LoginResponse.cs b/Azaion.LoaderUI/LoginResponse.cs
new file mode 100644
index 0000000..9e36fca
--- /dev/null
+++ b/Azaion.LoaderUI/LoginResponse.cs
@@ -0,0 +1,6 @@
+namespace Azaion.LoaderUI;
+
+public class LoginResponse
+{
+ public string Token { get; set; } = null!;
+}
\ No newline at end of file
diff --git a/Azaion.LoaderUI/loaderconfig.json b/Azaion.LoaderUI/loaderconfig.json
new file mode 100644
index 0000000..c77a864
--- /dev/null
+++ b/Azaion.LoaderUI/loaderconfig.json
@@ -0,0 +1,6 @@
+{
+ "DirectoriesConfig":
+ {
+ "SuiteInstallerDirectory": ""
+ }
+}
\ No newline at end of file
diff --git a/Azaion.Suite.sln b/Azaion.Suite.sln
index 179f670..1831e1a 100644
--- a/Azaion.Suite.sln
+++ b/Azaion.Suite.sln
@@ -13,8 +13,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azaion.Common", "Azaion.Com
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azaion.Dataset", "Azaion.Dataset\Azaion.Dataset.csproj", "{01A5CA37-A62E-4EF3-8678-D72CD9525677}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azaion.CommonSecurity", "Azaion.CommonSecurity\Azaion.CommonSecurity.csproj", "{E0C7176D-2E91-4928-B3C1-55CC91C8F77D}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{CF141A48-8002-4006-81CF-6B85AE5B0B5F}"
ProjectSection(SolutionItems) = preProject
build\build_cdn_manager.cmd = build\build_cdn_manager.cmd
@@ -28,6 +26,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{CF141A48
build\publish-full.cmd = build\publish-full.cmd
build\publish.cmd = build\publish.cmd
build\requirements.txt = build\requirements.txt
+ build\upload.cmd = build\upload.cmd
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azaion.LoaderUI", "Azaion.LoaderUI\Azaion.LoaderUI.csproj", "{C96C142E-3ED3-4455-9C22-93A12022B8A9}"
@@ -63,11 +62,6 @@ Global
{01A5CA37-A62E-4EF3-8678-D72CD9525677}.Release|Any CPU.ActiveCfg = Release|Any CPU
{01A5CA37-A62E-4EF3-8678-D72CD9525677}.Release|Any CPU.Build.0 = Release|Any CPU
{01A5CA37-A62E-4EF3-8678-D72CD9525677}.Release|Any CPU.Deploy.0 = Release|Any CPU
- {E0C7176D-2E91-4928-B3C1-55CC91C8F77D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {E0C7176D-2E91-4928-B3C1-55CC91C8F77D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {E0C7176D-2E91-4928-B3C1-55CC91C8F77D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {E0C7176D-2E91-4928-B3C1-55CC91C8F77D}.Release|Any CPU.Build.0 = Release|Any CPU
- {E0C7176D-2E91-4928-B3C1-55CC91C8F77D}.Release|Any CPU.Deploy.0 = Release|Any CPU
{C96C142E-3ED3-4455-9C22-93A12022B8A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C96C142E-3ED3-4455-9C22-93A12022B8A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C96C142E-3ED3-4455-9C22-93A12022B8A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/Azaion.Suite/App.xaml.cs b/Azaion.Suite/App.xaml.cs
index 59b1226..ca9f56e 100644
--- a/Azaion.Suite/App.xaml.cs
+++ b/Azaion.Suite/App.xaml.cs
@@ -11,9 +11,6 @@ using Azaion.Common.DTO.Config;
using Azaion.Common.Events;
using Azaion.Common.Extensions;
using Azaion.Common.Services;
-using Azaion.CommonSecurity;
-using Azaion.CommonSecurity.DTO;
-using Azaion.CommonSecurity.Services;
using Azaion.Dataset;
using CommandLine;
using LibVLCSharp.Shared;
diff --git a/Azaion.Suite/Azaion.Suite.csproj b/Azaion.Suite/Azaion.Suite.csproj
index 6b3baf7..dae6fd6 100644
--- a/Azaion.Suite/Azaion.Suite.csproj
+++ b/Azaion.Suite/Azaion.Suite.csproj
@@ -24,6 +24,7 @@
+
diff --git a/Azaion.Suite/MainSuite.xaml.cs b/Azaion.Suite/MainSuite.xaml.cs
index 6936c9d..80c0be2 100644
--- a/Azaion.Suite/MainSuite.xaml.cs
+++ b/Azaion.Suite/MainSuite.xaml.cs
@@ -8,7 +8,6 @@ using Azaion.Common.DTO;
using Azaion.Common.DTO.Config;
using Azaion.Common.Extensions;
using Azaion.Common.Services;
-using Azaion.CommonSecurity.Services;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using SharpVectors.Converters;
diff --git a/Azaion.Test/GetTilesTest.cs b/Azaion.Test/GetTilesTest.cs
index 09a4bd3..b33a7fc 100644
--- a/Azaion.Test/GetTilesTest.cs
+++ b/Azaion.Test/GetTilesTest.cs
@@ -1,6 +1,6 @@
-using Azaion.Common.DTO.Config;
+using Azaion.Common.DTO;
+using Azaion.Common.DTO.Config;
using Azaion.Common.Services;
-using Azaion.CommonSecurity.DTO;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
diff --git a/build/build_dotnet.cmd b/build/build_dotnet.cmd
index 9119ae1..f83c3f2 100644
--- a/build/build_dotnet.cmd
+++ b/build/build_dotnet.cmd
@@ -3,18 +3,19 @@ set CURRENT_DIR=%cd%
cd /d %~dp0..
cd Azaion.Suite
-dotnet publish -c Release -r win-x64 -p:SatelliteResourceLanguages="en" -p:DebugSymbols=false -p:ForPublish=true --self-contained true
+dotnet publish -c Release -r win-x64 -p:SatelliteResourceLanguages="en" -p:DebugSymbols=false --self-contained true
cd ..\Azaion.LoaderUI
-dotnet publish -c Release -r win-x64 -p:SatelliteResourceLanguages="en" -p:DebugSymbols=false -p:ForPublish=true --self-contained true
+dotnet publish -c Release -r win-x64 -p:SatelliteResourceLanguages="en" -p:DebugSymbols=false --self-contained true
cd ..
xcopy Azaion.Suite\bin\Release\net8.0-windows\win-x64\publish dist\ /s /e /q
del dist\config.json
move dist\config.production.json dist\config.json
-robocopy "dist" "dist-azaion" "Azaion.Annotator.dll" "Azaion.Dataset.dll" "Azaion.Common.dll" "Azaion.CommonSecurity.dll" "Azaion.Suite.dll" "Azaion.Suite.exe" /MOV
-robocopy "dist" "dist-azaion" "Azaion.Suite.runtimeconfig.json" "Azaion.Suite.deps.json" "config.json" "logo.png" /MOV
-robocopy "dist" "dist-azaion" "Azaion.LoaderUI.exe" "Azaion.LoaderUI.runtimeconfig.json" "Azaion.Suite.deps.json" "config.json" "logo.png" /MOV
+robocopy "dist" "dist-azaion" "Azaion.Annotator.dll" "Azaion.Dataset.dll" "Azaion.Common.dll" "Azaion.CommonSecurity.dll" /MOV
+robocopy "dist" "dist-azaion" "Azaion.Suite.dll" "Azaion.Suite.exe" "Azaion.Suite.runtimeconfig.json" "Azaion.Suite.deps.json" "config.json" "logo.png" /MOV
+robocopy "Azaion.LoaderUI\bin\Release\net8.0-windows\win-x64\publish" "dist-dlls" "Azaion.LoaderUI.dll" "Azaion.LoaderUI.exe" "Azaion.LoaderUI.runtimeconfig.json" ^
+ "Azaion.LoaderUI.deps.json" "loaderconfig.json"
if exist dist\libvlc\win-x86 rmdir dist\libvlc\win-x86 /s /q
robocopy "dist" "dist-dlls" /E /MOVE
diff --git a/build/init.cmd b/build/init.cmd
index a62ba52..cb3e2ca 100644
--- a/build/init.cmd
+++ b/build/init.cmd
@@ -1,24 +1,19 @@
-echo Make dirs, copy init dlls
-REM Save the current directory
+@echo off
+echo Make dirs, copy init dlls
set CURRENT_DIR=%cd%
-
-REM Change to the parent directory of the current location
cd /d %~dp0..
-REM Remove and recreate the dist-dlls and dist-azaion directories
if exist dist-dlls rmdir dist-dlls /s /q
mkdir dist-dlls
if exist dist-azaion rmdir dist-azaion /s /q
mkdir dist-azaion
if exist dist rmdir dist /s /q
mkdir dist
+del "AzaionSuite.Iterative.*"
echo Copying shared libs
-REM Copy the shared libs from the source location to dist-dlls
robocopy "C:\\share" "dist-dlls" "*"
-REM Return to the original directory
cd /d %CURRENT_DIR%
-
echo Init script completed.
diff --git a/build/publish-full.cmd b/build/publish-full.cmd
new file mode 100644
index 0000000..315b8c3
--- /dev/null
+++ b/build/publish-full.cmd
@@ -0,0 +1,17 @@
+@echo off
+pushd %~dp0..
+
+call build\init
+
+call build\build_dotnet
+
+call Azaion.Inference\build_inference
+
+call ..\gps-denied\image-matcher\build_gps
+
+call build\download_models
+
+echo building installer...
+iscc build\installer.full.iss
+
+popd
\ No newline at end of file
diff --git a/build/publish.cmd b/build/publish.cmd
index 5c64195..540be11 100644
--- a/build/publish.cmd
+++ b/build/publish.cmd
@@ -1,6 +1,7 @@
-rem
- @echo off
-pushd %~dp0..
+setlocal enabledelayedexpansion
+@echo off
+set CURRENT_DIR=%cd%
+cd /d %~dp0..
call build\init
@@ -17,4 +18,7 @@ call build\download_models
echo building installer...
iscc build\installer.iterative.iss
-popd
\ No newline at end of file
+call build\upload.cmd "suite"
+
+cd /d %CURRENT_DIR%
+echo Done!
\ No newline at end of file
diff --git a/build/upload.cmd b/build/upload.cmd
new file mode 100644
index 0000000..f379be3
--- /dev/null
+++ b/build/upload.cmd
@@ -0,0 +1,43 @@
+setlocal enabledelayedexpansion
+@echo off
+set CURRENT_DIR=%cd%
+cd /d %~dp0..
+
+set API_URL=https://api.azaion.com
+set RESOURCES_FOLDER=%1
+set EMAIL=uploader@azaion.com
+set PASSWORD=Az@1on_10Upl0@der
+
+set "UPLOAD_FILE="
+for /f "delims=" %%i in ('dir /b /a-d "AzaionSuite.Iterative*"') do (
+ if not defined UPLOAD_FILE set "UPLOAD_FILE=%%i"
+)
+
+if not defined UPLOAD_FILE (
+ echo No matching file found.
+ exit /b
+)
+
+echo Logging in and retrieving token...
+for /f "tokens=*" %%i in ('curl -s -X POST -H "Content-Type: application/json" ^
+ -d "{\"email\":\"%EMAIL%\",\"password\":\"%PASSWORD%\"}" %API_URL%/login') do set RESPONSE=%%i
+
+for /f "tokens=2 delims=:" %%a in ('echo %RESPONSE% ^| findstr /i "token"') do (
+ set "TOKEN=%%a"
+ set "TOKEN=!TOKEN:~1,-1!"
+ set "TOKEN=!TOKEN:~0,-2!"
+)
+
+echo clear suite folder
+
+curl -X POST %API_URL%/resources/clear/%RESOURCES_FOLDER% -d {} -H "Authorization: Bearer %TOKEN%"
+
+echo Uploading files to resources...
+
+curl --location %API_URL%/resources/%RESOURCES_FOLDER% ^
+ -H "Authorization: Bearer %TOKEN%" ^
+ -H "Content-Type: multipart/form-data" ^
+ --form "data=@%UPLOAD_FILE%"
+
+cd /d %CURRENT_DIR%
+echo Done!