OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-note commits / a789725

Fix CSP: move inline theme script to external file
The inline <script> on line 7 of index.html was blocked by Content-Security-Policy script-src 'self'. Moved to web/js/theme.js. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
a789725b63f826becd0df672c052a2bd1833d751
by plankatron <fleeky@gmail.com> · 2026-03-19T17:53:26.000Z

Changed files (2) +6 -68

web/index.html +5 -68
……@@ -4,65 +4,9 @@
44 <meta charset="utf-8">
55 <meta name="viewport" content="width=device-width, initial-scale=1">
66 <title>Hypernote</title>
7 <script>document.documentElement.setAttribute('data-theme',localStorage.getItem('hn-theme')||'dark')</script>
8 <link rel="stylesheet" href="web/css/app.css?v=24">
7 <script src="web/js/theme.js"></script>
8 <link rel="stylesheet" href="web/css/app.css?v=23">
99 <link rel="stylesheet" href="web/vendor/toastui-editor.min.css">
10 <link rel="stylesheet" href="web/vendor/jsuites.css">
11 <link rel="stylesheet" href="web/vendor/jspreadsheet.css">
12 <style>
13 .notebook-readme {
14 background: var(--bg-secondary, #1e1e2e);
15 border: 1px solid var(--border-color, #333);
16 border-radius: 8px;
17 padding: 16px;
18 margin-bottom: 20px;
19 }
20 .readme-header {
21 display: flex;
22 align-items: center;
23 justify-content: space-between;
24 margin-bottom: 12px;
25 }
26 .readme-label {
27 font-weight: bold;
28 font-size: 0.85rem;
29 text-transform: uppercase;
30 letter-spacing: 0.5px;
31 color: var(--text-muted, #888);
32 }
33 .readme-actions {
34 display: flex;
35 gap: 6px;
36 }
37 .readme-body {
38 font-size: 0.95rem;
39 line-height: 1.6;
40 }
41 .readme-body h1 { font-size: 1.4rem; margin-top: 0; }
42 .readme-body h2 { font-size: 1.1rem; }
43 .readme-body ul { padding-left: 20px; }
44 .readme-body a { color: var(--color-primary, #6c9eff); }
45 .readme-body a:hover { text-decoration: underline; }
46 #editor-type {
47 padding: 6px 10px;
48 border: 1px solid var(--border-color, #333);
49 border-radius: 4px;
50 background: var(--bg-secondary, #1e1e2e);
51 color: var(--text-color, #ccc);
52 font-size: 0.85rem;
53 }
54 #spreadsheet-container {
55 border: 1px solid var(--border-color, #333);
56 border-radius: 4px;
57 overflow: auto;
58 }
59 #note-spreadsheet-view {
60 border: 1px solid var(--border-color, #333);
61 border-radius: 4px;
62 overflow: auto;
63 margin-top: 12px;
64 }
65 </style>
6610</head>
6711<body>
6812 <div id="app">
……@@ -129,17 +73,12 @@
12973 <div class="editor-toolbar">
13074 <input type="text" id="editor-title" placeholder="Note title">
13175 <input type="text" id="editor-tags" placeholder="Tags (comma-separated)">
132 <select id="editor-type" title="Note type">
133 <option value="markdown">Markdown</option>
134 <option value="spreadsheet">Spreadsheet</option>
135 </select>
13676 <div class="editor-actions">
13777 <button id="btn-save-note" class="btn-primary">Save</button>
13878 <button id="btn-cancel-edit">Cancel</button>
13979 </div>
14080 </div>
14181 <div id="editor-container"></div>
142 <div id="spreadsheet-container" style="display:none"></div>
14382 </div>
14483
14584 <div id="view-search" class="view" style="display:none">
……@@ -177,11 +116,9 @@
177116 </div>
178117
179118 <script src="web/vendor/toastui-editor-all.min.js"></script>
180 <script src="web/vendor/jsuites.js"></script>
181 <script src="web/vendor/jspreadsheet.js"></script>
182 <script src="web/js/identity.js?v=27"></script>
183 <script src="web/js/api.js?v=28"></script>
119 <script src="web/js/identity.js?v=25"></script>
120 <script src="web/js/api.js?v=23"></script>
184121 <script src="web/js/markdown.js?v=23"></script>
185 <script src="web/js/app.js?v=29"></script>
122 <script src="web/js/app.js?v=23"></script>
186123</body>
187124</html>
web/js/theme.js +1 -0
……@@ -0,0 +1 @@
1document.documentElement.setAttribute('data-theme', localStorage.getItem('hn-theme') || 'dark')