frame: allow loading local html/css/js files, add sandbox restrictions (#560)

This commit is contained in:
bordun 2019-09-11 10:34:20 +02:00
parent 0489ea3d4c
commit 563ba6ceb7
3 changed files with 7 additions and 2 deletions

View file

@ -37,7 +37,7 @@ class Frame extends Widget {
constructor(options) {
super({...options, html: html`<div class="frame"><iframe src=""></iframe></div>`})
super({...options, html: html`<div class="frame"><iframe src="" sandbox="allow-scripts"></iframe></div>`})
if (!this.getProp('border')) this.container.classList.add('noborder')

View file

@ -48,7 +48,7 @@ function httpRoute(req, res) {
url = url.replace('_:_', ':') // escaped drive colon
url = url.replace(/^\/([^/]*:)/, '$1') // strip leading slash
if (url.match(/.(jpg|jpeg|png|apng|gif|webp|tiff|xbm|bmp|ico|ttf|otf|woff|woff2)(\?[0-9]*)?$/i)) {
if (url.match(/.(jpg|jpeg|png|apng|gif|webp|tiff|xbm|bmp|ico|ttf|otf|woff|woff2|html|css|js)(\?[0-9]*)?$/i)) {
try {
// relative resolution (session path)
var id = urlparser.parse('?' + req.headers.cookie, true).query.client_id,