All checks were successful
Build and Release / Create Release (push) Successful in 0s
Build and Release / Unit Tests (push) Successful in 3m22s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 5m16s
Build and Release / Lint (push) Successful in 5m28s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Successful in 3m9s
Build and Release / Build Binaries (amd64, darwin, macos) (push) Successful in 4m16s
Build and Release / Build Binaries (arm64, darwin, macos) (push) Successful in 4m54s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Successful in 9h5m28s
Build and Release / Build Binary (linux/arm64) (push) Successful in 7m8s
Implement Open Graph social card image generation with customizable themes. Cards are dynamically rendered with repository name, description, owner avatar, and GitCaddy branding. Features: - Three built-in themes: dark (default), light, and colorful - 1200x630px cards optimized for social media platforms - Avatar fetching with caching and fallback to default - Text wrapping and truncation for long descriptions - Repository settings UI for theme selection - Migration to add social_card_theme column Technical implementation: - Uses golang.org/x/image for rendering with Inter font family - Singleton renderer pattern for font reuse - Endpoint: /:owner/:repo/socialcard.png - Integrates with Open Graph meta tags in head template Add Inter font files (Regular and Bold) and GitCaddy logo asset.
21 lines
477 B
Go
21 lines
477 B
Go
// Copyright 2026 The GitCaddy Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package socialcard
|
|
|
|
import "sync"
|
|
|
|
var (
|
|
globalRenderer *Renderer
|
|
globalRendererOnce sync.Once
|
|
globalRendererErr error
|
|
)
|
|
|
|
// GlobalRenderer returns the singleton renderer, initializing on first call.
|
|
func GlobalRenderer() (*Renderer, error) {
|
|
globalRendererOnce.Do(func() {
|
|
globalRenderer, globalRendererErr = NewRenderer()
|
|
})
|
|
return globalRenderer, globalRendererErr
|
|
}
|