mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-29 22:41:37 -05:00
refactor: remove duplicated client, geometry and desktop code
Share the nest server client setup and page validation, entity endpoints, post marker checks and the repeated desktop list, cut-time and busy-warning code. Persistence tests use NestArchiveJson. No behavior change intended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
31525ba342
commit
082a50bbcd
25 files changed
+249
-482
No files matched your search
@@ -0,0 +1,24 @@
|
||||
namespace OpenNest.Data;
|
||||
|
||||
/// <summary>The connection every nest server client holds: its HTTP client and the server's base address.</summary>
|
||||
public abstract class NestServerClient : IDisposable
|
||||
{
|
||||
private protected readonly HttpClient _httpClient;
|
||||
private readonly bool _ownsClient;
|
||||
private readonly Uri _baseUri;
|
||||
|
||||
private protected NestServerClient(HttpClient httpClient, string baseUrl, bool ownsClient)
|
||||
{
|
||||
_httpClient = httpClient;
|
||||
_ownsClient = ownsClient;
|
||||
_baseUri = ServerUrl.ParseBase(baseUrl, nameof(baseUrl));
|
||||
}
|
||||
|
||||
private protected Uri Url(string relative) => new(_baseUri, relative);
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_ownsClient)
|
||||
_httpClient.Dispose();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user