Skip to content

Add configurable paste service URL for self-hosting#582

Merged
backnotprop merged 2 commits intomainfrom
claude/fix-hardcoded-domains-Z0wRm
Apr 18, 2026
Merged

Add configurable paste service URL for self-hosting#582
backnotprop merged 2 commits intomainfrom
claude/fix-hardcoded-domains-Z0wRm

Conversation

@backnotprop
Copy link
Copy Markdown
Owner

@backnotprop backnotprop commented Apr 18, 2026

closes #580

Summary

This PR adds support for configuring a custom paste service URL, enabling self-hosted deployments to use their own paste service instead of the default hosted instance.

Key Changes

  • Added getPasteApiUrl() function in the OpenCode plugin that reads from the PLANNOTATOR_PASTE_URL environment variable
  • Updated CommandDeps interface to include the new getPasteApiUrl dependency
  • Propagated pasteApiUrl through all command handlers (handleAnnotateCommand, handleAnnotateLastCommand, handleArchiveCommand) and the review server initialization
  • Updated Landing component to accept and use shareBaseUrl prop for the demo link, with fallback to the default hosted URL
  • Added documentation in the OpenCode plugin README for the new PLANNOTATOR_PASTE_URL environment variable
  • Updated Cloudflare Workers configuration (wrangler.toml) with comments explaining CORS configuration for self-hosters
  • Enhanced CORS documentation in paste-service/core/cors.ts with guidance for self-hosted deployments
  • Extended review server options to accept and pass through pasteApiUrl configuration

Implementation Details

  • The paste API URL defaults to undefined, allowing the UI to use its own default (https://plannotator-paste.plannotator.workers.dev)
  • Configuration follows the same pattern as the existing PLANNOTATOR_SHARE_URL for consistency
  • Added helpful comments in configuration files to guide self-hosters on proper setup
  • The change is backward compatible - existing deployments continue to work without any configuration changes

…mo link

OpenCode plugin only read PLANNOTATOR_SHARE_URL; add a getPasteApiUrl helper
and thread it into plan/annotate/archive server starts. Pi extension's
serverReview gains the same shareBaseUrl/pasteApiUrl env-var pair already
used by serverPlan/serverAnnotate. Landing.tsx now accepts a shareBaseUrl
prop for self-hosters' demo link. Paste-service CORS defaults grow a
comment clarifying that self-hosters must override ALLOWED_ORIGINS.
Copy link
Copy Markdown
Owner Author

@backnotprop backnotprop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review from Plannotator

Comment on lines +12 to 15
# Default values target the hosted plannotator.ai deployment.
# Self-hosters must override ALLOWED_ORIGINS to point at their own portal,
# either by editing this file or setting it via `wrangler secret put`.
ALLOWED_ORIGINS = "https://share.plannotator.ai,http://localhost:3001"
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (blocking): This needs documentation

Comment on lines +7 to 13
// Defaults target the hosted plannotator.ai deployment.
// Self-hosters should set PASTE_ALLOWED_ORIGINS (Bun) or ALLOWED_ORIGINS (Cloudflare)
// to their own portal origin so requests from the hosted share.plannotator.ai
// portal are not granted CORS access against their service.
export function getAllowedOrigins(envValue?: string): string[] {
if (envValue) {
return envValue.split(",").map((o) => o.trim());
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (blocking): This needs documentation

When PLANNOTATOR_PASTE_URL is set to a non-default paste service, the
generated short link now includes a base64url-encoded paste param in the
fragment (#key=...&paste=...). The share portal and importFromShareUrl
extract it on load so they can fetch from the right paste backend without
needing a server — fixing broken short links for self-hosters who use a
custom paste service but keep the hosted share portal.

Backward compatible: links without a paste param continue to use the
default or server-provided paste API URL as before.

For provenance purposes, this commit was AI assisted.
@backnotprop backnotprop merged commit ea758f9 into main Apr 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hardcoded share.plannotator.ai URL Prevents Custom Domain Usage

2 participants