Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow an optional proxy #716

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions packages/playground/blueprints/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type {
CompileBlueprintOptions,
OnStepCompleted,
} from './lib/compile';
export { setPluginProxyURL } from './lib/resources';
export type {
CachedResource,
CorePluginReference,
Expand All @@ -28,11 +29,3 @@ export type {
VFSReference,
VFSResource,
} from './lib/resources';

/**
* @deprecated This function is a no-op. Playground no longer uses a proxy to download plugins and themes.
* To be removed in v0.3.0
*/
export function setPluginProxyURL() {

}
10 changes: 10 additions & 0 deletions packages/playground/blueprints/src/lib/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ export class UrlResource extends FetchResource {
}
}

let pluginProxyURL = '';
export function setPluginProxyURL(url: string) {
pluginProxyURL = url;
}
/**
* A `Resource` that represents a WordPress core theme.
*/
Expand All @@ -296,6 +300,9 @@ export class CoreThemeResource extends FetchResource {
}
getURL() {
const zipName = toDirectoryZipName(this.resource.slug);
if (pluginProxyURL !== '') {
return `${pluginProxyURL}?theme=` + zipName;
}
return `https://downloads.wordpress.org/theme/${zipName}`;
}
}
Expand All @@ -319,6 +326,9 @@ export class CorePluginResource extends FetchResource {
/** @inheritDoc */
getURL() {
const zipName = toDirectoryZipName(this.resource.slug);
if (pluginProxyURL !== '') {
return `${pluginProxyURL}?plugin=` + zipName;
}
return `https://downloads.wordpress.org/plugin/${zipName}`;
}
}
Expand Down
Loading