File tree 2 files changed +37
-0
lines changed
2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 4
4
const params = Object . fromEntries ( new URLSearchParams ( window . location . search ) . entries ( ) ) ;
5
5
const url = new URL ( params . url ) ;
6
6
7
+ const allow = [
8
+ 'accelerometer' ,
9
+ 'bluetooth' ,
10
+ 'camera' ,
11
+ 'encrypted-media' ,
12
+ 'display-capture' ,
13
+ 'geolocation' ,
14
+ 'gyroscope' ,
15
+ 'microphone' ,
16
+ 'midi' ,
17
+ 'clipboard-read' ,
18
+ 'clipboard-write' ,
19
+ 'web-share' ,
20
+ 'serial' ,
21
+ 'xr-spatial-tracking' ,
22
+ ] . map ( v => `${ v } *` ) . join ( '; ' ) ;
23
+
7
24
let iframe ;
8
25
9
26
async function startServiceWorker ( ) {
@@ -144,6 +161,7 @@ iframe {
144
161
function insertInBlob ( mainHTML , mainJS , mainCSS ) {
145
162
applyCSSToSelfToRunContentInIFrame ( ) ;
146
163
const iframe = document . createElement ( 'iframe' ) ;
164
+ iframe . allow = allow ;
147
165
const html = makePageHTML ( mainHTML , mainJS , mainCSS ) ;
148
166
registerSections ( html ) ;
149
167
const blob = new Blob ( [ html ] , { type : 'text/html' } ) ;
@@ -155,6 +173,7 @@ iframe {
155
173
function insertInServiceWorker ( mainHTML , mainJS , mainCSS ) {
156
174
applyCSSToSelfToRunContentInIFrame ( ) ;
157
175
const iframe = document . createElement ( 'iframe' ) ;
176
+ iframe . allow = "accelerometer *; bluetooth *; camera *; encrypted-media *; display-capture *; geolocation *; gyroscope *; microphone *; midi *; clipboard-read *; clipboard-write *; web-share *; serial *; xr-spatial-tracking *"
158
177
const html = makePageHTML ( mainHTML , mainJS , mainCSS ) ;
159
178
registerSections ( html ) ;
160
179
cacheFile ( '/user-jsgist.html' , 'text/html' , html ) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,23 @@ import ServiceContext from '../ServiceContext.js';
5
5
import { createURL } from '../libs/url.js' ;
6
6
import * as winMsgMgr from '../libs/WindowMessageManager' ;
7
7
8
+ const allow = [
9
+ 'accelerometer' ,
10
+ 'bluetooth' ,
11
+ 'camera' ,
12
+ 'encrypted-media' ,
13
+ 'display-capture' ,
14
+ 'geolocation' ,
15
+ 'gyroscope' ,
16
+ 'microphone' ,
17
+ 'midi' ,
18
+ 'clipboard-read' ,
19
+ 'clipboard-write' ,
20
+ 'web-share' ,
21
+ 'serial' ,
22
+ 'xr-spatial-tracking' ,
23
+ ] . map ( v => `${ v } *` ) . join ( '; ' ) ;
24
+
8
25
export default class Runner extends React . Component {
9
26
constructor ( props ) {
10
27
super ( props ) ;
@@ -45,6 +62,7 @@ export default class Runner extends React.Component {
45
62
this . data = data ;
46
63
this . removeIFrame ( ) ;
47
64
const iframe = document . createElement ( 'iframe' ) ;
65
+ iframe . allow = allow ;
48
66
this . iframe = iframe ;
49
67
iframe . src = isDevelopment
50
68
? createURL ( `http://${ window . location . hostname } :8081/runner-03.html` , { url : `http://${ window . location . hostname } :8080/jsgist-runner.js` , ...extra } )
You can’t perform that action at this time.
0 commit comments