Add AnyClip integration tools and extracted source code

- Add authentication scripts with SubtleCrypto password encryption
- Add sourcemap extraction pipeline (update-urls, download-sourcemaps, extract-sources)
- Add Playwright API interception script for monetization endpoints
- Document two-step auth flow with JWT tokens and dual cookies
- Move extracted source from root to anyclip/ directory
- Add project configuration (.env.example, .gitignore, CLAUDE.md)
This commit is contained in:
2026-01-21 10:36:51 +08:00
parent d4fe4800e6
commit e32d475aa9
3463 changed files with 184648 additions and 64341 deletions

View File

@@ -0,0 +1,70 @@
#!/usr/bin/env bun
/**
* Download sourcemaps for all JS files listed in urls.txt
*
* Usage:
* bun scripts/update-urls.ts # First, update urls.txt from build manifest
* bun scripts/download-sourcemaps.ts # Then download sourcemaps
*/
import { mkdir } from "fs/promises";
const OUTPUT_DIR = "sourcemaps";
await mkdir(OUTPUT_DIR, { recursive: true });
// Read urls.txt
const urlsFile = Bun.file("urls.txt");
if (!(await urlsFile.exists())) {
console.error("urls.txt not found. Run 'bun scripts/update-urls.ts' first.");
process.exit(1);
}
const urls = (await urlsFile.text())
.split("\n")
.map((line) => line.trim())
.filter((line) => line && line.includes("/_next/") && line.endsWith(".js"));
console.log(`Found ${urls.length} JS files in urls.txt\n`);
let downloaded = 0;
let skipped = 0;
let failed = 0;
for (const jsUrl of urls) {
const filename = jsUrl.split("/").pop()!;
const mapFile = `${OUTPUT_DIR}/${filename}.map`;
// Check if already exists
const exists = await Bun.file(mapFile).exists();
if (exists) {
skipped++;
continue;
}
const mapUrl = `${jsUrl}.map`;
try {
const response = await fetch(mapUrl);
if (response.ok) {
const content = await response.text();
// Verify it's a valid sourcemap (starts with {)
if (content.startsWith("{")) {
await Bun.write(mapFile, content);
console.log(`${filename}.map`);
downloaded++;
} else {
failed++;
}
} else {
failed++;
}
} catch (e) {
failed++;
}
}
console.log(`\n✅ Downloaded: ${downloaded}`);
console.log(`⏭️ Skipped (exists): ${skipped}`);
console.log(`❌ Failed/No sourcemap: ${failed}`);
console.log(`\nTotal sourcemaps: ${downloaded + skipped}`);