};
- pruneParams(currentSchema.value);
+ draft.params = toEditableParams(currentSchema.value, { ...(result.params ?? {}) });
} catch (err: any) {
os.alert({ type: 'error', text: err.message ?? String(err) });
} finally {
diff --git a/packages/frontend/src/pages/admin/mrf-policies.reference.vue b/packages/frontend/src/pages/admin/mrf-policies.reference.vue
new file mode 100644
index 0000000000..528b345ad4
--- /dev/null
+++ b/packages/frontend/src/pages/admin/mrf-policies.reference.vue
@@ -0,0 +1,186 @@
+
+
+
+
+
+
{{ i18n.ts._mrfPolicies._reference.contract }}
+
+
+
+
+ {{ group.title }}
+ {{ group.note }}
+
+
+
+ {{ row.sig }} |
+ {{ row.desc }} |
+
+
+
+
+
+
+
{{ i18n.ts._mrfPolicies._reference.example }}
+
+
+
+
{{ i18n.ts._mrfPolicies._reference.sandboxNote }}
+
+
+
+
+
+
diff --git a/packages/frontend/src/pages/admin/mrf-policies.vue b/packages/frontend/src/pages/admin/mrf-policies.vue
index 7b48ec19ca..e5aeda0966 100644
--- a/packages/frontend/src/pages/admin/mrf-policies.vue
+++ b/packages/frontend/src/pages/admin/mrf-policies.vue
@@ -9,6 +9,12 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts._mrfPolicies.description }}
+
+
+ {{ i18n.ts._mrfPolicies.reference }}
+
+
+
@@ -32,6 +38,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { ref, computed } from 'vue';
import * as Misskey from 'misskey-js';
import XPolicy from './mrf-policies.policy.vue';
+import XReference from './mrf-policies.reference.vue';
import MkFolder from '@/components/MkFolder.vue';
import MkInfo from '@/components/MkInfo.vue';
import * as os from '@/os.js';
diff --git a/sharkey-locales/en-US.yml b/sharkey-locales/en-US.yml
index 101310bce4..460c4954cb 100644
--- a/sharkey-locales/en-US.yml
+++ b/sharkey-locales/en-US.yml
@@ -386,6 +386,48 @@ _mrfPolicies:
invalidActivityJson: "The activity field does not contain valid JSON."
deleteConfirm: "Delete the MRF policy \"{name}\"?"
newPolicyName: "New policy"
+ commaSeparated: "Comma-separated."
+ reference: "Syntax reference"
+ _reference:
+ contract: "Every policy must define a global filter(ctx) function that returns a decision. An optional policy table declares configurable parameters."
+ example: "Example"
+ sandboxNote: "Runs in a sandboxed Lua 5.4 VM. os, io, package, require, load and debug are unavailable. Define helpers as local; extra globals trigger persistence warnings. Execution is bounded by the policy timeout."
+ contextTitle: "Context (ctx)"
+ contextNote: "The context passed to filter(ctx)."
+ ctxActivity: "The raw ActivityPub activity as a table (mutate this for rewrites)."
+ ctxActorUri: "URI of the activity's actor."
+ ctxActorHost: "Host of the actor, or nil for local."
+ ctxFollowers: "Actor follower count, if known."
+ ctxFollowing: "Actor following count, if known."
+ ctxLocalHost: "This instance's host."
+ ctxSignerHost: "Host that signed the request."
+ ctxReceivedAt: "ISO timestamp of when the activity was received."
+ ctxParams: "Configured parameter values, with schema defaults applied."
+ decisionsTitle: "Decisions"
+ decAccept: "Accept the activity unchanged. Optional reason."
+ decReject: "Reject the activity. Requires a non-empty reason (logged)."
+ decRewrite: "Accept a modified activity. Must be JSON-serializable."
+ activityTitle: "Activity helpers"
+ actType: "Activity type string (e.g. Create, Announce), or nil."
+ actObject: "The activity's object, or nil."
+ actActorUri: "Actor URI whether actor is a string or object, or nil."
+ actNote: "The Note object if this is a Create of a Note, else nil."
+ noteTitle: "Note helpers"
+ noteContent: "The note's content string, or nil."
+ noteMentions: "Array of Mention tags on the note."
+ noteMentionCount: "Number of mentions on the note."
+ noteRemoveMentions: "Remove all Mention tags; returns the note."
+ noteMarkSensitive: "Mark the note sensitive; sets summary to reason if unset."
+ noteUnlist: "Move Public from 'to' into 'cc' (unlists the note)."
+ noteHasMedia: "True if the note has at least one attachment."
+ lookupTitle: "Lookups"
+ lookupSectionNote: "Query the local database. These are async and their latency counts against the policy timeout."
+ lookupUserUri: "Fetch a known user by URI, or nil."
+ lookupUserMention: "Fetch a known user by mention tag or acct string, or nil."
+ lookupInstance: "Fetch instance metadata by host, or nil."
+ lookupNoteUri: "Fetch a known note by URI, or nil."
+ miscTitle: "Utilities"
+ miscIsNil: "True if the value is Lua nil or a JSON null."
_moderationLogTypes:
approve: "Approved"
decline: "Declined"