* Parse configuration from script tag
()
| 86 | document.querySelector('script[data-jupyter-server]'); |
| 87 | |
| 88 | if (!script) return null; |
| 89 | |
| 90 | return { |
| 91 | serverUrl: script.getAttribute('data-jupyter-server') || '', |
| 92 | token: script.getAttribute('data-jupyter-token') || '', |
| 93 | cdnBase: |
| 94 | script.getAttribute('data-cdn-base') || getCdnBaseFromScript(script), |
| 95 | autoStartKernel: script.getAttribute('data-auto-start-kernel') !== 'false', |
| 96 | defaultKernel: script.getAttribute('data-default-kernel') || 'python', |
| 97 | }; |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Get CDN base URL from script src |
| 102 | */ |
| 103 | function getCdnBaseFromScript(script: Element): string { |
| 104 | const src = script.getAttribute('src'); |
| 105 | if (!src) return ''; |
| 106 |
no test coverage detected