diff --git a/package.json b/package.json index 69a9d680..f053c46f 100644 --- a/package.json +++ b/package.json @@ -63,8 +63,8 @@ "jsdom": "^24.0.0", "matrix-appservice-bridge": "^10.3.1", "matrix-bot-sdk": "npm:@vector-im/matrix-bot-sdk@^0.7.1-element.6", - "matrix-protection-suite": "npm:@gnuxie/matrix-protection-suite@2.7.0", - "matrix-protection-suite-for-matrix-bot-sdk": "npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@2.7.0", + "matrix-protection-suite": "npm:@gnuxie/matrix-protection-suite@2.8.0", + "matrix-protection-suite-for-matrix-bot-sdk": "npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@2.8.0", "pg": "^8.8.0", "yaml": "^2.3.2" }, diff --git a/src/commands/ProtectionsShowCommand.tsx b/src/commands/ProtectionsShowCommand.tsx index 6024cecb..4c4065b2 100644 --- a/src/commands/ProtectionsShowCommand.tsx +++ b/src/commands/ProtectionsShowCommand.tsx @@ -16,6 +16,7 @@ import { CapabilityProviderSet, Protection, ProtectionDescription, + findCompatibleCapabilityProviders, findProtection, } from "matrix-protection-suite"; import { DraupnirInterfaceAdaptor } from "./DraupnirCommandPrerequisites"; @@ -113,8 +114,13 @@ DraupnirInterfaceAdaptor.describeRenderer(DraupnirProtectionsShowCommand, {

Capability provider set

- {renderCapabilityProviderSet( - protectionInfo.activeCapabilityProviderSet + {Object.keys(protectionInfo.activeCapabilityProviderSet).length === + 0 ? ( +

There are no configurable capabilities for this protection.

+ ) : ( + renderCapabilityProviderSet( + protectionInfo.activeCapabilityProviderSet + ) )} ); @@ -125,14 +131,35 @@ function renderCapabilityProvider( name: string, capabilityProvider: CapabilityProviderDescription ): DocumentNode { + const compatibleProviders = findCompatibleCapabilityProviders( + capabilityProvider.interface.name + ); return ( - -

- {name}: interface:{" "} - {capabilityProvider.interface.name} +

+ + capability name: {name}, interface:{" "} + {capabilityProvider.interface.name}, active capability provider: {capabilityProvider.name} -

- +
+ interface description: {capabilityProvider.interface.description} +

+ compatible capability providers for{" "} + {capabilityProvider.interface.name}: +

+ +
); } @@ -144,6 +171,13 @@ function renderCapabilityProviderSet(set: CapabilityProviderSet): DocumentNode {
  • {renderCapabilityProvider(name, provider)}
  • ))} + To change the active capability provider for a protection capability, use + the{" "} + + !draupnir protections capability {"<"}protection name{">"} {"<"} + capability name{">"} {"<"}capability provider name{">"} + {" "} + command.
    ); } diff --git a/yarn.lock b/yarn.lock index 6e7acfc5..87392998 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2593,18 +2593,18 @@ matrix-appservice@^2.0.0: request-promise "^4.2.6" sanitize-html "^2.11.0" -"matrix-protection-suite-for-matrix-bot-sdk@npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@2.7.0": - version "2.7.0" - resolved "https://registry.yarnpkg.com/@gnuxie/matrix-protection-suite-for-matrix-bot-sdk/-/matrix-protection-suite-for-matrix-bot-sdk-2.7.0.tgz#82e3b053033d635ecdceab034c5548640bbe2332" - integrity sha512-Om+2CSojGJFqGnC9S7W9OXfccmI288nH93DACESRBjrlqVUO6mkdNSk789s1UTW5LIqZ3bjiC72F3STDASTdfg== +"matrix-protection-suite-for-matrix-bot-sdk@npm:@gnuxie/matrix-protection-suite-for-matrix-bot-sdk@2.8.0": + version "2.8.0" + resolved "https://registry.yarnpkg.com/@gnuxie/matrix-protection-suite-for-matrix-bot-sdk/-/matrix-protection-suite-for-matrix-bot-sdk-2.8.0.tgz#a493e4ddfcff6c38486d62c14fa5fa7b0ac757f6" + integrity sha512-2J4t/ypFMXUCca7uz8e7Ha2f32jI6uX2mVyFKVI2kXVGUPQJm9aSh1MiOhiHHsG7zWv8erMeeCV2pmz5ms61hA== dependencies: "@gnuxie/typescript-result" "^1.0.0" await-lock "^2.2.2" -"matrix-protection-suite@npm:@gnuxie/matrix-protection-suite@2.7.0": - version "2.7.0" - resolved "https://registry.yarnpkg.com/@gnuxie/matrix-protection-suite/-/matrix-protection-suite-2.7.0.tgz#953f89e3b02fd9b9edb21f0901f1ed22a2f41f48" - integrity sha512-ZTbz5t1Gh0Yxx+9+7EUp51HfBaccTazSpLKNPQDmjgjoVo6PT3da0CfTvGJR11EqLlBMey/D0zV418ajxjixrw== +"matrix-protection-suite@npm:@gnuxie/matrix-protection-suite@2.8.0": + version "2.8.0" + resolved "https://registry.yarnpkg.com/@gnuxie/matrix-protection-suite/-/matrix-protection-suite-2.8.0.tgz#795fee15bbc4c7bc1273e06bff99f776f75fdfb9" + integrity sha512-UEnzkCjlqIXUCEPjqI3BIIxIY3WiOxkNat/lnKYfWpdRtfjYoMZUQngO0JujixFE0ec7d6EuYgtfk6A4skrP3Q== dependencies: "@gnuxie/typescript-result" "^1.0.0" await-lock "^2.2.2"