Class HttpServerAdmin
The dashboard's view of a server over HTTP: its admin API, through the local admin socket or over the network as a logged-in admin. Only the socket also tells the server's counters and files.
Inheritance
HttpServerAdmin
Assembly: uniform-chat-server.dll
public sealed class HttpServerAdmin : IServerAdmin, IAsyncDisposable
Properties
|
Edit this page
View Source
Whether this goes through the local admin socket, which sees the server's files, rather than the network.
Declaration
public bool IsSocket { get; }
Property Value
Methods
|
Edit this page
View Source
Apply or save changes of the server's settings, action apply or save; return the settings after; through the socket only.
Declaration
public Task<JsonObject> ChangeSettingsAsync(string action, IReadOnlyDictionary<string, string?> changes, CancellationToken cancellationToken)
Parameters
Returns
Exceptions
| Type |
Condition |
| IOException |
When the server refuses, e.g. an unknown option or an invalid value, which the message tells.
|
|
Edit this page
View Source
Connect to the admin socket at path and read the server's name.
Declaration
public static Task<HttpServerAdmin> ConnectSocketAsync(string path, CancellationToken cancellationToken)
Parameters
Returns
Exceptions
|
Edit this page
View Source
Create the account, refusing one that exists, as the admin API would change it instead.
Declaration
public Task<string> CreateUserAsync(string name, string password, bool admin, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Declaration
public Task DeleteReportAsync(long reportId, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Log out of a network session, so no access token is left behind; then close the connection.
Declaration
public ValueTask DisposeAsync()
Returns
|
Edit this page
View Source
Return the reports, page by page, without resolved ones unless asked.
Declaration
public Task<IReadOnlyList<Report>> GetReportsAsync(bool includeResolved, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return every room, page by page.
Declaration
public Task<IReadOnlyList<AdminRoom>> GetRoomsAsync(CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return the server's settings file, and each option's value and source; through the socket only.
Declaration
public Task<JsonObject> GetSettingsAsync(CancellationToken cancellationToken)
Parameters
Returns
Exceptions
| Type |
Condition |
| IOException |
When the server refuses, e.g. without a settings file.
|
|
Edit this page
View Source
Return the counters, addresses and files from the socket; over the network only the name and address.
Declaration
public Task<ServerSnapshot> GetSnapshotAsync(CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Return every local account, page by page.
Declaration
public Task<IReadOnlyList<AdminUser>> GetUsersAsync(CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Log in at homeserver as user, who must be a server admin.
Declaration
public static Task<HttpServerAdmin> LoginAsync(Uri homeserver, string user, string password, CancellationToken cancellationToken)
Parameters
Returns
Exceptions
| Type |
Condition |
| MatrixException |
When the login fails, or the user is not a server admin; the session is then logged out.
|
|
Edit this page
View Source
Set a new password, logging out every device of the account.
Declaration
public Task ResetPasswordAsync(string userId, string password, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Give or take server admin rights.
Declaration
public Task SetAdminAsync(string userId, bool admin, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Deactivate an account, or reactivate it.
Declaration
public Task SetDeactivatedAsync(string userId, bool deactivated, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Lock an account, or unlock it.
Declaration
public Task SetLockedAsync(string userId, bool locked, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
List a room in the public room directory, or take it out.
Declaration
public Task SetPublishedAsync(string roomId, bool published, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Resolve a report, or open it again.
Declaration
public Task SetResolvedAsync(long reportId, bool resolved, CancellationToken cancellationToken)
Parameters
Returns
|
Edit this page
View Source
Suspend an account, or end its suspension.
Declaration
public Task SetSuspendedAsync(string userId, bool suspended, CancellationToken cancellationToken)
Parameters
Returns
Implements