Skip to content

🔧 chore: replace scratch's asset api with ours - #253

Merged
SimonShiki merged 4 commits into
dev/3.2from
feat/codingclip-infra
Aug 16, 2026
Merged

🔧 chore: replace scratch's asset api with ours#253
SimonShiki merged 4 commits into
dev/3.2from
feat/codingclip-infra

Conversation

@SimonShiki

@SimonShiki SimonShiki commented Aug 14, 2026

Copy link
Copy Markdown
Member

Description

Replace Scratch's asset api with ours, to avoid network issues in China.
Partially resolves #193. resolves #251. See #252 for translate/tts solution.

Proposed Changes

  1. GUI now adapts to and uses codingclip asset api by default.
  2. Make all tests use codingclip's asset host by default. (configurable by env var)
  3. Still use Scratch's API in ci

Test Coverage

Additional Context

Signed-off-by: SimonShiki <sinangentoo@gmail.com>
Signed-off-by: SimonShiki <sinangentoo@gmail.com>
…fault

Signed-off-by: SimonShiki <sinangentoo@gmail.com>
@SimonShiki
SimonShiki requested a review from alexcui03 August 14, 2026 10:17
@SimonShiki SimonShiki self-assigned this Aug 14, 2026

@alexcui03 alexcui03 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

cdn url should be set externally by environment variables, instead of coded in source file.

@SimonShiki

Copy link
Copy Markdown
Member Author

cdn url should be set externally by environment variables, instead of coded in source file.

cdn host is required since it's used to load assets (see community source)

@sparrowhe sparrowhe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm with comment

const NO_CACHE = process.argv.includes('--no-cache');
const ASSET_HOST = 'cdn.assets.scratch.mit.edu';
const useScratchAssetApi = !!process.env.USE_SCRATCH_ASSET_API;
const ASSET_HOST = useScratchAssetApi ? 'cdn.assets.scratch.mit.edu' : 'static.codingclip.com';

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

How about use env SCRATCH_ASSET_HOST instead of USE_SCRATCH_ASSET_API to avoid hard-coded url ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

there's little chance their asset host would change for now, i think

@alexcui03

Copy link
Copy Markdown
Member

cdn url should be set externally by environment variables, instead of coded in source file.

cdn host is required since it's used to load assets (see community source)

scratch's server should be used by default, and switching other cdn server should be customized by env var, hardcoding our cdn url in source file is not a good practise since the editor shouldn't depending on a specific running environment or platform.

the following changes should be considered:

  • change USE_SCRATCH_ASSET_API to CUSTOM_ASSET_API and allowing input as a template string, e.g. export CUSTOM_ASSET_API="https://api.example.com/fetch/{{id}}/get" (the format should be considered) (reference: electron environment variables used for changing mirror)
  • check if CUSTOM_ASSET_API is defined, and use scratch api by default

Signed-off-by: SimonShiki <sinangentoo@gmail.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 16, 2026

Copy link
Copy Markdown

Deploying clipcc-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0cab71e
Status: ✅  Deploy successful!
Preview URL: https://f2ad5bb2.clipcc-preview.pages.dev
Branch Preview URL: https://feat-codingclip-infra.clipcc-preview.pages.dev

View logs

@SimonShiki
SimonShiki merged commit 65f5677 into dev/3.2 Aug 16, 2026
8 of 9 checks passed
@SimonShiki
SimonShiki deleted the feat/codingclip-infra branch August 16, 2026 09:43
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.

VM test failed causing by network issue Switch asset & translate api from scfoundation to codingclip

3 participants