Skip to content

Commit

Permalink
Use new URL scheme for images.
Browse files Browse the repository at this point in the history
  • Loading branch information
RillingDev committed Aug 14, 2022
1 parent 2d2178f commit af459ec
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/ygoprodeck/api/ResourceService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ import { Environment, EnvironmentConfig, TYPES } from "@/core/lib";
export class ResourceService {
readonly #environmentConfig: EnvironmentConfig;

private static readonly YGOPRODECK_BASE_URL = "https://ygoprodeck.com";
private static readonly YGOPRODECK_IMAGE_BASE_URL =
"https://images.ygoprodeck.com/images";
private static readonly CDN_BASE_URL =
"https://storage.googleapis.com/ygoprodeck.com";

private static readonly YGOPRODECK_ASSET_BASE_URL = `${ResourceService.YGOPRODECK_BASE_URL}/pics/icons`;
private static readonly CDN_ASSET_BASE_URL = `${ResourceService.CDN_BASE_URL}/assets`;

constructor(
@inject(TYPES.EnvironmentConfig)
environmentConfig: EnvironmentConfig
Expand All @@ -32,8 +30,8 @@ export class ResourceService {
this.#environmentConfig.getEnvironment() == Environment.YGOPRODECK
) {
return initialCardImageUrl.replace(
ResourceService.CDN_BASE_URL,
ResourceService.YGOPRODECK_BASE_URL
ResourceService.CDN_BASE_URL + "/pics_small",
ResourceService.YGOPRODECK_IMAGE_BASE_URL + "/cards_small"
);
}
return initialCardImageUrl;
Expand Down Expand Up @@ -84,7 +82,7 @@ export class ResourceService {
#getAssetBaseUrl(): string {
return this.#environmentConfig.getEnvironment() ==
Environment.YGOPRODECK
? ResourceService.YGOPRODECK_ASSET_BASE_URL
: ResourceService.CDN_ASSET_BASE_URL;
? `${ResourceService.YGOPRODECK_IMAGE_BASE_URL}/cards/icons`
: `${ResourceService.CDN_BASE_URL}/assets`;
}
}

0 comments on commit af459ec

Please sign in to comment.