blob: c593318f37e451fee0c2310064a3f559f886478a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
using System.Net.Http.Json;
using System.Text.Json;
using MatrixRoomUtils.Core.Extensions;
using MatrixRoomUtils.Core.Interfaces;
namespace MatrixRoomUtils.Core;
public class RemoteHomeServer : IHomeServer {
public RemoteHomeServer(string canonicalHomeServerDomain) {
HomeServerDomain = canonicalHomeServerDomain;
_httpClient = new MatrixHttpClient();
_httpClient.Timeout = TimeSpan.FromSeconds(5);
}
public async Task<RemoteHomeServer> Configure() {
FullHomeServerDomain = await ResolveHomeserverFromWellKnown(HomeServerDomain);
_httpClient.Dispose();
_httpClient = new MatrixHttpClient { BaseAddress = new Uri(FullHomeServerDomain) };
_httpClient.Timeout = TimeSpan.FromSeconds(5);
Console.WriteLine("[RHS] Finished setting up http client");
return this;
}
}
|