File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,17 @@ import { App } from './App';
44import '@webview/index.css' ;
55import './styles/web-theme.css' ;
66
7+ // Polyfill crypto.randomUUID for non-secure contexts (HTTP).
8+ // Mobile browsers only expose randomUUID() over HTTPS, but
9+ // crypto.getRandomValues() works everywhere.
10+ if ( typeof crypto !== 'undefined' && typeof crypto . randomUUID !== 'function' ) {
11+ crypto . randomUUID = ( ) =>
12+ '10000000-1000-4000-8000-100000000000' . replace ( / [ 0 1 8 ] / g, ( c ) => {
13+ const n = Number ( c ) ;
14+ return ( n ^ ( crypto . getRandomValues ( new Uint8Array ( 1 ) ) [ 0 ] & ( 15 >> ( n / 4 ) ) ) ) . toString ( 16 ) ;
15+ } ) as `${string } -${string } -${string } -${string } -${string } `;
16+ }
17+
718localStorage . setItem ( 'editor' , JSON . stringify ( 'web' ) ) ;
819document . documentElement . dataset . editor = 'web' ;
920window . mediaUrl = '' ;
You can’t perform that action at this time.
0 commit comments