- Move all inline <script> blocks (layout head/theme, topbar dark toggle, foot, paste, new, history, mine, settings, admin, unlock) to external files under internal/web/static/. Page data reaches scripts via data-* attributes (data-paste-id, data-default-dark) instead of template vars. - Replace inline onclick handlers (copy, delete, stats toggle) with addEventListener wiring. - Convert inline style="" attributes to CSS utility classes; swatch colors are now set via CSSOM/DOM APIs instead of innerHTML strings. - script-src/style-src are now plain 'self'; img-src data: stays for the SVG data-URI backgrounds. Verified with headless chromium: zero CSP violations on all pages in dark and light presets, theme swatches, admin lock, tables and paste view render correctly.
92 lines
5.0 KiB
HTML
92 lines
5.0 KiB
HTML
{{template "head" .}}
|
|
{{template "topbar" .}}
|
|
<div class="deck">
|
|
<div class="pane-l-col">
|
|
<div class="float pane-l-head">
|
|
<div class="editor-head">
|
|
<div class="editor-head-title">
|
|
<input id="title" placeholder="Title">
|
|
</div>
|
|
<div class="editor-head-settings">
|
|
<select id="language">
|
|
<option value="">auto</option>
|
|
<option>go</option><option>python</option><option>javascript</option><option>typescript</option>
|
|
<option>rust</option><option>c</option><option>cpp</option><option>java</option><option>csharp</option>
|
|
<option>bash</option><option>sql</option><option>yaml</option><option>json</option>
|
|
<option>html</option><option>css</option><option>xml</option><option>php</option>
|
|
<option>ruby</option><option>perl</option><option>lua</option><option>dockerfile</option>
|
|
<option>toml</option><option>ini</option><option>diff</option>
|
|
<option>markdown</option><option>text</option>
|
|
</select>
|
|
<button class="btn btn-icon" id="reguess" title="Re-detect language" type="button"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12a9 9 0 1 1-2.64-6.36"/><polyline points="21 3 21 9 15 9"/></svg></button>
|
|
<button type="button" class="btn btn-icon wrap-toggle" id="wrap-toggle" title="Toggle line wrap" aria-pressed="false">wrap</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="float editor-wrap">
|
|
<div class="gutter" id="gutter">1</div>
|
|
<textarea class="editor" id="content" placeholder="Paste your code, text, or notes here…" spellcheck="false"></textarea>
|
|
</div>
|
|
<div class="created-banner" id="created"></div>
|
|
<div class="actionbar">
|
|
<span class="hint">Ctrl+Enter to create</span>
|
|
<div class="spacer spacer-flex"></div>
|
|
<button class="btn" id="create">Create</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="pane-r">
|
|
<div class="float side-section">
|
|
<h3>Expiry</h3>
|
|
<div class="seg">
|
|
<label><input type="radio" name="exp" value=""> Never</label>
|
|
<label><input type="radio" name="exp" value="1h"> 1 hour</label>
|
|
<label><input type="radio" name="exp" value="24h"> 1 day</label>
|
|
<label><input type="radio" name="exp" value="168h" checked> 1 week</label>
|
|
<label><input type="radio" name="exp" value="720h"> 30 days</label>
|
|
<label><input type="radio" name="exp" value="custom"> Custom</label>
|
|
</div>
|
|
<div class="pw-row hidden" id="customexp-row">
|
|
<input type="number" id="expnum" min="1" class="input-num" placeholder="90">
|
|
<select id="expunit">
|
|
<option value="m">minutes</option>
|
|
<option value="h" selected>hours</option>
|
|
<option value="d">days</option>
|
|
<option value="w">weeks</option>
|
|
<option value="mo">months</option>
|
|
</select>
|
|
<div class="hint danger-hint hidden" id="customexp-err"></div>
|
|
</div>
|
|
</div>
|
|
<div class="float side-section">
|
|
<h3>Protection</h3>
|
|
<div class="protect">
|
|
<label class="toggle"><input type="checkbox" id="haspw"> Password lock</label>
|
|
<div class="pw-row hidden" id="pwrow"><div class="pw-field"><input type="password" id="password" placeholder="Password" autocomplete="new-password"><button type="button" class="reveal" id="pwreveal" title="Show password" tabindex="-1"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M1 12s4-7 11-7 11 7 11 7-4 7-11 7-11-7-11-7z"/><circle cx="12" cy="12" r="3"/><line class="eye-slash" x1="4" y1="4" x2="20" y2="20"/></svg></button></div></div>
|
|
<label class="toggle"><input type="checkbox" id="burn"> Burn after read</label>
|
|
<div class="pw-row hidden" id="burnrow"><label class="hint hint-lg">Readable <input type="number" id="burnreads" min="1" value="1" class="input-num-sm"> times</label></div>
|
|
<label class="toggle"><input type="checkbox" id="unlisted"> Unlisted</label>
|
|
</div>
|
|
</div>
|
|
<div class="float side-section">
|
|
<h3>Attachment</h3>
|
|
<div class="dropzone" id="dropzone" title="Paste (Ctrl+V), drop a file here, or click to browse">
|
|
Drop a file here, press Ctrl+V, or click to browse
|
|
</div>
|
|
<input type="file" id="file-input" class="file-input" aria-label="Choose a file">
|
|
<div id="file-chip-slot"></div>
|
|
<div class="hint hint-lg hidden mt6" id="file-text-note">File pastes ignore the text editor (one file per paste)</div>
|
|
</div>
|
|
<div class="float side-section">
|
|
<h3>Custom URL</h3>
|
|
<input type="text" id="custom" class="custom-input" placeholder="my-snippet">
|
|
</div>
|
|
<div class="float side-section hidden" id="result-card">
|
|
<h3>Result</h3>
|
|
<div class="hint wrap-normal" id="result">empty</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="/static/new.js" defer></script>
|
|
{{template "foot" .}}
|