Skip to content

Commit 85bde65

Browse files
committed
Fix CSP
1 parent 44231c2 commit 85bde65

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

electron_demo/turtle_tf2/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,16 @@ world → turtle2
222222
- Try restarting the Electron application
223223

224224
5. **"electron: not found" or native module errors**
225+
225226
- Make sure you ran `npm run rebuild` after `npm install`
226227
- Ensure Node.js version is compatible (16 or higher)
227228
- Try deleting `node_modules` and running `npm install && npm run rebuild` again
228229

230+
6. **"THREE is not defined" or script loading errors**
231+
- The demo uses CDN versions of Three.js which require internet connection
232+
- If you see CSP (Content Security Policy) errors, ensure the CSP in index.html allows CDN domains
233+
- For offline use, you can install Three.js locally: `npm install [email protected]` and update script paths in index.html
234+
229235
### Debugging Commands
230236

231237
```bash

electron_demo/turtle_tf2/index.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<!DOCTYPE html>
1+
<!DOC <meta http-equiv="Content-Security-Policy"
2+
content="default-src 'self'; script-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://cdn.jsdelivr.net; style-src 'self' 'unsafe-inline';">PE html>
23
<html>
34

45
<head>
@@ -427,8 +428,8 @@ <h1>🐢 Turtle TF2 Transformation Demo</h1>
427428
</div>
428429

429430
<!-- Include Three.js -->
430-
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
431-
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.js"></script>
431+
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r155/three.min.js"></script>
432+
<script src="https://cdn.jsdelivr.net/npm/three@0.155.0/examples/js/controls/OrbitControls.js"></script>
432433

433434
<!-- Main renderer script -->
434435
<script src="./renderer.js"></script>

0 commit comments

Comments
 (0)