burner-cc 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "burner-cc",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Itemized dollar-and-token cost receipts for Claude Code sessions.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/render.js CHANGED
@@ -12,10 +12,16 @@ export function renderReceipts(sessions) {
12
12
  mkdirSync(outDir, { recursive: true });
13
13
 
14
14
  const template = readFileSync(path.join(webDir, 'receipt.html'), 'utf-8');
15
- const injected = template.replace(
16
- '/*__BURNER_DATA__*/[]',
17
- JSON.stringify(sessions)
18
- );
15
+ // The logo has to be inlined as a data URI, not loaded as a separate
16
+ // file:// resource — html2canvas's Download button taints the canvas
17
+ // (SecurityError on toDataURL) if the receipt contains an <img> pulled
18
+ // in as its own file:// fetch, even from the same local directory.
19
+ const logoBase64 = readFileSync(path.join(webDir, 'logo-mark.png')).toString('base64');
20
+ const logoDataUri = `data:image/png;base64,${logoBase64}`;
21
+
22
+ const injected = template
23
+ .replace('/*__BURNER_DATA__*/[]', JSON.stringify(sessions))
24
+ .replace('/*__BURNER_LOGO_MARK__*/"logo-mark.png"', JSON.stringify(logoDataUri));
19
25
 
20
26
  const outHtml = path.join(outDir, 'receipt.html');
21
27
  writeFileSync(outHtml, injected, 'utf-8');
package/web/receipt.html CHANGED
@@ -25,6 +25,7 @@
25
25
  <div id="root"></div>
26
26
 
27
27
  <script>window.__BURNER_DATA__ = /*__BURNER_DATA__*/[];</script>
28
+ <script>window.__BURNER_LOGO_MARK__ = /*__BURNER_LOGO_MARK__*/"logo-mark.png";</script>
28
29
  <script src="vendor/html2canvas.min.js"></script>
29
30
  <script src="receipt.js"></script>
30
31
  </body>
package/web/receipt.js CHANGED
@@ -129,7 +129,7 @@ function receiptHtml(session, index) {
129
129
  </div>
130
130
  <div class="barcode" title="${bc.title}">${bc.html}</div>
131
131
  <div class="barcode-label">CC-SESSION-${session.sessionId.slice(0, 8).toUpperCase()}</div>
132
- <img class="receipt-logo" src="logo-mark.png" alt="Burner" />
132
+ <img class="receipt-logo" src="${window.__BURNER_LOGO_MARK__ ?? 'logo-mark.png'}" alt="Burner" />
133
133
  <div class="footer brand">~ B U R N E R ~</div>
134
134
  </div>
135
135
  `;