Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/panels/app/ha-panel-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { classMap } from "lit/directives/class-map";
import { createRef, ref } from "lit/directives/ref";
import memoizeOne from "memoize-one";
import { fireEvent } from "../../common/dom/fire_event";
import { IFRAME_SANDBOX } from "../../util/iframe";
import { navigate } from "../../common/navigate";
import { computeRouteTail } from "../../common/url/route";
import { nextRender } from "../../common/util/render-status";
Expand Down Expand Up @@ -136,6 +137,8 @@ class HaPanelApp extends LitElement {
})}
title=${this._addon.name}
src=${this._addon.ingress_url!}
.sandbox=${IFRAME_SANDBOX}
allow="microphone; camera; clipboard-write"
Comment thread
silamon marked this conversation as resolved.
@load=${this._checkLoaded}
${ref(this._iframeRef)}
>
Expand Down
4 changes: 2 additions & 2 deletions src/panels/iframe/ha-panel-iframe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ifDefined } from "lit/directives/if-defined";
import "../../layouts/hass-error-screen";
import "../../layouts/hass-subpage";
import type { HomeAssistant, PanelInfo } from "../../types";
import { IFRAME_SANDBOX } from "../../util/iframe";
import { IFRAME_SANDBOX_SAME_ORIGIN } from "../../util/iframe";

@customElement("ha-panel-iframe")
class HaPanelIframe extends LitElement {
Expand Down Expand Up @@ -41,7 +41,7 @@ class HaPanelIframe extends LitElement {
this.panel.title === null ? undefined : this.panel.title
)}
src=${this.panel.config.url}
.sandbox=${IFRAME_SANDBOX}
.sandbox=${IFRAME_SANDBOX_SAME_ORIGIN}
allow="fullscreen"
></iframe>
</hass-subpage>
Expand Down
4 changes: 2 additions & 2 deletions src/panels/lovelace/cards/hui-iframe-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {
LovelaceGridOptions,
} from "../types";
import type { IframeCardConfig } from "./types";
import { IFRAME_SANDBOX } from "../../../util/iframe";
import { IFRAME_SANDBOX_SAME_ORIGIN } from "../../../util/iframe";

@customElement("hui-iframe-card")
export class HuiIframeCard extends LitElement implements LovelaceCard {
Expand Down Expand Up @@ -95,7 +95,7 @@ export class HuiIframeCard extends LitElement implements LovelaceCard {
}
const sandbox_params = this._config.disable_sandbox
? undefined
: `${sandbox_user_params} ${IFRAME_SANDBOX}`;
: `${sandbox_user_params} ${IFRAME_SANDBOX_SAME_ORIGIN}`;

return html`
<ha-card
Expand Down
4 changes: 3 additions & 1 deletion src/util/iframe.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export const IFRAME_SANDBOX =
"allow-forms allow-popups allow-pointer-lock allow-same-origin allow-scripts allow-modals allow-downloads";
"allow-forms allow-popups allow-pointer-lock allow-scripts allow-modals allow-downloads";

export const IFRAME_SANDBOX_SAME_ORIGIN = `${IFRAME_SANDBOX} allow-same-origin`;
Comment thread
silamon marked this conversation as resolved.
Loading