Compare commits

..

No commits in common. "a70123f778d267e67f5150ddf1ce07d8a48a5f49" and "a72c35b16826bb63d3f3acd78a5f33483c9f302a" have entirely different histories.

15 changed files with 31 additions and 244 deletions

View File

@ -1,7 +1,7 @@
<Project>
<Import Project="dependencies.props" />
<PropertyGroup>
<Version>1.2.3</Version>
<Version>1.1.3</Version>
<Authors>Tudor Stanciu</Authors>
<Company>STA</Company>
<PackageTags>NetworkResurrector</PackageTags>

View File

@ -2,33 +2,26 @@
<ReleaseNotes>
<Note>
<Version>1.0.0</Version>
<Date>2020-11-28 18:15</Date>
<Content>
System initialization
Simple .net core 3.1 console application that serve as an REST API through witch a user can execute wake or shutdown commands on machines from his network.
Has been added Wake on LAN support and "wake" route in the API controller.
</Content>
</Note>
<Note>
<Version>1.0.1</Version>
<Date>2020-11-29 22:14</Date>
<Content>
New functionalities added
Added support for "ping" and "shutdown". Routes with the same names have also been added to the controller.
Has been added "ping" and "shutdown" support. Routes with same names have also been added to the controller.
</Content>
</Note>
<Note>
<Version>1.0.2</Version>
<Date>2020-12-20 23:00</Date>
<Content>
Changes in the system structure
Replaced Swagger and MediatR implementations with inhouse nuget packages.
Integration with Tuitio.
</Content>
</Note>
<Note>
<Version>1.0.3</Version>
<Date>2022-01-03 08:52</Date>
<Content>
Added NetworkResurrector.Agent service
Upgrade all services to net5.0
@ -36,36 +29,8 @@
The system will be able to execute these operations in multiple ways. This is just the first one and all of them are handled by the NetworkResurrector.Api. For example, if the user wants to shutdown a clean Windows machine, he can use the agent and configure the API to call it, but in case of a proxmox machine, the API can be configured to execute a http request directly to the OS with the shutdown action (without the need for the agent).
</Content>
</Note>
<Note>
<Version>1.0.4</Version>
<Date>2022-01-14 01:22</Date>
<Content>
NetworkResurrector.Agent improvements
• Multiple operations were implemented in the agent: Shutdown, Restart, Sleep, LockLogout and Cancel. The "Cancel" action can cancel one of the previously operations programmed with a delay.
• Added NetworkResurrector.Agent.Wrapper nuget package. It provides an easy and efficient method for a developer to connect another system written in .NET to this agent.
</Content>
</Note>
<Note>
<Version>1.0.5</Version>
<Date>2022-01-18 21:43</Date>
<Content>
NetworkResurrector.Server.Wrapper nuget package
• Added NetworkResurrector.Server.Wrapper nuget package. It provides an easy and efficient method for a developer to connect another system written in .NET to NetworkResurrector.Server.
• Added logic where the http headers from the caller's request are automatically passed to the request sent to this server.
</Content>
</Note>
<Note>
<Version>1.0.6</Version>
<Date>2022-06-19 08:18</Date>
<Content>
Implemented Netmash.Infrastructure.DatabaseMigration
• Through this nuget package, support was added for the automatic running of new sql scripts at system startup.
• The current sql scripts have been corrected or updated to meet the migrator rules.
</Content>
</Note>
<Note>
<Version>1.0.7</Version>
<Date>2022-11-30 23:21</Date>
<Content>
Code cleanup and refactoring
• Preparing to make the project open source on my Gitea instance.
@ -75,7 +40,6 @@
</Note>
<Note>
<Version>1.1.0</Version>
<Date>2023-01-29 00:31</Date>
<Content>
Massive improvements
• .NET 6 upgrade
@ -88,7 +52,6 @@
</Note>
<Note>
<Version>1.1.1</Version>
<Date>2023-02-02 19:03</Date>
<Content>
Retouches after the last upgrade
• Nuget packages upgrade
@ -97,68 +60,18 @@
</Note>
<Note>
<Version>1.1.2</Version>
<Date>2023-02-04 11:14</Date>
<Content>
Tuitio latest updates
• Tuitio nuget packages upgrade
• Tuitio configuration changes
• Many frontend developments
• Tuitio client NPM package integration: @flare/tuitio-react-client
• Added license file
• Login with enter key
</Content>
</Note>
<Note>
<Version>1.1.3</Version>
<Date>2023-03-18 02:49</Date>
<Content>
Tuitio latest changes
• Account logout method and the latest changes published by Tuitio were implemented
• Netmash.Security.Authentication.Tuitio nuget package upgrade
</Content>
</Note>
<Note>
<Version>1.2.0</Version>
<Date>2023-03-19 14:56</Date>
<Content>
Massive frontend developments
• Complete UI refactoring
• A complete menu has been added to the application.
• The theme and the switch between dark and light mode have been implemented.
• Axios upgrade.
• The ugly and useless stepper has been removed from the machines page.
</Content>
</Note>
<Note>
<Version>1.2.1</Version>
<Date>2023-03-19 20:11</Date>
<Content>
Frontend developments
• Added sensitive info toggle.
• Apply mask on sensitive information.
• Mask machine logs.
</Content>
</Note>
<Note>
<Version>1.2.2</Version>
<Date>2023-03-19 23:14</Date>
<Content>
Added user profile page
• The data on the page is extracted from the Tuitio token.
</Content>
</Note>
<Note>
<Version>1.2.3</Version>
<Date>2023-03-25 02:26</Date>
<Content>
Important developments in frontend
• Machines view modes
• New menu entries: About, Administration and System
• About page. It contains information about the system and the release notes.
• New methods have been added to the API for reading the system version and release notes.
• Release notes area
• Timeline area
• Settings page redesign
</Content>
</Note>
</ReleaseNotes>

View File

@ -13,7 +13,7 @@
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsPackageVersion)" />
<PackageReference Include="NBB.Messaging.Abstractions" Version="$(NBBPackageVersion)" />
<PackageReference Include="NetworkResurrector.Agent.Wrapper" Version="1.1.0" />
<PackageReference Include="NetworkResurrector.Server.Wrapper" Version="1.1.1" />
<PackageReference Include="NetworkResurrector.Server.Wrapper" Version="1.1.0" />
</ItemGroup>
<ItemGroup>

View File

@ -1,71 +0,0 @@
using MediatR;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
namespace NetworkResurrector.Api.Application.Queries
{
public class GetReleaseNotes
{
public class Query : IRequest<Model[]>
{
public Query() { }
}
public record Model(string Version, DateTime Date, string[] Notes);
public class QueryHandler : IRequestHandler<Query, Model[]>
{
public QueryHandler() { }
public async Task<Model[]> Handle(Query request, CancellationToken cancellationToken)
{
var x = Directory.GetCurrentDirectory();
Console.WriteLine(x);
var releaseNotes = new XmlDocument();
releaseNotes.Load("ReleaseNotes.xml");
var rows = releaseNotes.DocumentElement.SelectNodes("Note");
var result = new List<Model>();
foreach (XmlNode node in rows)
{
var version = node.SelectSingleNode("Version").InnerText;
var date = GetReleaseDateUtc(node.SelectSingleNode("Date").InnerText);
var notes = ParseContent(node.SelectSingleNode("Content").InnerText);
result.Add(new Model(version, date, notes));
}
return await Task.FromResult(result.ToArray());
}
private string[] ParseContent(string text)
{
var lines = text
.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None)
.Where(z => !string.IsNullOrWhiteSpace(z))
.ToArray();
for (int i = 0; i < lines.Count(); i++)
{
lines[i] = lines[i].TrimStart().TrimEnd();
}
return lines;
}
private DateTime GetReleaseDateUtc(string date)
{
var datetime = Convert.ToDateTime(date);
var utcDatetime = TimeZoneInfo.ConvertTimeToUtc(datetime, TimeZoneInfo.Local);
return utcDatetime;
}
}
}
}

View File

@ -1,5 +1,4 @@
using MediatR;
using NetworkResurrector.Server.Wrapper.Services;
using System;
using System.IO;
using System.Reflection;
@ -12,38 +11,15 @@ namespace NetworkResurrector.Api.Application.Queries
{
public class Query : IRequest<Model> { }
public class Model
{
public ServiceVersion Api { get; set; }
public ServiceVersion Server { get; set; }
}
public record ServiceVersion(string Version, DateTime LastReleaseDate);
public record Model(string Version, DateTime LastUpdateDate);
public class QueryHandler : IRequestHandler<Query, Model>
{
private readonly IResurrectorService _resurrectorService;
public QueryHandler(IResurrectorService resurrectorService)
public QueryHandler()
{
_resurrectorService=resurrectorService;
}
public async Task<Model> Handle(Query request, CancellationToken cancellationToken)
{
var serverVersion = await _resurrectorService.GetServiceVersion();
var apiVersion = GetApiVersion();
var result = new Model
{
Api = apiVersion,
Server = new ServiceVersion(serverVersion.Version, serverVersion.LastReleaseDate)
};
return result;
}
private ServiceVersion GetApiVersion()
{
var version = Environment.GetEnvironmentVariable("APP_VERSION");
var appDate = Environment.GetEnvironmentVariable("APP_DATE");
@ -51,14 +27,14 @@ namespace NetworkResurrector.Api.Application.Queries
if (string.IsNullOrEmpty(version))
version = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
if (!DateTime.TryParse(appDate, out var lastReleaseDate))
if (!DateTime.TryParse(appDate, out var lastUpdateDate))
{
var location = Assembly.GetExecutingAssembly().Location;
lastReleaseDate = File.GetLastWriteTime(location);
lastUpdateDate = File.GetLastWriteTime(location);
}
var result = new ServiceVersion(version, lastReleaseDate);
return result;
var result = new Model(version, lastUpdateDate);
return await Task.FromResult(result);
}
}
}

View File

@ -32,12 +32,5 @@ namespace NetworkResurrector.Api.Controllers
var result = await _mediator.Send(query);
return Ok(result);
}
[HttpGet("release-notes")]
public async Task<IActionResult> GetReleaseNotes([FromRoute] GetReleaseNotes.Query query)
{
var result = await _mediator.Send(query);
return Ok(result);
}
}
}

View File

@ -33,8 +33,6 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ARG APP_VERSION=0.0.0.0
ENV APP_VERSION=${APP_VERSION}
ARG APP_DATE="-"
ENV APP_DATE=${APP_DATE}
#Workaround to lower the TLS level in container for old sql server version
RUN sed -i 's/TLSv1.2/TLSv1.0/g' /etc/ssl/openssl.cnf

View File

@ -5,10 +5,6 @@
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<Content Include="..\..\..\ReleaseNotes.xml" Link="ReleaseNotes.xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.4" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="$(MicrosoftExtensionsPackageVersion)" />

View File

@ -1,5 +1,4 @@
using MediatR;
using NetworkResurrector.Server.PublishedLanguage.Dto;
using System;
using System.IO;
using System.Reflection;
@ -10,15 +9,17 @@ namespace NetworkResurrector.Server.Application.Queries
{
public class GetSystemVersion
{
public class Query : IRequest<ServiceVersion> { }
public class Query : IRequest<Model> { }
public class QueryHandler : IRequestHandler<Query, ServiceVersion>
public record Model(string Version, DateTime LastUpdateDate);
public class QueryHandler : IRequestHandler<Query, Model>
{
public QueryHandler()
{
}
public async Task<ServiceVersion> Handle(Query request, CancellationToken cancellationToken)
public async Task<Model> Handle(Query request, CancellationToken cancellationToken)
{
var version = Environment.GetEnvironmentVariable("APP_VERSION");
var appDate = Environment.GetEnvironmentVariable("APP_DATE");
@ -26,13 +27,13 @@ namespace NetworkResurrector.Server.Application.Queries
if (string.IsNullOrEmpty(version))
version = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
if (!DateTime.TryParse(appDate, out var lastReleaseDate))
if (!DateTime.TryParse(appDate, out var lastUpdateDate))
{
var location = Assembly.GetExecutingAssembly().Location;
lastReleaseDate = File.GetLastWriteTime(location);
lastUpdateDate = File.GetLastWriteTime(location);
}
var result = new ServiceVersion(version, lastReleaseDate);
var result = new Model(version, lastUpdateDate);
return await Task.FromResult(result);
}
}

View File

@ -1,6 +0,0 @@
using System;
namespace NetworkResurrector.Server.PublishedLanguage.Dto
{
public record ServiceVersion(string Version, DateTime LastReleaseDate);
}

View File

@ -6,7 +6,7 @@
<RepositoryUrl>https://lab.code-rove.com/gitea/tudor.stanciu/network-resurrector</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<PackageProjectUrl>https://lab.code-rove.com/gitea/tudor.stanciu/network-resurrector</PackageProjectUrl>
<Version>1.1.1</Version>
<Version>1.1.0</Version>
</PropertyGroup>
<ItemGroup>

View File

@ -3,7 +3,6 @@
internal struct ApiRoutes
{
public const string
SystemVersion = "system/version",
Wake = "resurrector/wake",
Ping = "resurrector/ping",
Shutdown = "resurrector/shutdown";

View File

@ -6,7 +6,7 @@
<PackageProjectUrl>https://lab.code-rove.com/gitea/tudor.stanciu/network-resurrector</PackageProjectUrl>
<RepositoryUrl>https://lab.code-rove.com/gitea/tudor.stanciu/network-resurrector</RepositoryUrl>
<RepositoryType>Git</RepositoryType>
<Version>1.1.1</Version>
<Version>1.1.0</Version>
</PropertyGroup>
<ItemGroup>
@ -15,10 +15,7 @@
<PackageReference Include="Microsoft.Extensions.Http" Version="$(MicrosoftExtensionsPackageVersion)" />
<PackageReference Include="Microsoft.Net.Http.Headers" Version="2.2.8" />
<PackageReference Include="Netmash.Extensions.Http" Version="1.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NetworkResurrector.Server.PublishedLanguage\NetworkResurrector.Server.PublishedLanguage.csproj" />
<PackageReference Include="NetworkResurrector.Server.PublishedLanguage" Version="1.1.0" />
</ItemGroup>
</Project>

View File

@ -1,12 +1,10 @@
using NetworkResurrector.Server.PublishedLanguage.Dto;
using NetworkResurrector.Server.PublishedLanguage.Events;
using NetworkResurrector.Server.PublishedLanguage.Events;
using System.Threading.Tasks;
namespace NetworkResurrector.Server.Wrapper.Services
{
public interface IResurrectorService
{
Task<ServiceVersion> GetServiceVersion();
Task<MachineWaked> Wake(string macAddress);
Task<MachinePinged> Ping(string ipAddressOrMachineName);
Task<MachineShutdown> Shutdown(string ipAddressOrMachineName);

View File

@ -1,6 +1,5 @@
using Netmash.Extensions.Http;
using NetworkResurrector.Server.PublishedLanguage.Commands;
using NetworkResurrector.Server.PublishedLanguage.Dto;
using NetworkResurrector.Server.PublishedLanguage.Events;
using NetworkResurrector.Server.Wrapper.Constants;
using NetworkResurrector.Server.Wrapper.Models;
@ -30,12 +29,6 @@ namespace NetworkResurrector.Server.Wrapper.Services
_httpClient = httpClient;
}
public async Task<ServiceVersion> GetServiceVersion()
{
var result = await _httpClient.ExecuteGetRequest<ServiceVersion>(ApiRoutes.SystemVersion);
return result;
}
public async Task<MachineWaked> Wake(string macAddress)
{
var body = new WakeMachine() { MacAddress = macAddress };