import {
resolveAllowlistMatchByCandidates,
type AllowlistMatch,
} from "openclaw/plugin-sdk/allow-from"; import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime"; import { normalizeStringEntries } from "openclaw/plugin-sdk/string-normalization-runtime";
function normalizeAllowList(list?: Array<string | number>) { return normalizeStringEntries(list);
}
function normalizeMatrixUser(raw?: string | null): string { const value = (raw ?? "").trim(); if (!value) { return"";
} if (!value.startsWith("@") || !value.includes(":")) { return normalizeLowercaseStringOrEmpty(value);
} const withoutAt = value.slice(1); const splitIndex = withoutAt.indexOf(":"); if (splitIndex === -1) { return normalizeLowercaseStringOrEmpty(value);
} const localpart = normalizeLowercaseStringOrEmpty(withoutAt.slice(0, splitIndex)); const server = normalizeLowercaseStringOrEmpty(withoutAt.slice(splitIndex + 1)); if (!server) { return normalizeLowercaseStringOrEmpty(value);
} return `@${localpart}:${server}`;
}
export function normalizeMatrixUserId(raw?: string | null): string { const trimmed = (raw ?? "").trim(); if (!trimmed) { return"";
} const lowered = normalizeLowercaseStringOrEmpty(trimmed); if (lowered.startsWith("matrix:")) { return normalizeMatrixUser(trimmed.slice("matrix:".length));
} if (lowered.startsWith("user:")) { return normalizeMatrixUser(trimmed.slice("user:".length));
} return normalizeMatrixUser(trimmed);
}
function normalizeMatrixAllowListEntry(raw: string): string { const trimmed = raw.trim(); if (!trimmed) { return"";
} if (trimmed === "*") { return trimmed;
} const lowered = normalizeLowercaseStringOrEmpty(trimmed); if (lowered.startsWith("matrix:")) { return `matrix:${normalizeMatrixUser(trimmed.slice("matrix:".length))}`;
} if (lowered.startsWith("user:")) { return `user:${normalizeMatrixUser(trimmed.slice("user:".length))}`;
} return normalizeMatrixUser(trimmed);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.