pdf2epub 0.1.3 → 0.1.4
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/README.md +2 -10
- package/package.json +1 -1
- package/pdf2epub.js +0 -42
package/README.md
CHANGED
|
@@ -37,17 +37,9 @@ node pdf2epub.js book.pdf --split pages --pages-per-chapter 5
|
|
|
37
37
|
4. Detects headings by font size; splits chapters from PDF bookmarks when present.
|
|
38
38
|
5. Packages XHTML chapters, a navigation document, NCX and OPF into a valid EPUB 3 zip with `jszip`.
|
|
39
39
|
|
|
40
|
-
##
|
|
40
|
+
## Privacy
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
If you set `PDF2EPUB_TELEMETRY=1`, each run sends one ping so the author can see how often pdf2epub is used by AI coding agents (Claude Code, Cursor, Codex, ...) vs. people. Exactly these fields are sent, and nothing else:
|
|
45
|
-
|
|
46
|
-
```json
|
|
47
|
-
{ "v": "0.1.3", "agent": "claude-code | cursor | ... | none", "node": "22.x", "os": "darwin" }
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
No file names, paths, PDF content, hostnames, user IDs — and no IP is stored with the stats. The agent name comes from environment variables the agent sets (e.g. `CLAUDECODE`). When enabled, each run prints a one-line notice to stderr; the request times out after 1.5 s and any failure is ignored.
|
|
42
|
+
pdf2epub makes no network requests of its own: it reads your PDF and writes an EPUB, nothing else. (The `pdfjs-dist` dependency may fetch standard fonts/cmaps while parsing some PDFs.)
|
|
51
43
|
|
|
52
44
|
## Limitations
|
|
53
45
|
|
package/package.json
CHANGED
package/pdf2epub.js
CHANGED
|
@@ -518,53 +518,11 @@ ${navItems.map((n, i) => ` <navPoint id="np${i + 1}" playOrder="${i + 1}"><na
|
|
|
518
518
|
return buf.length;
|
|
519
519
|
}
|
|
520
520
|
|
|
521
|
-
// ---------------------------------------------------------------------------
|
|
522
|
-
// Telemetry (opt-in, anonymous). Off unless PDF2EPUB_TELEMETRY=1.
|
|
523
|
-
// ---------------------------------------------------------------------------
|
|
524
|
-
|
|
525
|
-
const TELEMETRY_URL = 'https://poc.n4b.top/check-ai';
|
|
526
|
-
|
|
527
|
-
// Env vars that AI coding agents set in the shells they spawn.
|
|
528
|
-
const AGENT_ENV = [
|
|
529
|
-
['CLAUDECODE', 'claude-code'],
|
|
530
|
-
['CURSOR_AGENT', 'cursor'],
|
|
531
|
-
['CURSOR_TRACE_ID', 'cursor'],
|
|
532
|
-
['GEMINI_CLI', 'gemini-cli'],
|
|
533
|
-
['CODEX_SANDBOX', 'codex'],
|
|
534
|
-
['CODEX_SANDBOX_NETWORK_DISABLED', 'codex'],
|
|
535
|
-
['OPENCODE', 'opencode'],
|
|
536
|
-
['REPL_ID', 'replit'],
|
|
537
|
-
];
|
|
538
|
-
|
|
539
|
-
function detectAgent(env = process.env) {
|
|
540
|
-
if (env.AI_AGENT) return env.AI_AGENT; // generic convention some agents set
|
|
541
|
-
for (const [key, name] of AGENT_ENV) if (env[key]) return name;
|
|
542
|
-
return null;
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
function reportUsage() {
|
|
546
|
-
// Opt-in only: silent unless the user explicitly turns it on.
|
|
547
|
-
if (process.env.PDF2EPUB_TELEMETRY !== '1' || typeof fetch !== 'function') return;
|
|
548
|
-
console.error('pdf2epub: sending one anonymous usage ping (agent/node/os only). Unset PDF2EPUB_TELEMETRY to disable.');
|
|
549
|
-
fetch(TELEMETRY_URL, {
|
|
550
|
-
method: 'POST',
|
|
551
|
-
headers: { 'content-type': 'application/json' },
|
|
552
|
-
body: JSON.stringify({
|
|
553
|
-
v: '0.1.3',
|
|
554
|
-
agent: detectAgent() ?? 'none',
|
|
555
|
-
node: process.versions.node,
|
|
556
|
-
os: process.platform,
|
|
557
|
-
}),
|
|
558
|
-
signal: AbortSignal.timeout(1500),
|
|
559
|
-
}).catch(() => {});
|
|
560
|
-
}
|
|
561
|
-
|
|
562
521
|
// ---------------------------------------------------------------------------
|
|
563
522
|
// Main
|
|
564
523
|
// ---------------------------------------------------------------------------
|
|
565
524
|
|
|
566
525
|
async function main() {
|
|
567
|
-
reportUsage();
|
|
568
526
|
let opts;
|
|
569
527
|
try {
|
|
570
528
|
opts = parseArgs(process.argv.slice(2));
|