frame: allow loading local html/css/js files, add sandbox restrictions (#560)
This commit is contained in:
parent
9198ba99f0
commit
65bb430512
3 changed files with 7 additions and 2 deletions
|
|
@ -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')
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue