A self-hosted update server for Chromium-based browsers, deployed on Cloudflare.
This project provides a complete solution for serving updates to your Chromium-based browser fork. It consists of:
- Admin Dashboard: A React-based web interface for managing releases, viewing update statistics, and configuring the update server.
- Update Server: A Cloudflare Worker that handles update requests from clients and serves update manifests.
- Database: Uses Cloudflare D1 for storing release information, configurations, and update request logs.
- Serve update manifests for Chromium clients using the Omaha protocol
- Fetch release information from GitHub repositories
- Support multiple update channels (stable, beta, dev)
- Monitor update requests and client statistics
- Configure GitHub integration settings
- Cache GitHub API responses for performance
- A Cloudflare account
- Cloudflare API token with appropriate permissions
- A GitHub repository for your Chromium fork releases
-
Create Cloudflare Resources:
- Create a Cloudflare Pages project
- Create a Cloudflare D1 database
- Create a Cloudflare KV namespace for caching
-
Configure GitHub Secrets: Add the following secrets to your GitHub repository:
CLOUDFLARE_API_TOKEN=your_cloudflare_api_token CLOUDFLARE_ACCOUNT_ID=your_cloudflare_account_id CLOUDFLARE_D1_ID=your_d1_database_id CLOUDFLARE_KV_ID=your_kv_namespace_id
-
Initialize Database: Run the SQL migration script to set up the database schema:
wrangler d1 execute chromium_updates --file=fine/migrations/20250414011058_create_initial_schema.sql
-
Deploy: Push to the main branch to trigger the GitHub Actions workflow, or manually run the workflow from the Actions tab.
To configure your Chromium fork to use this update server:
- Locate the update URL configuration in your Chromium source code (typically in
chrome/common/chrome_constants.cc
) - Update it to point to your Cloudflare Worker:
// Change this line: const char kBrowserUpdateURL[] = "https://tools.google.com/service/update2"; // To: const char kBrowserUpdateURL[] = "https://your-worker.your-subdomain.workers.dev/update";
-
Frontend:
npm install npm run dev
-
Worker:
cd worker npm install npm run dev
TODO: add portal authentication
MIT
- Go to GitHub Settings > Developer Settings > OAuth Apps > New OAuth App
- Fill in the application details:
- Application name: Your app name
- Homepage URL: Your frontend URL (e.g., https://your-app.pages.dev)
- Authorization callback URL: https://your-app.pages.dev/auth/callback
Important: The callback URL must be your frontend URL where the React app is hosted, NOT your worker URL.
- For local development: http://localhost:5173/auth/callback
- For production: https://your-app.pages.dev/auth/callback (or your custom domain)
- Click "Register application"
- Copy the Client ID and generate a Client Secret
-
Install Wrangler CLI if not already installed:
npm install -g wrangler
-
Login to Cloudflare:
wrangler login
-
Add secrets to Cloudflare Secret Manager:
# GitHub OAuth credentials wrangler secret put GITHUB_CLIENT_ID wrangler secret put GITHUB_CLIENT_SECRET # Database and KV credentials (if not using binding) wrangler secret put CLOUDFLARE_ACCOUNT_ID wrangler secret put CLOUDFLARE_API_TOKEN wrangler secret put CLOUDFLARE_D1_ID wrangler secret put CLOUDFLARE_KV_ID
Alternatively, you can add secrets via the Cloudflare Dashboard:
- Go to Workers & Pages > your-worker > Settings > Variables
- Click "Add variable" and select "Encrypt"
- Add each secret as an encrypted variable
-
Configure bindings in your
wrangler.toml
:[[d1_databases]] binding = "DB" database_name = "your-database-name" database_id = "your-database-id" [[kv_namespaces]] binding = "CACHE" id = "your-kv-namespace-id"
-
Deploy the worker:
npm run deploy
- Create a
.env
file in the project root:# Only the GitHub Client ID is needed in the frontend VITE_GITHUB_CLIENT_ID=your_github_client_id
For local development:
-
Create a
.env.local
file in the project root:# Frontend Environment Variables VITE_GITHUB_CLIENT_ID=your_github_client_id VITE_GITHUB_OWNER=your-org-name # The GitHub organization/user that owns the repository VITE_GITHUB_REPO=your-repo-name # The repository name containing the releases VITE_GITHUB_TOKEN=your-github-token # GitHub Personal Access Token with repo scope VITE_API_URL=http://localhost:8787 # The URL of your API server
-
Create a
wrangler.dev.toml
for local worker development:name = "your-worker-dev" main = "src/index.ts" compatibility_date = "2024-03-20" # Use Cloudflare Secret Manager values in development [vars] ENVIRONMENT = "development" # Bindings will use your production secrets from Cloudflare [[d1_databases]] binding = "DB" database_name = "your-database-name" database_id = "your-database-id" [[kv_namespaces]] binding = "CACHE" id = "your-kv-namespace-id"
-
Start the development server:
npm run dev
-
Run the worker locally (it will use your Cloudflare secrets):
npm run worker:dev
-
Your local development URLs will be:
- Frontend: http://localhost:5173
- Worker: http://localhost:8787
- GitHub OAuth Callback URL (for local dev): http://localhost:5173/auth/callback
- Use Cloudflare Secret Manager for all sensitive values
- Never store secrets in plain text in configuration files
- Only the GitHub Client ID should be in frontend environment variables
- Use encrypted environment variables in Cloudflare Dashboard
- Use bindings in
wrangler.toml
for database and KV connections - Implement rate limiting for the OAuth callback endpoint
- If authentication fails, check:
- GitHub OAuth callback URL matches your domain
- Environment variables are correctly set
- Worker is deployed and running
- Frontend is using the correct Client ID
The following environment variables must be set in a .env.local
file:
# GitHub Configuration (Required)
VITE_GITHUB_OWNER=your-org-name # The GitHub organization/user that owns the repository
VITE_GITHUB_REPO=your-repo-name # The repository name containing the releases
VITE_GITHUB_TOKEN=your-github-token # GitHub Personal Access Token with repo scope
# API Configuration
VITE_API_URL=http://localhost:8787 # The URL of your API server
These variables are required for the application to function properly and cannot be changed through the UI for security reasons.
- Create a
.env.local
file with the required environment variables - Install dependencies:
npm install
- Start the development server:
npm run dev
- GitHub repository configuration is managed through environment variables only
- User interface configuration is limited to non-sensitive settings
- Release sources are verified against predefined repositories only