soiz1 commited on
Commit
ba7eef1
·
verified ·
1 Parent(s): 2d2c5fb

Update src/playground/embed.jsx

Browse files
Files changed (1) hide show
  1. src/playground/embed.jsx +6 -5
src/playground/embed.jsx CHANGED
@@ -15,13 +15,13 @@ import appTarget from './app-target';
15
  const getProjectId = () => {
16
  // For compatibility reasons, we first look at the hash.
17
  // eg. https://turbowarp.org/embed.html#1
18
- const hashMatch = location.hash.slice(1);
19
  if (hashMatch !== '') {
20
  return hashMatch;
21
  }
22
  // Otherwise, we'll recreate what "wildcard" routing does.
23
  // eg. https://turbowarp.org/1/embed
24
- const pathMatch = location.pathname.match(/(\d+)\/embed/);
25
  if (pathMatch !== null) {
26
  return pathMatch[pathMatch.length - 1];
27
  }
@@ -29,13 +29,14 @@ const getProjectId = () => {
29
  };
30
 
31
  const projectId = getProjectId();
32
- const urlParams = new URLSearchParams(location.search);
33
 
34
  let vm;
35
 
36
  const onVmInit = _vm => {
37
  vm = _vm;
38
- vm.runtime.renderer.setPrivateSkinAccess(false);
 
39
  };
40
 
41
  const onProjectLoaded = () => {
@@ -62,4 +63,4 @@ ReactDOM.render(<WrappedGUI
62
 
63
  if (urlParams.has('addons')) {
64
  runAddons();
65
- }
 
15
  const getProjectId = () => {
16
  // For compatibility reasons, we first look at the hash.
17
  // eg. https://turbowarp.org/embed.html#1
18
+ const hashMatch = __cpLocation.hash.slice(1);
19
  if (hashMatch !== '') {
20
  return hashMatch;
21
  }
22
  // Otherwise, we'll recreate what "wildcard" routing does.
23
  // eg. https://turbowarp.org/1/embed
24
+ const pathMatch = __cpLocation.pathname.match(/(\d+)\/embed/);
25
  if (pathMatch !== null) {
26
  return pathMatch[pathMatch.length - 1];
27
  }
 
29
  };
30
 
31
  const projectId = getProjectId();
32
+ const urlParams = new URLSearchParams(__cpLocation.search);
33
 
34
  let vm;
35
 
36
  const onVmInit = _vm => {
37
  vm = _vm;
38
+ if (vm.runtime.renderer?.setPrivateSkinAccess)
39
+ vm.runtime.renderer.setPrivateSkinAccess(false);
40
  };
41
 
42
  const onProjectLoaded = () => {
 
63
 
64
  if (urlParams.has('addons')) {
65
  runAddons();
66
+ }