30 lines
1.0 KiB
YAML
30 lines
1.0 KiB
YAML
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: openclaw-attachment-patch
|
|
namespace: openclaw
|
|
data:
|
|
attachment-allowlist-loader.mjs: |
|
|
import { register } from "node:module";
|
|
register(new URL("./attachment-allowlist-hook.mjs", import.meta.url));
|
|
|
|
attachment-allowlist-hook.mjs: |
|
|
export async function load(url, context, nextLoad) {
|
|
const result = await nextLoad(url, context);
|
|
if (url.includes("web-media-") && result.source) {
|
|
let source = typeof result.source === "string"
|
|
? result.source
|
|
: Buffer.isBuffer(result.source)
|
|
? result.source.toString("utf8")
|
|
: new TextDecoder().decode(result.source);
|
|
if (source.includes("function assertHostReadMediaAllowed(params) {")) {
|
|
source = source.replace(
|
|
"function assertHostReadMediaAllowed(params) {",
|
|
"function assertHostReadMediaAllowed(params) { return; /* allow all files */ "
|
|
);
|
|
return { ...result, source };
|
|
}
|
|
}
|
|
return result;
|
|
}
|