Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

style(app): format the widget proxy page

oxoxDev66a41192659f
diff --git a/crates/openhuman-app/assets/widget-proxy.html b/crates/openhuman-app/assets/widget-proxy.html
index e01f1c7dd0..608ec9fff6 100644
--- a/crates/openhuman-app/assets/widget-proxy.html
+++ b/crates/openhuman-app/assets/widget-proxy.html
@@ -25,7 +25,7 @@
<body>
<script>
(function () {
- 'use strict';
+ "use strict";
var host = window.parent;
if (!host || host === window) return;
var inner = null;
@@ -33,42 +33,47 @@
function isRpc(data) {
return (
data !== null &&
- typeof data === 'object' &&
- data.jsonrpc === '2.0' &&
- (typeof data.method === 'string' || 'id' in data)
+ typeof data === "object" &&
+ data.jsonrpc === "2.0" &&
+ (typeof data.method === "string" || "id" in data)
);
}
function mount(html) {
- inner = document.createElement('iframe');
- inner.setAttribute('sandbox', 'allow-scripts allow-forms');
- inner.setAttribute('referrerpolicy', 'no-referrer');
- inner.setAttribute('title', 'widget');
+ inner = document.createElement("iframe");
+ inner.setAttribute("sandbox", "allow-scripts allow-forms");
+ inner.setAttribute("referrerpolicy", "no-referrer");
+ inner.setAttribute("title", "widget");
inner.srcdoc = html;
document.body.appendChild(inner);
}
- window.addEventListener('message', function (event) {
+ window.addEventListener("message", function (event) {
var data = event.data;
if (!isRpc(data)) return;
if (event.source === host) {
- if (data.method === 'ui/notifications/sandbox-resource-ready') {
+ if (data.method === "ui/notifications/sandbox-resource-ready") {
var html = data.params && data.params.html;
- if (inner || typeof html !== 'string') return;
+ if (inner || typeof html !== "string") return;
mount(html);
return;
}
- if (inner && inner.contentWindow) inner.contentWindow.postMessage(data, '*');
+ if (inner && inner.contentWindow)
+ inner.contentWindow.postMessage(data, "*");
return;
}
if (inner && event.source === inner.contentWindow) {
- host.postMessage(data, '*');
+ host.postMessage(data, "*");
}
});
host.postMessage(
- { jsonrpc: '2.0', method: 'ui/notifications/sandbox-proxy-ready', params: {} },
- '*'
+ {
+ jsonrpc: "2.0",
+ method: "ui/notifications/sandbox-proxy-ready",
+ params: {},
+ },
+ "*",
);
})();
</script>
diff --git a/crates/openhuman-app/src/widget_scheme_tests.rs b/crates/openhuman-app/src/widget_scheme_tests.rs
index c7f3429188..29242ff3b3 100644
--- a/crates/openhuman-app/src/widget_scheme_tests.rs
+++ b/crates/openhuman-app/src/widget_scheme_tests.rs
@@ -77,9 +77,9 @@ fn widget_frame_cannot_be_navigated_to_a_remote_page() {
#[test]
fn proxy_sandbox_grants_no_navigation_or_popups() {
let sandbox = PROXY_HTML
- .split("setAttribute('sandbox', '")
+ .split("setAttribute(\"sandbox\", \"")
.nth(1)
- .and_then(|rest| rest.split('\'').next())
+ .and_then(|rest| rest.split('"').next())
.unwrap();
assert_eq!(sandbox, "allow-scripts allow-forms");
assert!(!PROXY_HTML.contains("allow-same-origin"));