feat: add OGP image rendering package (pkg/ogimage) - #158
Conversation
- Define OGPData struct for template values (Title, Author, Date, Category, Tags) independent of core.Article - Embed default OGP HTML template with modern dark-themed design - go-rod based headless browser renderer outputting 1200x630 JPEG - Support GIC_CHROMIUM_BIN env var and explicit browser binary path - go-rod launcher auto-downloads Chromium when no binary is specified Closes rokuosan#153
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 94fcf23a6b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- P1: Switch from text/template to html/template to escape user-authored metadata (XSS prevention) - P2: Bind context to launcher and browser so cancellation propagates properly to Chromium startup and rendering - P2: Fix WaitStable argument — 1 nanosecond → 1 second - P2: Replace MustPage/MustClose with error-returning Page/Close APIs to avoid panics on recoverable browser failures
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6f49a05bef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Change page.Screenshot(true, ...) to page.Screenshot(false, ...) to preserve the explicit 1200x630 clip dimensions instead of expanding to full-page mode when content overflows.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 35ee555007
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…an#158 review) If browser.Connect() fails after launcher.Launch() succeeds, the chromium process would leak because Leakless(false) was set. Now we call l.Kill() on connection failure to clean up the orphaned process.
|
@codex review |
…an#158 review) If browser.Connect() fails after launcher.Launch() succeeds, the chromium process would leak because Leakless(false) was set. Now we call l.Kill() on connection failure to clean up the orphaned process.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 53c4fdefe2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…an#158 review) - Store template directory (tmplDir) when using custom templates - Create page with file:// URL based on template directory so relative asset references (images, CSS) resolve correctly - Embedded template continues to use about:blank (no assets)
…rokuosan#158) - Add ctx.Err() check before expensive browser launch - Add page.Timeout(30s) so WaitStable/Screenshot cannot hang forever - Change Leakless(false) → Leakless(true) to prevent zombie Chromium processes - Fix file:// URL to file:/// (three slashes) for correct absolute path resolution
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7d676eef39
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Replace raw string concatenation with url.URL to properly escape special characters (#, ?) in template directory paths - Ensures correct base URL for relative asset resolution even with unusual directory names
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Implements milestone 1 of #21 — creates a new
pkg/ogimagepackage for rendering OGP images from HTML templates using a headless Chromium browser.Changes
pkg/ogimage/ogimage.go—OGPDatastruct (Title, Author, Date, Category, Tags) independent ofcore.Articlepkg/ogimage/renderer.go— go-rod based renderer with:GIC_CHROMIUM_BINenv var support for explicit browser binaryNewRendererWithTemplatepkg/ogimage/template.html— Embedded default OGP HTML templateCloses #153