Skip to content

Commit

Permalink
Version 0.15.9 (#2220)
Browse files Browse the repository at this point in the history
* fix: iframes javascript content (#2218)

* config: update version (#2219)
  • Loading branch information
manuel-rw authored Dec 8, 2024
1 parent 8e962ab commit 0a31b0f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homarr",
"version": "0.15.8",
"version": "0.15.9",
"description": "Homarr - A homepage for your server.",
"license": "MIT",
"repository": {
Expand Down Expand Up @@ -244,4 +244,4 @@
]
}
}
}
}
6 changes: 3 additions & 3 deletions public/locales/en/widgets/error-boundary.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
}
},
"modal": {
"text": "",
"label": "Your error",
"reportButton": "Report this error"
"text": "The widet crashed unexpectitly. Please read the documentation and fix any typos.",
"label": "Occurred error",
"reportButton": "Report this error on GitHub"
}
}
17 changes: 15 additions & 2 deletions src/widgets/iframe/IFrameTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ import { useTranslation } from 'next-i18next';
import { defineWidget } from '../helper';
import { IWidget } from '../widgets';

function sanitizeUrl(url: string) {
let parsedUrl: URL;
try {
parsedUrl = new URL(url);
} catch (e) {
return 'about:blank';
}
if (['http:', 'https:'].includes(parsedUrl.protocol)) {
return parsedUrl.href;
} else {
throw new Error(`Protocol '${parsedUrl.protocol}' is not supported. Use HTTP or HTTPS.`);
}
}

const definition = defineWidget({
id: 'iframe',
icon: IconBrowser,
Expand Down Expand Up @@ -116,9 +130,8 @@ function IFrameTile({ widget }: IFrameTileProps) {
return (
<Container h="100%" w="100%" maw="initial" mah="initial" p={0}>
<iframe
sandbox="" // Disables js execution see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#sandbox
className={classes.iframe}
src={widget.properties.embedUrl}
src={sanitizeUrl(widget.properties.embedUrl)}
title="widget iframe"
allow={allowedPermissions.join(' ')}
>
Expand Down

0 comments on commit 0a31b0f

Please sign in to comment.