mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 15:37:23 +01:00
use provided API vom server
This commit is contained in:
parent
f0531035fc
commit
90ec056a11
5 changed files with 49 additions and 60 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using MareSynchronos.API;
|
||||
using MareSynchronos.Utils;
|
||||
using Microsoft.AspNetCore.SignalR.Client;
|
||||
|
||||
|
|
@ -12,8 +13,8 @@ namespace MareSynchronos.WebAPI
|
|||
{
|
||||
_pluginConfiguration.ClientSecret.Remove(ApiUri);
|
||||
_pluginConfiguration.Save();
|
||||
await _fileHub!.SendAsync("DeleteAllFiles");
|
||||
await _userHub!.SendAsync("DeleteAccount");
|
||||
await _fileHub!.SendAsync(FilesHubAPI.SendDeleteAllFiles);
|
||||
await _userHub!.SendAsync(UserHubAPI.SendDeleteAccount);
|
||||
await CreateConnections();
|
||||
}
|
||||
|
||||
|
|
@ -21,7 +22,7 @@ namespace MareSynchronos.WebAPI
|
|||
{
|
||||
if (!ServerAlive) return;
|
||||
Logger.Debug("Registering at service " + ApiUri);
|
||||
var response = await _userHub!.InvokeAsync<string>("Register");
|
||||
var response = await _userHub!.InvokeAsync<string>(UserHubAPI.InvokeRegister);
|
||||
_pluginConfiguration.ClientSecret[ApiUri] = response;
|
||||
_pluginConfiguration.Save();
|
||||
RegisterFinalized?.Invoke();
|
||||
|
|
@ -30,25 +31,25 @@ namespace MareSynchronos.WebAPI
|
|||
|
||||
public async Task<List<string>> GetOnlineCharacters()
|
||||
{
|
||||
return await _userHub!.InvokeAsync<List<string>>("GetOnlineCharacters");
|
||||
return await _userHub!.InvokeAsync<List<string>>(UserHubAPI.InvokeGetOnlineCharacters);
|
||||
}
|
||||
|
||||
public async Task SendPairedClientAddition(string uid)
|
||||
{
|
||||
if (!IsConnected || SecretKey == "-") return;
|
||||
await _userHub!.SendAsync("SendPairedClientAddition", uid);
|
||||
await _userHub!.SendAsync(UserHubAPI.SendPairedClientAddition, uid);
|
||||
}
|
||||
|
||||
public async Task SendPairedClientPauseChange(string uid, bool paused)
|
||||
{
|
||||
if (!IsConnected || SecretKey == "-") return;
|
||||
await _userHub!.SendAsync("SendPairedClientPauseChange", uid, paused);
|
||||
await _userHub!.SendAsync(UserHubAPI.SendPairedClientPauseChange, uid, paused);
|
||||
}
|
||||
|
||||
public async Task SendPairedClientRemoval(string uid)
|
||||
{
|
||||
if (!IsConnected || SecretKey == "-") return;
|
||||
await _userHub!.SendAsync("SendPairedClientRemoval", uid);
|
||||
await _userHub!.SendAsync(UserHubAPI.SendPairedClientRemoval, uid);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue