[PR #32232] feat: add Creators Platform helper for DSL upload and OAuth redirect (Vibe Kanban) #33620

Closed
opened 2026-02-21 20:53:36 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/32232

State: closed
Merged: Yes


Summary

Add core/helper/creators.py module to enable publishing Dify applications as templates to the Creators Platform. This is the Dify-side integration that allows users to click "Publish to Marketplace" from the app editor and be redirected to the Creators Platform with their DSL pre-loaded.

What was changed

New configuration (CreatorsPlatformConfig):

  • CREATORS_PLATFORM_FEATURES_ENABLED — feature flag (default: true)
  • CREATORS_PLATFORM_API_URL — API endpoint for the Creators Platform (default: https://creators.dify.ai)
  • CREATORS_PLATFORM_OAUTH_CLIENT_ID — OAuth client ID for auto-login (optional, only for Dify Cloud)

New helper module (api/core/helper/creators.py):

  • upload_dsl(dsl_file_bytes, filename) — Uploads a DSL file (YAML or ZIP) to the Creators Platform's anonymous upload endpoint, returns a claim_code
  • get_redirect_url(user_account_id, claim_code) — Generates a redirect URL to the Creators Platform frontend with the dsl_claim_code parameter. If CREATORS_PLATFORM_OAUTH_CLIENT_ID is configured (Dify Cloud), also signs an OAuth authorization code for automatic authentication

Why

This enables the full "Publish to Marketplace" flow from Dify to the Creators Platform:

  1. Dify Cloud: User clicks publish → DSL is uploaded → OAuth code is signed → user is redirected to Creators Platform and automatically logged in with the DSL pre-filled in the template creation form
  2. Self-hosted Dify: User clicks publish → DSL is uploaded → user is redirected to Creators Platform (without OAuth code) → user logs in manually → DSL is claimed and pre-filled

The OAuth code is intentionally optional to support both deployment modes. The dsl_claim_code is managed entirely on the frontend side (stored in localStorage with a 30-minute expiry).

Implementation details

  • Follows the existing core/helper/marketplace.py pattern for external service integration
  • Uses httpx for HTTP requests and yarl for URL construction (consistent with marketplace helper)
  • OAuth code signing uses the existing OAuthServerService.sign_oauth_authorization_code() — imported lazily to avoid circular dependencies when OAuth is not configured
  • The Creators Platform's existing POST /api/v1/templates/anonymous-upload endpoint handles the DSL storage with a 30-minute Redis TTL

Files changed

File Change
api/configs/feature/__init__.py New CreatorsPlatformConfig class, added to FeatureConfig
api/.env.example New configuration variables
api/core/helper/creators.py New fileupload_dsl() and get_redirect_url()

This PR was written using Vibe Kanban

**Original Pull Request:** https://github.com/langgenius/dify/pull/32232 **State:** closed **Merged:** Yes --- ## Summary Add `core/helper/creators.py` module to enable publishing Dify applications as templates to the [Creators Platform](https://creators.dify.ai). This is the Dify-side integration that allows users to click "Publish to Marketplace" from the app editor and be redirected to the Creators Platform with their DSL pre-loaded. ### What was changed **New configuration** (`CreatorsPlatformConfig`): - `CREATORS_PLATFORM_FEATURES_ENABLED` — feature flag (default: `true`) - `CREATORS_PLATFORM_API_URL` — API endpoint for the Creators Platform (default: `https://creators.dify.ai`) - `CREATORS_PLATFORM_OAUTH_CLIENT_ID` — OAuth client ID for auto-login (optional, only for Dify Cloud) **New helper module** (`api/core/helper/creators.py`): - `upload_dsl(dsl_file_bytes, filename)` — Uploads a DSL file (YAML or ZIP) to the Creators Platform's anonymous upload endpoint, returns a `claim_code` - `get_redirect_url(user_account_id, claim_code)` — Generates a redirect URL to the Creators Platform frontend with the `dsl_claim_code` parameter. If `CREATORS_PLATFORM_OAUTH_CLIENT_ID` is configured (Dify Cloud), also signs an OAuth authorization code for automatic authentication ### Why This enables the full "Publish to Marketplace" flow from Dify to the Creators Platform: 1. **Dify Cloud**: User clicks publish → DSL is uploaded → OAuth code is signed → user is redirected to Creators Platform and automatically logged in with the DSL pre-filled in the template creation form 2. **Self-hosted Dify**: User clicks publish → DSL is uploaded → user is redirected to Creators Platform (without OAuth code) → user logs in manually → DSL is claimed and pre-filled The OAuth code is intentionally optional to support both deployment modes. The `dsl_claim_code` is managed entirely on the frontend side (stored in localStorage with a 30-minute expiry). ### Implementation details - Follows the existing `core/helper/marketplace.py` pattern for external service integration - Uses `httpx` for HTTP requests and `yarl` for URL construction (consistent with marketplace helper) - OAuth code signing uses the existing `OAuthServerService.sign_oauth_authorization_code()` — imported lazily to avoid circular dependencies when OAuth is not configured - The Creators Platform's existing `POST /api/v1/templates/anonymous-upload` endpoint handles the DSL storage with a 30-minute Redis TTL ### Files changed | File | Change | |------|--------| | `api/configs/feature/__init__.py` | New `CreatorsPlatformConfig` class, added to `FeatureConfig` | | `api/.env.example` | New configuration variables | | `api/core/helper/creators.py` | **New file** — `upload_dsl()` and `get_redirect_url()` | --- This PR was written using [Vibe Kanban](https://vibekanban.com)
yindo added the pull-request label 2026-02-21 20:53:36 -05:00
yindo closed this issue 2026-02-21 20:53:37 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33620