Sign inSign up

penrithbeacon/wcp-widget-qr-generator

By penrithbeacon

•Updated 5 months ago

Image
0

2.3K

penrithbeacon/wcp-widget-qr-generator repository overview

⁠WCP Widget: QR Generator

A Widget Context Protocol (WCP)⁠ widget that generates QR codes for any text or URL. Fully self-contained — no external API calls, works offline.

Specification: widgetcontextprotocol.com⁠ | Part of the Penrith Beacon WCP⁠ widget suite.

WCP 2.1.0 certified. Full theme reception, orchestration-aware state, Publish to Web, WCP export.


⁠Components

ComponentDefault sizeDescription
QR Generator4x3QR code generator for any text or URL, with adjustable size

⁠Quick Start

docker run -d \
  --name wcp-widget-qr-generator \
  -p 3747:3747 \
  -v qr_published:/app/published \
  -e CONTAINER_NAME=wcp-widget-qr-generator \
  --restart unless-stopped \
  docker.io/penrithbeacon/wcp-widget-qr-generator:latest

⁠Docker Compose

services:
  qr-generator:
    image: docker.io/penrithbeacon/wcp-widget-qr-generator:latest
    container_name: wcp-widget-qr-generator
    ports:
      - "3747:3747"
    volumes:
      - ./published:/app/published
    environment:
      - CONTAINER_NAME=wcp-widget-qr-generator
    restart: unless-stopped

⁠WCP Request Headers

HeaderRequiredDescription
Wcp-Instance-IdYesUnique card instance identifier
Wcp-Dashboard-IdYesDashboard installation identifier
Wcp-VersionYesWCP protocol version of the requesting dashboard
Wcp-Widget-IdYesWidget identifier within the dashboard
Wcp-Orchestration-IdNoActive orchestration identifier (for state scoping)
Wcp-Application-IdNoActive application identifier (for state scoping)

⁠Endpoints

EndpointDescription
GET /wcpContainer Directory — WCP two-tier discovery
GET /widget/wcpWidget Manifest with runtime publish status
OPTIONS /wcpCORS preflight (all widget routes)
GET /widget/Compact dashboard view
GET /widget/indexWidget Index — lists all controls
GET /widget/healthHealth check with container name
GET /widget/icon.svgWidget icon (SVG)
GET /widget/api/guidsComponent UUIDs for orchestration binding
GET /widget/fullFull-page QR generator
GET /widget/manifestLightweight manifest subset
POST /widget/api/qrGenerate a QR code (JSON body)
GET /widget/export.wcpSelf-export as .wcp package
POST /widget/publishAccept SPA HTML for Publish to Web
DELETE /widget/publishRemove published SPA
GET /Serve published SPA (if present)

⁠API

Generate a QR code:

curl -X POST http://localhost:3747/widget/api/qr \
  -H "Content-Type: application/json" \
  -d '{"text": "https://example.com", "size": 300}'

Response:

{
  "status": "Success",
  "text": "https://example.com",
  "size": 300,
  "format": "png",
  "base64Image": "<base64-encoded PNG>"
}
ParameterTypeDefaultDescription
textstringrequiredText or URL to encode
sizeinteger300Output image size in pixels (50-2000)

⁠WCP Compatibility

PropertyValue
WCP Version2.1.0
Widget Version1.8.0
Render modeiframe
AuthNone
Default card size4x3
Multi-instanceYes (stateless)

⁠Technical Details

PropertyValue
Base imagepython:3.12-slim
Platformslinux/amd64, linux/arm64
Port3747
FrameworkFlask
DependenciesFlask, qrcode, Pillow
Persistent storagePublished SPA only

⁠Tags

TagDescription
latestMost recent stable release
1.8.0-wcp2.1.0/widget/index directory page, audit compliance
1.7.0-wcp2.1.0/widget/health returns container name
1.6.0-wcp2.1.0WCP 2.1.0 upgrade, orchestration ID context
1.3.0-wcp2.0.0Container block, manifest image source
1.2.1-wcp1.4.0Server UUID, Container Directory, Wcp-Widget-Id
1.2.0-wcp1.3.1CORS headers, multi-instance support
1.1.0-wcp1.3.0Mandatory components array

⁠Source

Tag summary

Content type

Image

Digest

sha256:b19176b71…

Size

51.3 MB

Last updated

5 months ago

docker pull penrithbeacon/wcp-widget-qr-generator