Skip to content

Add Cloudflare Pages as a publishing destination #455

@livid

Description

@livid

Summary

Add Cloudflare Pages Direct Upload as an optional publishing destination, similar to the existing SSH rsync support.

User Input (minimal — 3 values)

  1. Account ID — from Cloudflare dashboard URL
  2. API Token — with Cloudflare Pages:Edit permission
  3. Project Name — the Cloudflare Pages project name

Model Changes (MyPlanetModel.swift)

Add 4 properties:

@Published var cloudflareEnabled: Bool? = false
@Published var cloudflareAccountID: String?
@Published var cloudflareAPIToken: String?
@Published var cloudflareProjectName: String?

Boilerplate touchpoints in MyPlanetModel.swift:

  • Add 4 properties
  • CodingKeys enum — add 4 cases
  • init(from decoder:) — 4 decodeIfPresent calls
  • encode(to:) — 4 encodeIfPresent calls
  • hash(into:) — 4 hasher.combine calls
  • == operator — 4 comparisons
  • importBackup — restore the 4 properties from backup

Publish Flow

In publish(), add a Cloudflare Pages path similar to the SSH rsync pattern:

  • Check cloudflareEnabled flag
  • Validate account ID, API token, and project name are present
  • Use Cloudflare Pages Direct Upload API: POST /accounts/{account_id}/pages/projects/{project_name}/deployments with files from publicBasePath as multipart upload
  • Auto-create the Pages project if it doesn't exist

UI Changes

  • Add a "Cloudflare Pages" section in the Publishing settings tab (alongside the existing SSH rsync and IPNS toggles)
  • Toggle + 3 text fields (Account ID, API Token, Project Name)

Notes

  • The Direct Upload API accepts files as multipart form data — no need for Wrangler CLI
  • Pattern follows existing integrations (Filebase, SSH rsync, etc.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions