Commit Graph
12 Commits
Author SHA1 Message Date
KenanZhuandClaude 6ccbfc681c fix: restore templates_config.json to tools/data/ location
File was accidentally moved to tools/config/data/ in an earlier commit,
breaking the preview command's default --config path (./data/...).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-23 10:52:24 +08:00
KenanZhuandClaude 41caba06c0 chore: remove webhook config, keep schedule + manual trigger only
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-23 10:30:28 +08:00
KenanZhuandClaude 0ad7db124a refactor(preview): remove juice/Node.js, simplify to pure Go dev server with SSE
- Delete tools/server/ (Node.js, juice, inliner.mjs, server.mjs, node_modules)
- Create tools/preview/server.go — pure Go dev server with SSE + file polling
- Rewrite tools/cli/dev.go — start Go server in-process, no Node.js required
- Simplify preview/index.html — View dropdown (Modern/Source), remove Client
  Simulation panel, remove Gmail/Outlook logic, WebSocket → SSE
- Update all 14 documentation files (README, CONTRIBUTING, AGENTS + translations)
  to reflect pure Go dev server and simplified preview

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-23 09:48:04 +08:00
KenanZhuandClaude Opus 4.8 da8bb2e1a2 style(tools): unify console output with [I/W/E] [Module] color-coded format
- Add ANSI color coding: [I]=green, [W]=yellow, [E]=red
- Format: [Level] [Module] message with 4-char indent for data rows
- Error detail lines use |-> tree connector
- Remove extra blank lines between outputs (except list)
- Modules: CLI, Preview, Builder, Server, Watcher

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 14:21:25 +08:00
KenanZhuandClaude Opus 4.8 d46f702664 refactor(cli): rename preview_cmd.go to preview.go
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 13:44:56 +08:00
KenanZhuandClaude Opus 4.8 6ae9c97be8 style(aurora): CSS class-based refactor, full i18n, and locale alignment
themes/aurora/ (all 11 tmpl templates):
- Extract all reusable inline styles to CSS classes in <style> blocks
- Organize CSS with /* Section */ comment headers (Base, Header, Card, etc.)
- Clean HTML structure: <tr>/<td> on separate lines, consistent 2-space indent
- Replace all hardcoded English button text with locale.Tr keys
- Add mail.team_invite.text_3 disclaimer notice to team_invite
- Go variable assignments on dedicated lines with proper indentation
- Section comments in Title Case

tools/preview/locale.go:
- Replace LocaleEN with full 60-key official Gitea mail locale
- Add positional format specifier support (%[1]s, %[2]d) in Tr()
- All keys verified against official Gitea locale_en-US.json (100% match)

.gitignore:
- Add preview/rendered.js entry

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 18:51:56 +08:00
KenanZhu d8a714b2b5 feat(preview): cross-browser scrollbar, keyboard nav, dev-mode client simulation, docs overhaul
preview/index.html:
- Fix scrollbar CSS: scoped webkit pseudo-elements + standards-track fallback, removed deprecated overflow:overlay
- Keyboard navigation: arrows cycle focus between Theme/Template/Client selects, up/down select within focused dropdown, d/m toggle viewport
- Dev/static mode detection: delayed static warning only when WebSocket absent, WebSocket errors only on disconnect (not on initial fail)
- iframe sandbox: removed static sandbox attr, applied dynamically only in dev mode (file: protocol rejects sandboxed srcdoc)
- Loading fix: removed double-toggle between init and render(); added 5s safety timeout
- Transform clean: returns HTML as-is; CSS stripping moved to server-side
- Dev disclaimer: blue info banner shown on WebSocket connect

tools/server/inliner.mjs:
- Added stripGmail() / stripOutlook() — server-side CSS property stripping for email client simulation

tools/server/server.mjs:
- Fixed WebSocket upgrade: use app.listen() instead of createServer(app).listen()
- Juice post-processing now generates three rendered.js variants (modern/gmail/outlook)
- Initial startup runs juice-only pass (avoids duplicate Go compilation)

docs/ (all 6 languages — en, zh-CN, zh-TW, ja, ko, ru):
- Image size limits: max 50KiB, recommended 10-20KiB
- Dev disclaimer: simulation cannot 100% reproduce every client
- Changed 'accurate' to 'relatively accurate' across all static-mode warnings
- Converted all plain blockquotes to GitHub admonitions ([!WARNING] / [!NOTE])
2026-06-04 16:01:42 +08:00
KenanZhuandClaude Opus 4.8 13c49d2087 fix(preview): static-notice, simplify transform, HTML-safe rendering
- Add static-notice banner: 'Gmail/Outlook simulation is approximate.
  Use dev mode for accurate rendering.' Hidden in dev mode via
  WebSocket try/catch, auto-shown in file:// mode on WS failure.
- Simplify transform(): Gmail/Outlook modes now return same HTML as
  Modern — the dev server with Juice provides actual client sim.
- Add markSafeHTML(): converts RenderedNote/Body/RenderedContent
  from plain string to template.HTML so markdown-rendered HTML
  content is not escaped by Go's html/template engine.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 13:51:43 +08:00
KenanZhuandClaude Opus 4.8 a0cd5e32f4 fix(templates): add inline colors for dark-background themes, set CanReply=false
- aurora, neon, terminal: add explicit inline color styles to bare
  text elements (locale.Tr calls, h4 headings, download labels)
  that were invisible in clients stripping <style> blocks (Gmail).
  33 files across 3 dark-background themes.
- CanReply: changed from true to false in mock data — matches
  typical Gitea deployment where IncomingEmail is disabled by
  default. Template syntax kept identical to official Gitea.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 13:51:10 +08:00
KenanZhuandClaude Opus 4.8 05d76a90af feat(dev): add live-reload dev server with Juice CSS inlining
- tools/server/: Node.js dev server (Express + WebSocket + fs.watch)
  Watches themes/ for .tmpl changes, rebuilds via Go preview command,
  applies Juice CSS inlining for email client compatibility, pushes
  live reload to browser via WebSocket.
- tools/cli/dev.go: 'go run . dev' subcommand — starts Node.js server
  with automatic npm install, initial preview generation, and
  Ctrl+C graceful shutdown.
- tools/tools.go: register dev command in CLI app.
- .gitignore: add node_modules exclusion.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 13:50:57 +08:00
KenanZhuandClaude Opus 4.8 0bf982ffb9 refactor(tools): modularize CLI with urfave/cli/v2, externalise template metadata
- Split monolithic build-preview.go into modular packages:
  tools.go (entry), cli/ (list/create/delete/preview commands),
  config/ (JSON loading), preview/ (rendering engine, funcs, locale)
- Extract all template metadata into data/templates_config.json
  as single source of truth — no hardcoded template data in Go
- Replace hand-rolled CLI parsing with github.com/urfave/cli/v2
- Add sensible defaults for --folder (../themes) and --config
  (./data/templates_config.json) — most commands now run bare
- Add type-coercing gt/lt/ge/le template funcs for JSON float64
- Fix AppUrl to gitea.com matching official template convention
- rendered.js now exports __REGISTRY__ and __PARAMS__ alongside
  __RENDERED__ — preview/index.html reads all from single source
- Cross-validate all 11 template data contexts against official
  Gitea source (services/mailer/*.go + templates/mail/*.tmpl)
- Update all docs (README, AGENTS, CONTRIBUTING, 5 languages)
  to reflect new CLI workflow with create scaffolding command

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 12:26:44 +08:00
KenanZhuandClaude Opus 4.8 a2742887e8 chore(init): scaffold Gitea mail templates — 110 templates, 10 visual styles, drop-in deployment
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 18:10:22 +08:00