claude-rpc 0.7.2 → 0.7.3
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 +1 -1
- package/src/privacy.js +62 -2
- package/src/server/api.js +35 -0
- package/src/server/assets/dashboard.client.js +647 -0
- package/src/server/assets/dashboard.css +326 -0
- package/src/server/assets/dashboard.html +276 -0
- package/src/server/assets.js +36 -0
- package/src/server/page.js +24 -1248
- package/src/server/routes.js +24 -1
- package/src/version.js +1 -1
package/src/server/routes.js
CHANGED
|
@@ -8,7 +8,7 @@ import { readAggregate } from '../scanner.js';
|
|
|
8
8
|
import { generateInsights } from '../insights.js';
|
|
9
9
|
import { badgeSvg } from '../badge.js';
|
|
10
10
|
import { renderCard } from '../card.js';
|
|
11
|
-
import { snapshot, windowedAggregate } from './api.js';
|
|
11
|
+
import { snapshot, windowedAggregate, aggregateToCsv } from './api.js';
|
|
12
12
|
|
|
13
13
|
export const JSON_HEADERS = {
|
|
14
14
|
'content-type': 'application/json',
|
|
@@ -51,6 +51,29 @@ ROUTES.set('GET /api/badge.svg', (req, res, { query }) => {
|
|
|
51
51
|
res.end(svg);
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
+
// Data export. content-disposition: attachment makes the browser download
|
|
55
|
+
// rather than render. The JSON is the raw aggregate; the CSV is byDay
|
|
56
|
+
// flattened to daily rows (see aggregateToCsv).
|
|
57
|
+
ROUTES.set('GET /api/export.json', (req, res) => {
|
|
58
|
+
const agg = readAggregate() || {};
|
|
59
|
+
res.writeHead(200, {
|
|
60
|
+
'content-type': 'application/json; charset=utf-8',
|
|
61
|
+
'content-disposition': 'attachment; filename="claude-rpc-aggregate.json"',
|
|
62
|
+
'cache-control': 'no-store',
|
|
63
|
+
});
|
|
64
|
+
res.end(JSON.stringify(agg, null, 2));
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
ROUTES.set('GET /api/export.csv', (req, res) => {
|
|
68
|
+
const agg = readAggregate() || {};
|
|
69
|
+
res.writeHead(200, {
|
|
70
|
+
'content-type': 'text/csv; charset=utf-8',
|
|
71
|
+
'content-disposition': 'attachment; filename="claude-rpc-daily.csv"',
|
|
72
|
+
'cache-control': 'no-store',
|
|
73
|
+
});
|
|
74
|
+
res.end(aggregateToCsv(agg));
|
|
75
|
+
});
|
|
76
|
+
|
|
54
77
|
// Poster-style card. `?range=year|month|week|all` (default year).
|
|
55
78
|
ROUTES.set('GET /api/card.svg', (req, res, { query }) => {
|
|
56
79
|
const agg = readAggregate();
|