6
6
* is used for development mode where the JS is in separate
7
7
* files and the mxClient.js loads other files.
8
8
*/
9
- if ( ! mxIsElectron && location . protocol !== 'http:' )
10
- {
11
- ( function ( )
12
- {
13
- var hashes = 'default-src \'self\'; ' +
14
- // storage.googleapis.com is needed for workbox-service-worker
15
- 'script-src %script-src% \'self\' https://viewer.diagrams.net https://storage.googleapis.com ' +
16
- 'https://apis.google.com https://*.pusher.com ' +
17
- // Below are the SHAs of the two script blocks in index.html.
18
- // These must be updated here and in the CDN after changes.
19
- //----------------------------------------------------------//
20
- //------------- Bootstrap script in index.html -------------//
21
- //----------------------------------------------------------//
22
- // Version 16.4.4
23
- '\'sha256-AVuOIxynOo/05KDLjyp0AoBE+Gt/KE1/vh2pS+yfqes=\' ' +
24
- // Version 15.8.3
25
- '\'sha256-r/ILW7KMSJxeo9EYqCTzZyCT0PZ9gHN1BLgki7vpR+A=\' ' +
26
- // Version 14.6.5
27
- '\'sha256-5DtSB5mj34lxcEf+HFWbBLEF49xxJaKnWGDWa/utwQA=\' ' +
28
- //---------------------------------------------------------//
29
- //------------- App.main script in index.html -------------//
30
- //---------------------------------------------------------//
31
- // Version 13.8.2
32
- '\'sha256-vS/MxlVD7nbY7AnV+0t1Ap338uF7vrcs7y23KjERhKc=\' ' +
33
- //---------------------------------------------------------//
34
- '; ' ;
9
+ // if (!mxIsElectron && location.protocol !== 'http:')
10
+ // {
11
+ // (function()
12
+ // {
13
+ // var hashes = 'default-src \'self\'; ' +
14
+ // // storage.googleapis.com is needed for workbox-service-worker
15
+ // 'script-src %script-src% \'self\' https://viewer.diagrams.net https://storage.googleapis.com ' +
16
+ // 'https://apis.google.com https://*.pusher.com ' +
17
+ // // Below are the SHAs of the two script blocks in index.html.
18
+ // // These must be updated here and in the CDN after changes.
19
+ // //----------------------------------------------------------//
20
+ // //------------- Bootstrap script in index.html -------------//
21
+ // //----------------------------------------------------------//
22
+ // // Version 16.4.4
23
+ // '\'sha256-AVuOIxynOo/05KDLjyp0AoBE+Gt/KE1/vh2pS+yfqes=\' ' +
24
+ // // Version 15.8.3
25
+ // '\'sha256-r/ILW7KMSJxeo9EYqCTzZyCT0PZ9gHN1BLgki7vpR+A=\' ' +
26
+ // // Version 14.6.5
27
+ // '\'sha256-5DtSB5mj34lxcEf+HFWbBLEF49xxJaKnWGDWa/utwQA=\' ' +
28
+ // //---------------------------------------------------------//
29
+ // //------------- App.main script in index.html -------------//
30
+ // //---------------------------------------------------------//
31
+ // // Version 13.8.2
32
+ // '\'sha256-vS/MxlVD7nbY7AnV+0t1Ap338uF7vrcs7y23KjERhKc=\' ' +
33
+ // //---------------------------------------------------------//
34
+ // '; ';
35
35
36
- var styleHashes = '\'sha256-JjkxVHHCCVO0nllPD6hU8bBYSlsikA8TM/o3fhr0bas=\' ' + // index.html
37
- '\'sha256-1F7QEyp3oiW4n2eXlhilLpu+H5Wdj4t90pKtEyK/mFE=\' ' + // Minimal.js/Light
38
- '\'sha256-V8wOMdVocmGIO0DHZHJsKN6viAFJOJRbsJ7UhdJlmng=\' ' + // Minimal.js/Dark
39
- '\'sha256-7kY8ozVqKLIIBwZ24dhdmZkM26PsOlZmEi72RhmZKoM=\' ' + // mxTooltipHandler.js
40
- '\'sha256-01chdey79TzZe4ihnvvUXXI5y8MklIcKH+vzDdQvsuU=\' ' + // Editor.js/mathJaxWebkitCss
41
- '\'sha256-fGbXK7EYpvNRPca81zPnqJHi2y+34KSgAcZv8mhaSzI=\' ' + // MathJax.js
42
- '\'sha256-3hENQqEWUBxdkmJp2kQ2+G0F8NVGzFAVkW5vWDo7ONk=\' ' + // MathJax.js
43
- '\'sha256-Z4u/cxrZPHjN20CIXZHTKr+VlqVxrWG8cbbeC2zmPqI=\' ' + // MathJax.js
44
- '\'sha256-LDMABiyg2T48kuAV9ouqNCSEqf2OkUdlZK9D9CeZHBs=\' ' + // MathJax.js
45
- '\'sha256-XQfwbaSNgLzro3IzkwT0uZLAiBvZzajo0QZx7oW158E=\' ' + // MathJax.js
46
- '\'sha256-++XCePvZXKdegIqkwtbudr16Jx87KFh4t/t7UxsbHpw=\' ' + // MathJax.js
47
- '\'sha256-v9NOL6IswMbY7zpRZjxkYujhuGRVvZtp1c1MfdnToB4=\' ' + // MathJax.js
48
- '\'sha256-5xtuTr9UuyJoTQ76CNLzvSJjS7onwfq73B2rLWCl3aE=\' ' + // MathJax.js
49
- '\'sha256-W21B506Ri8aGW3T87iawssPz71NvvbYZfBfzDbBSArU=\' ' + // MathJax.js
50
- '\'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=\' ' + // spin.min.js
51
- '\'sha256-nzHi23DROym7G011m6y0DyDd9mvQL2hSJ0Gy3g2T/5Q=\' ' + // dropins.js
52
- '\'sha256-76P1PZLzT12kfw2hkrLn5vu/cWZgcOYuSYU3RT3rXKA=\' ' + // gapi
53
- '\'unsafe-hashes\'; ' ; // Required for hashes for style attribute
36
+ // var styleHashes = '\'sha256-JjkxVHHCCVO0nllPD6hU8bBYSlsikA8TM/o3fhr0bas=\' ' + // index.html
37
+ // '\'sha256-1F7QEyp3oiW4n2eXlhilLpu+H5Wdj4t90pKtEyK/mFE=\' ' + // Minimal.js/Light
38
+ // '\'sha256-V8wOMdVocmGIO0DHZHJsKN6viAFJOJRbsJ7UhdJlmng=\' ' + // Minimal.js/Dark
39
+ // '\'sha256-7kY8ozVqKLIIBwZ24dhdmZkM26PsOlZmEi72RhmZKoM=\' ' + // mxTooltipHandler.js
40
+ // '\'sha256-01chdey79TzZe4ihnvvUXXI5y8MklIcKH+vzDdQvsuU=\' ' + // Editor.js/mathJaxWebkitCss
41
+ // '\'sha256-fGbXK7EYpvNRPca81zPnqJHi2y+34KSgAcZv8mhaSzI=\' ' + // MathJax.js
42
+ // '\'sha256-3hENQqEWUBxdkmJp2kQ2+G0F8NVGzFAVkW5vWDo7ONk=\' ' + // MathJax.js
43
+ // '\'sha256-Z4u/cxrZPHjN20CIXZHTKr+VlqVxrWG8cbbeC2zmPqI=\' ' + // MathJax.js
44
+ // '\'sha256-LDMABiyg2T48kuAV9ouqNCSEqf2OkUdlZK9D9CeZHBs=\' ' + // MathJax.js
45
+ // '\'sha256-XQfwbaSNgLzro3IzkwT0uZLAiBvZzajo0QZx7oW158E=\' ' + // MathJax.js
46
+ // '\'sha256-++XCePvZXKdegIqkwtbudr16Jx87KFh4t/t7UxsbHpw=\' ' + // MathJax.js
47
+ // '\'sha256-v9NOL6IswMbY7zpRZjxkYujhuGRVvZtp1c1MfdnToB4=\' ' + // MathJax.js
48
+ // '\'sha256-5xtuTr9UuyJoTQ76CNLzvSJjS7onwfq73B2rLWCl3aE=\' ' + // MathJax.js
49
+ // '\'sha256-W21B506Ri8aGW3T87iawssPz71NvvbYZfBfzDbBSArU=\' ' + // MathJax.js
50
+ // '\'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=\' ' + // spin.min.js
51
+ // '\'sha256-nzHi23DROym7G011m6y0DyDd9mvQL2hSJ0Gy3g2T/5Q=\' ' + // dropins.js
52
+ // '\'sha256-76P1PZLzT12kfw2hkrLn5vu/cWZgcOYuSYU3RT3rXKA=\' ' + // gapi
53
+ // '\'unsafe-hashes\'; '; // Required for hashes for style attribute
54
54
55
- var directives = 'connect-src %connect-src% \'self\' https://*.draw.io https://*.diagrams.net ' +
56
- 'https://*.googleapis.com wss://p2p-collab-test.jgraph.workers.dev wss://*.pusher.com https://*.pusher.com ' +
57
- 'https://api.github.com https://raw.githubusercontent.com https://gitlab.com ' +
58
- 'https://graph.microsoft.com https://*.sharepoint.com https://*.1drv.com https://api.onedrive.com ' +
59
- 'https://dl.dropboxusercontent.com ' +
60
- 'https://*.google.com https://fonts.gstatic.com https://fonts.googleapis.com; ' +
61
- // font-src about: is required for MathJax HTML-CSS output with STIX
62
- 'img-src * data: blob:; media-src * data:; font-src * about:; ' +
63
- // www.draw.io required for browser data migration to app.diagrams.net and
64
- // viewer.diagrams.net required for iframe embed preview
65
- 'frame-src %frame-src% \'self\' https://viewer.diagrams.net https://www.draw.io https://*.google.com; ' +
66
- 'style-src %style-src% \'self\' https://fonts.googleapis.com ' +
67
- // Replaces unsafe-inline style-src with hashes with safe-style-src URL parameter
68
- ( ( urlParams [ 'safe-style-src' ] == '1' ) ? styleHashes : '\'unsafe-inline\'; ' ) +
69
- 'base-uri \'none\';' +
70
- 'child-src \'self\';' +
71
- 'object-src \'none\';' ;
55
+ // var directives = 'connect-src %connect-src% \'self\' https://*.draw.io https://*.diagrams.net ' +
56
+ // 'https://*.googleapis.com wss://p2p-collab-test.jgraph.workers.dev wss://*.pusher.com https://*.pusher.com ' +
57
+ // 'https://api.github.com https://raw.githubusercontent.com https://gitlab.com ' +
58
+ // 'https://graph.microsoft.com https://*.sharepoint.com https://*.1drv.com https://api.onedrive.com ' +
59
+ // 'https://dl.dropboxusercontent.com ' +
60
+ // 'https://*.google.com https://fonts.gstatic.com https://fonts.googleapis.com; ' +
61
+ // // font-src about: is required for MathJax HTML-CSS output with STIX
62
+ // 'img-src * data: blob:; media-src * data:; font-src * about:; ' +
63
+ // // www.draw.io required for browser data migration to app.diagrams.net and
64
+ // // viewer.diagrams.net required for iframe embed preview
65
+ // 'frame-src %frame-src% \'self\' https://viewer.diagrams.net https://www.draw.io https://*.google.com; ' +
66
+ // 'style-src %style-src% \'self\' https://fonts.googleapis.com ' +
67
+ // // Replaces unsafe-inline style-src with hashes with safe-style-src URL parameter
68
+ // ((urlParams['safe-style-src'] == '1') ? styleHashes : '\'unsafe-inline\'; ') +
69
+ // 'base-uri \'none\';' +
70
+ // 'child-src \'self\';' +
71
+ // 'object-src \'none\';';
72
72
73
- var csp = hashes + directives ;
74
- var devCsp = csp .
75
- // Adds script tags and loads shapes with eval
76
- replace ( / % s c r i p t - s r c % / g, 'https://www.dropbox.com https://api.trello.com https://devhost.jgraph.com \'unsafe-eval\'' ) .
77
- // Adds Trello and Dropbox backend storage
78
- replace ( / % c o n n e c t - s r c % / g, 'https://*.dropboxapi.com https://trello.com https://api.trello.com' ) .
79
- // Loads common.css from mxgraph
80
- replace ( / % s t y l e - s r c % / g, 'https://devhost.jgraph.com' ) .
81
- replace ( / % f r a m e - s r c % / g, '' ) .
82
- replace ( / / g, ' ' ) ;
73
+ // var csp = hashes + directives;
74
+ // var devCsp = csp.
75
+ // // Adds script tags and loads shapes with eval
76
+ // replace(/%script-src%/g, 'https://www.dropbox.com https://api.trello.com https://devhost.jgraph.com \'unsafe-eval\'').
77
+ // // Adds Trello and Dropbox backend storage
78
+ // replace(/%connect-src%/g, 'https://*.dropboxapi.com https://trello.com https://api.trello.com').
79
+ // // Loads common.css from mxgraph
80
+ // replace(/%style-src%/g, 'https://devhost.jgraph.com').
81
+ // replace(/%frame-src%/g, '').
82
+ // replace(/ /g, ' ');
83
83
84
- mxmeta ( null , devCsp , 'Content-Security-Policy' ) ;
84
+ // mxmeta(null, devCsp, 'Content-Security-Policy');
85
85
86
- if ( urlParams [ 'print-csp' ] == '1' )
87
- {
88
- console . log ( 'Content-Security-Policy' ) ;
89
- var app_diagrams_net = csp . replace ( / % s c r i p t - s r c % / g, 'https://www.dropbox.com https://api.trello.com' ) .
90
- replace ( / % c o n n e c t - s r c % / g, 'https://*.dropboxapi.com https://api.trello.com' ) .
91
- replace ( / % f r a m e - s r c % / g, '' ) .
92
- replace ( / % s t y l e - s r c % / g, '' ) .
93
- replace ( / / g, ' ' ) + ' frame-ancestors \'self\' https://teams.microsoft.com;' ;
94
- console . log ( 'app.diagrams.net:' , app_diagrams_net ) ;
86
+ // if (urlParams['print-csp'] == '1')
87
+ // {
88
+ // console.log('Content-Security-Policy');
89
+ // var app_diagrams_net = csp.replace(/%script-src%/g, 'https://www.dropbox.com https://api.trello.com').
90
+ // replace(/%connect-src%/g, 'https://*.dropboxapi.com https://api.trello.com').
91
+ // replace(/%frame-src%/g, '').
92
+ // replace(/%style-src%/g, '').
93
+ // replace(/ /g, ' ') + ' frame-ancestors \'self\' https://teams.microsoft.com;';
94
+ // console.log('app.diagrams.net:', app_diagrams_net);
95
95
96
- var se_diagrams_net = hashes . replace ( / % s c r i p t - s r c % / g, '' ) +
97
- 'connect-src \'self\' https://*.diagrams.net ' +
98
- 'https://*.googleapis.com wss://*.pusher.com https://*.pusher.com ' +
99
- 'https://*.google.com https://fonts.gstatic.com https://fonts.googleapis.com; ' +
100
- 'img-src * data: blob:; media-src * data:; font-src * about:; ' +
101
- 'frame-src \'self\' https://viewer.diagrams.net https://*.google.com; ' +
102
- 'style-src \'self\' https://fonts.googleapis.com ' + styleHashes + ' ' +
103
- 'object-src \'none\';' +
104
- 'frame-src \'none\';' +
105
- 'worker-src https://se.diagrams.net/service-worker.js;'
106
- console . log ( 'se.diagrams.net:' , se_diagrams_net ) ;
96
+ // var se_diagrams_net = hashes.replace(/%script-src%/g, '') +
97
+ // 'connect-src \'self\' https://*.diagrams.net ' +
98
+ // 'https://*.googleapis.com wss://*.pusher.com https://*.pusher.com ' +
99
+ // 'https://*.google.com https://fonts.gstatic.com https://fonts.googleapis.com; ' +
100
+ // 'img-src * data: blob:; media-src * data:; font-src * about:; ' +
101
+ // 'frame-src \'self\' https://viewer.diagrams.net https://*.google.com; ' +
102
+ // 'style-src \'self\' https://fonts.googleapis.com ' + styleHashes + ' ' +
103
+ // 'object-src \'none\';' +
104
+ // 'frame-src \'none\';' +
105
+ // 'worker-src https://se.diagrams.net/service-worker.js;'
106
+ // console.log('se.diagrams.net:', se_diagrams_net);
107
107
108
- // TODO remove https://ajax.googleapis.com April 2022. It's old jquery domain
109
- var ac_draw_io = csp . replace ( / % s c r i p t - s r c % / g, 'https://aui-cdn.atlassian.com https://connect-cdn.atl-paas.net https://ajax.googleapis.com https://cdnjs.cloudflare.com' ) .
110
- replace ( / % f r a m e - s r c % / g, 'https://www.lucidchart.com https://app.lucidchart.com https://lucid.app blob:' ) .
111
- replace ( / % s t y l e - s r c % / g, 'https://aui-cdn.atlassian.com https://*.atlassian.net' ) .
112
- replace ( / % c o n n e c t - s r c % / g, '' ) .
113
- replace ( / / g, ' ' ) ;
114
- console . log ( 'ac.draw.io:' , ac_draw_io ) ;
108
+ // // TODO remove https://ajax.googleapis.com April 2022. It's old jquery domain
109
+ // var ac_draw_io = csp.replace(/%script-src%/g, 'https://aui-cdn.atlassian.com https://connect-cdn.atl-paas.net https://ajax.googleapis.com https://cdnjs.cloudflare.com').
110
+ // replace(/%frame-src%/g, 'https://www.lucidchart.com https://app.lucidchart.com https://lucid.app blob:').
111
+ // replace(/%style-src%/g, 'https://aui-cdn.atlassian.com https://*.atlassian.net').
112
+ // replace(/%connect-src%/g, '').
113
+ // replace(/ /g, ' ');
114
+ // console.log('ac.draw.io:', ac_draw_io);
115
115
116
- var aj_draw_io = csp . replace ( / % s c r i p t - s r c % / g, 'https://connect-cdn.atl-paas.net' ) .
117
- replace ( / % f r a m e - s r c % / g, 'blob:' ) .
118
- replace ( / % s t y l e - s r c % / g, 'https://aui-cdn.atlassian.com https://*.atlassian.net' ) .
119
- replace ( / % c o n n e c t - s r c % / g, 'https://api.atlassian.com https://api.media.atlassian.com' ) .
120
- replace ( / / g, ' ' ) ;
121
- console . log ( 'aj.draw.io:' , aj_draw_io ) ;
116
+ // var aj_draw_io = csp.replace(/%script-src%/g, 'https://connect-cdn.atl-paas.net').
117
+ // replace(/%frame-src%/g, 'blob:').
118
+ // replace(/%style-src%/g, 'https://aui-cdn.atlassian.com https://*.atlassian.net').
119
+ // replace(/%connect-src%/g, 'https://api.atlassian.com https://api.media.atlassian.com').
120
+ // replace(/ /g, ' ');
121
+ // console.log('aj.draw.io:', aj_draw_io);
122
122
123
- console . log ( 'import.diagrams.net:' , 'default-src \'self\'; worker-src blob:; img-src \'self\' blob: data: https://www.lucidchart.com ' +
124
- 'https://app.lucidchart.com https://lucid.app; style-src \'self\' \'unsafe-inline\'; frame-src https://www.lucidchart.com https://app.lucidchart.com https://lucid.app;' ) ;
125
- console . log ( 'Development:' , devCsp ) ;
123
+ // console.log('import.diagrams.net:', 'default-src \'self\'; worker-src blob:; img-src \'self\' blob: data: https://www.lucidchart.com ' +
124
+ // 'https://app.lucidchart.com https://lucid.app; style-src \'self\' \'unsafe-inline\'; frame-src https://www.lucidchart.com https://app.lucidchart.com https://lucid.app;');
125
+ // console.log('Development:', devCsp);
126
126
127
- console . log ( 'Header Worker:' , 'let securityHeaders =' , JSON . stringify ( {
128
- online : {
129
- "Content-Security-Policy" : app_diagrams_net ,
130
- "Permissions-Policy" : "microphone=()"
131
- } ,
132
- se : {
133
- "Content-Security-Policy" : se_diagrams_net ,
134
- "Permissions-Policy" : "microphone=()" ,
135
- "Access-Control-Allow-Origin" : "https://se.diagrams.net"
136
- } ,
137
- teams : {
138
- "Content-Security-Policy" : app_diagrams_net . replace ( / ' s h a 2 5 6 - [ ^ ' ] + ' / g, '' ) ,
139
- "Permissions-Policy" : "microphone=()"
140
- } ,
141
- jira : {
142
- "Content-Security-Policy" : aj_draw_io ,
143
- "Permissions-Policy" : "microphone=()"
144
- } ,
145
- conf : {
146
- "Content-Security-Policy" : ac_draw_io ,
147
- "Permissions-Policy" : "microphone=()"
148
- }
149
- } , null , 4 ) ) ;
150
- }
151
- } ) ( ) ;
152
- }
127
+ // console.log('Header Worker:', 'let securityHeaders =', JSON.stringify({
128
+ // online: {
129
+ // "Content-Security-Policy" : app_diagrams_net,
130
+ // "Permissions-Policy" : "microphone=()"
131
+ // },
132
+ // se: {
133
+ // "Content-Security-Policy" : se_diagrams_net,
134
+ // "Permissions-Policy" : "microphone=()",
135
+ // "Access-Control-Allow-Origin": "https://se.diagrams.net"
136
+ // },
137
+ // teams: {
138
+ // "Content-Security-Policy" : app_diagrams_net.replace(/ 'sha256-[^']+'/g, ''),
139
+ // "Permissions-Policy" : "microphone=()"
140
+ // },
141
+ // jira: {
142
+ // "Content-Security-Policy" : aj_draw_io,
143
+ // "Permissions-Policy" : "microphone=()"
144
+ // },
145
+ // conf: {
146
+ // "Content-Security-Policy" : ac_draw_io,
147
+ // "Permissions-Policy" : "microphone=()"
148
+ // }
149
+ // }, null, 4));
150
+ // }
151
+ // })();
152
+ // }
153
153
154
154
mxscript ( drawDevUrl + 'js/cryptojs/aes.min.js' ) ;
155
155
mxscript ( drawDevUrl + 'js/spin/spin.min.js' ) ;
@@ -308,4 +308,4 @@ if (urlParams['orgChartDev'] == '1')
308
308
mxscript ( drawDevUrl + 'js/orgchart/bridge.collections.min.js' ) ;
309
309
mxscript ( drawDevUrl + 'js/orgchart/OrgChart.Layout.min.js' ) ;
310
310
mxscript ( drawDevUrl + 'js/orgchart/mxOrgChartLayout.js' ) ;
311
- }
311
+ }
0 commit comments