|
13 | 13 | import base64 |
14 | 14 | import json |
15 | 15 | from pathlib import Path |
| 16 | +from datetime import datetime, timezone |
| 17 | + |
| 18 | + |
| 19 | +def generate_watermark_metadata() -> str: |
| 20 | + """Generate invisible HTML watermark metadata for origin tracking and distribution proof. |
| 21 | + |
| 22 | + Watermark is intentionally hardcoded to the original project (folio-cv by txitxo0). |
| 23 | + This serves as proof of origin and helps track distribution, even in forks/clones. |
| 24 | + See README.md for details. |
| 25 | + |
| 26 | + Returns: |
| 27 | + HTML meta tags as string with origin, timestamp, and attribution |
| 28 | + """ |
| 29 | + github_user = "txitxo0" # Original project author - hardcoded by design |
| 30 | + project_name = "folio-cv" # Original project name - hardcoded by design |
| 31 | + timestamp = datetime.now(timezone.utc).isoformat().replace("+00:00", "Z") |
| 32 | + watermark = f"{project_name}:{github_user}:{timestamp}" |
| 33 | + |
| 34 | + meta_tags = ( |
| 35 | + " <!-- Watermark metadata for origin tracking and distribution proof -->\n" |
| 36 | + f' <meta name="watermark-origin" content="{watermark}">\n' |
| 37 | + f' <meta name="watermark-project" content="{project_name}">\n' |
| 38 | + f' <meta name="watermark-author" content="{github_user}">\n' |
| 39 | + f' <meta name="watermark-timestamp" content="{timestamp}">\n' |
| 40 | + ) |
| 41 | + return meta_tags |
16 | 42 |
|
17 | 43 |
|
18 | 44 | def validate_data_schema(schema_path: Path, data_obj: dict): |
@@ -59,10 +85,18 @@ def main(): |
59 | 85 | js = src_js.read_text(encoding="utf-8-sig") |
60 | 86 | data = src_data.read_text(encoding="utf-8-sig") |
61 | 87 |
|
| 88 | + # Inject watermark metadata before </head> |
| 89 | + watermark_meta = generate_watermark_metadata() |
| 90 | + head_close = "</head>" |
| 91 | + if head_close in html: |
| 92 | + compiled = html.replace(head_close, watermark_meta + head_close) |
| 93 | + else: |
| 94 | + compiled = html |
| 95 | + |
62 | 96 | # Inject CSS (remove link tag, add style tag) |
63 | 97 | css_link = '<link rel="stylesheet" href="assets/css/cv.css">' |
64 | 98 | style_tag = f"<style>\n{css}\n</style>" |
65 | | - compiled = html.replace(css_link, style_tag) |
| 99 | + compiled = compiled.replace(css_link, style_tag) |
66 | 100 |
|
67 | 101 | # Inline favicon so dist/index.html remains self-contained. |
68 | 102 | favicon_link = ( |
@@ -159,7 +193,9 @@ def main(): |
159 | 193 | size_kb = len(compiled.encode("utf-8")) / 1024 |
160 | 194 | print(f"✅ Build complete: {output_path}") |
161 | 195 | print(f"📦 Size: {size_kb:.2f} KB") |
| 196 | + print("🔐 Watermark metadata embedded (proof of origin: folio-cv by txitxo0)") |
162 | 197 | print("🚀 Ready to deploy to GitHub Pages") |
| 198 | + print(" See README.md for details on watermarking and distribution tracking") |
163 | 199 |
|
164 | 200 | except Exception as err: |
165 | 201 | print(f"❌ Build failed: {err}") |
|
0 commit comments