diff --git a/scripts/patch-weboffice-collabora-yaml.py b/scripts/patch-weboffice-collabora-yaml.py new file mode 100644 index 0000000..5001434 --- /dev/null +++ b/scripts/patch-weboffice-collabora-yaml.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +from ruamel.yaml import YAML +from pathlib import Path +import sys + +yaml = YAML() +yaml.preserve_quotes = True + +path = Path(sys.argv[1]) + +with path.open("r") as f: + data = yaml.load(f) + +extra = data["services"]["collabora"]["environment"]["extra_params"] + +# normalize to string +extra_str = str(extra) + +if "--o:hexify_embedded_urls=true" in extra_str: + print("[patch-weboffice-collabora-yaml] already patched") + sys.exit(0) + +lines = extra_str.splitlines() + +lines.append(" --o:hexify_embedded_urls=true") + +data["services"]["collabora"]["environment"]["extra_params"] = "\n".join(lines) + +with path.open("w") as f: + yaml.dump(data, f) + +print("[patch-weboffice-collabora-yaml] patched successfully") \ No newline at end of file