mirror of
https://github.com/the-draupnir-project/Draupnir.git
synced 2026-03-30 19:05:39 +00:00
Add Version command to AS mode admin room
This replicates the status command output giving version string data in a convenient format to AS Admins.
This commit is contained in:
@@ -17,10 +17,12 @@ import {
|
||||
AppserviceListUnstartedCommand,
|
||||
AppserviceRestartDraupnirCommand,
|
||||
} from "./ListCommand";
|
||||
import { AppserviceVersionCommand } from "./VersionCommand";
|
||||
|
||||
AppserviceBotCommands.internCommand(AppserviceBotHelpCommand, ["admin", "help"])
|
||||
.internCommand(AppserviceAllowCommand, ["admin", "allow"])
|
||||
.internCommand(AppserviceRemoveCommand, ["admin", "remove"])
|
||||
.internCommand(AppserviceVersionCommand, ["admin", "version"])
|
||||
.internCommand(AppserviceRestartDraupnirCommand, ["admin", "restart"])
|
||||
.internCommand(AppserviceListUnstartedCommand, [
|
||||
"admin",
|
||||
|
||||
48
apps/draupnir/src/appservice/bot/VersionCommand.tsx
Normal file
48
apps/draupnir/src/appservice/bot/VersionCommand.tsx
Normal file
@@ -0,0 +1,48 @@
|
||||
// Copyright 2026 Catalan Lover <catalanlover@protonmail.com>
|
||||
//
|
||||
// SPDX-License-Identifier: AFL-3.0
|
||||
|
||||
import { AppserviceAdaptorContext } from "./AppserviceBotPrerequisite";
|
||||
import { ActionResult, Ok, isError } from "matrix-protection-suite";
|
||||
import {
|
||||
DeadDocumentJSX,
|
||||
describeCommand,
|
||||
} from "@the-draupnir-project/interface-manager";
|
||||
import { AppserviceBotInterfaceAdaptor } from "./AppserviceBotInterfaceAdaptor";
|
||||
import { CURRENT_BRANCH, SOFTWARE_VERSION } from "../../config";
|
||||
|
||||
type AppserviceVersionInfo = {
|
||||
version: string;
|
||||
branch: string;
|
||||
};
|
||||
|
||||
export const AppserviceVersionCommand = describeCommand({
|
||||
summary:
|
||||
"Show Draupnir version and branch information for this appservice deployment.",
|
||||
parameters: [],
|
||||
async executor(
|
||||
_context: AppserviceAdaptorContext
|
||||
): Promise<ActionResult<AppserviceVersionInfo>> {
|
||||
return Ok({
|
||||
version: SOFTWARE_VERSION,
|
||||
branch: CURRENT_BRANCH,
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
AppserviceBotInterfaceAdaptor.describeRenderer(AppserviceVersionCommand, {
|
||||
JSXRenderer(result) {
|
||||
if (isError(result)) {
|
||||
return Ok(undefined);
|
||||
}
|
||||
return Ok(
|
||||
<root>
|
||||
<b>Version: </b>
|
||||
<code>{result.ok.version}</code>
|
||||
<br />
|
||||
<b>Branch: </b>
|
||||
<code>{result.ok.branch}</code>
|
||||
</root>
|
||||
);
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user