mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 06:36:31 +00:00
consolidate CommonSecurity to Common.dll
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
||||
<PackageReference Include="CsvHelper" Version="33.0.1" />
|
||||
<PackageReference Include="LazyCache" Version="2.4.0" />
|
||||
<PackageReference Include="linq2db.SQLite" Version="5.4.1" />
|
||||
<PackageReference Include="MediatR" Version="12.5.0" />
|
||||
<PackageReference Include="MessagePack" Version="3.1.0" />
|
||||
@@ -15,17 +17,15 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="9.0.5" />
|
||||
<PackageReference Include="NetMQ" Version="4.0.1.16" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Polly" Version="8.5.2" />
|
||||
<PackageReference Include="RabbitMQ.Stream.Client" Version="1.8.9" />
|
||||
<PackageReference Include="Serilog" Version="4.3.0" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.7" />
|
||||
<PackageReference Include="Stub.System.Data.SQLite.Core.NetStandard" Version="1.0.119" />
|
||||
<PackageReference Include="System.Data.SQLite.Core" Version="1.0.119" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="5.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Azaion.CommonSecurity\Azaion.CommonSecurity.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using CommandLine;
|
||||
using MessagePack;
|
||||
|
||||
namespace Azaion.CommonSecurity.DTO;
|
||||
namespace Azaion.Common.DTO;
|
||||
|
||||
[MessagePackObject]
|
||||
public class ApiCredentials : EventArgs
|
||||
+2
-2
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace Azaion.CommonSecurity.DTO;
|
||||
namespace Azaion.Common.DTO;
|
||||
|
||||
public class DirectoriesConfig
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace Azaion.CommonSecurity.DTO;
|
||||
namespace Azaion.Common.DTO;
|
||||
|
||||
public abstract class ExternalClientConfig
|
||||
{
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace Azaion.CommonSecurity.DTO;
|
||||
namespace Azaion.Common.DTO;
|
||||
|
||||
public static class EnumerableExtensions
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Azaion.CommonSecurity.DTO;
|
||||
namespace Azaion.Common.DTO;
|
||||
|
||||
public class InitConfig
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Azaion.CommonSecurity.DTO;
|
||||
namespace Azaion.Common.DTO;
|
||||
|
||||
public class LoginResponse
|
||||
{
|
||||
@@ -1,5 +1,4 @@
|
||||
using Azaion.Common.Database;
|
||||
using Azaion.CommonSecurity.DTO;
|
||||
|
||||
namespace Azaion.Common.DTO.Queue;
|
||||
using MessagePack;
|
||||
|
||||
+5
-1
@@ -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,
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Azaion.CommonSecurity.DTO;
|
||||
namespace Azaion.Common.DTO;
|
||||
|
||||
public enum RoleEnum
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Azaion.CommonSecurity.DTO;
|
||||
namespace Azaion.Common.DTO;
|
||||
|
||||
public class User
|
||||
{
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -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;
|
||||
|
||||
+5
-3
@@ -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
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using LazyCache;
|
||||
|
||||
namespace Azaion.CommonSecurity.Services;
|
||||
namespace Azaion.Common.Services;
|
||||
|
||||
public interface ICache
|
||||
{
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
+3
-3
@@ -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
|
||||
{
|
||||
@@ -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;
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
||||
<PackageReference Include="LazyCache.AspNetCore" Version="2.4.0" />
|
||||
<PackageReference Include="MediatR" Version="12.5.0" />
|
||||
<PackageReference Include="MessagePack" Version="3.1.0" />
|
||||
<PackageReference Include="MessagePack.Annotations" Version="3.1.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.5" />
|
||||
<PackageReference Include="NetMQ" Version="4.0.1.13" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Serilog" Version="4.2.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -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!;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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(<str> 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(<str>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(<str> 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(<str> folder, big_part)):
|
||||
with open(path.join(<str> 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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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<Login>();
|
||||
services.Configure<DirectoriesConfig>(context.Configuration.GetSection(nameof(DirectoriesConfig)));
|
||||
services.AddHttpClient<IAzaionApi, AzaionApi>((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();
|
||||
|
||||
@@ -8,14 +8,11 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Azaion.CommonSecurity\Azaion.CommonSecurity.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.5" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Serilog.Extensions.Hosting" Version="9.0.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="9.0.1" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="9.0.0" />
|
||||
@@ -23,4 +20,11 @@
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="loaderconfig.json" />
|
||||
<Content Include="loaderconfig.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -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<List<string>>($"/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<BusinessExceptionDto>(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<T>(string url)
|
||||
{
|
||||
var response = Send(new HttpRequestMessage(HttpMethod.Get, url));
|
||||
var stream = response.Content.ReadAsStream();
|
||||
var json = new StreamReader(stream).ReadToEnd();
|
||||
return JsonConvert.DeserializeObject<T>(json);
|
||||
}
|
||||
|
||||
private void Put<T>(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<LoginResponse>(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Azaion.LoaderUI;
|
||||
|
||||
public class BusinessExceptionDto
|
||||
{
|
||||
public int ErrorCode { get; set; }
|
||||
public string Message { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -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";
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Azaion.LoaderUI;
|
||||
|
||||
public class DirectoriesConfig
|
||||
{
|
||||
public string SuiteInstallerDirectory {get;set;} = null!;
|
||||
}
|
||||
@@ -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> 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;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Azaion.LoaderUI;
|
||||
|
||||
public class LoginResponse
|
||||
{
|
||||
public string Token { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"DirectoriesConfig":
|
||||
{
|
||||
"SuiteInstallerDirectory": ""
|
||||
}
|
||||
}
|
||||
+1
-7
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
||||
<PackageReference Include="GMap.NET.WinPresentation" Version="2.1.7" />
|
||||
<PackageReference Include="LazyCache.AspNetCore" Version="2.4.0" />
|
||||
<PackageReference Include="LibVLCSharp" Version="3.9.1" />
|
||||
<PackageReference Include="LibVLCSharp.WPF" Version="3.9.1" />
|
||||
<PackageReference Include="MediatR" Version="12.5.0" />
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
+3
-8
@@ -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.
|
||||
|
||||
@@ -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
|
||||
+8
-4
@@ -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
|
||||
call build\upload.cmd "suite"
|
||||
|
||||
cd /d %CURRENT_DIR%
|
||||
echo Done!
|
||||
@@ -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!
|
||||
Reference in New Issue
Block a user