Skip to content

Commit 0e36b51

Browse files
committed
Added transformer usages for hard-coded TS URLs
1 parent ce50431 commit 0e36b51

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/components/v2/OnlinePreviewPanel.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { ExternalLink } from '../all';
1010
import R2Error from '../../model/errors/R2Error';
1111
import { getFullDependencyList, InstallMode } from '../../utils/DependencyUtils';
1212
import { getStore } from '../../providers/generic/store/StoreProvider';
13+
import { transformPackageUrl } from '../../providers/cdn/PackageUrlTransformer';
1314
1415
const store = getStore<State>();
1516
@@ -35,8 +36,7 @@ function setActiveTab(tab: "README" | "CHANGELOG" | "Dependencies") {
3536
}
3637
3738
function fetchDataFor(mod: ThunderstoreMod, type: "readme" | "changelog"): Promise<string> {
38-
console.log("Type:", type);
39-
return fetch(`https://thunderstore.io/api/cyberstorm/package/${mod.getOwner()}/${mod.getName()}/latest/${type}/`)
39+
return fetch(transformPackageUrl(`https://thunderstore.io/api/cyberstorm/package/${mod.getOwner()}/${mod.getName()}/latest/${type}/`))
4040
.then(res => {
4141
if (!res.ok) {
4242
throw new Error(`No ${type} available for ${mod.getName()}`)
@@ -47,7 +47,6 @@ function fetchDataFor(mod: ThunderstoreMod, type: "readme" | "changelog"): Promi
4747
}
4848
4949
function fetchReadme(modToLoad: ThunderstoreMod) {
50-
// TODO - Make sure that this is null on fetch failure.
5150
readmeError.value = null;
5251
readme.value = null;
5352
return fetchDataFor(props.mod, "readme").then(res => {

src/r2mm/profiles/ProfilesClient.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import Axios, { AxiosResponse } from 'axios';
22
import R2Error from '../../model/errors/R2Error';
33
import CdnProvider from '../../providers/generic/connection/CdnProvider';
4+
import { transformPackageUrl } from '../../providers/cdn/PackageUrlTransformer';
45

56
const getProfileUrl = (profileImportCode: string): string => {
6-
return `https://thunderstore.io/api/experimental/legacyprofile/get/${profileImportCode}/`;
7+
return transformPackageUrl(`https://thunderstore.io/api/experimental/legacyprofile/get/${profileImportCode}/`);
78
}
89

910
function formatApiError<T>(e: T, genericTitle: string): R2Error | T {
@@ -53,7 +54,7 @@ async function handleApiErrors<I, J>(
5354

5455
function createProfile(payload: string): Promise<AxiosResponse<{ key: string }>> {
5556
return handleApiErrors(Axios.post(
56-
"https://thunderstore.io/api/experimental/legacyprofile/create/",
57+
transformPackageUrl("https://thunderstore.io/api/experimental/legacyprofile/create/"),
5758
payload,
5859
{
5960
headers: { 'Content-Type': 'application/octet-stream' }

0 commit comments

Comments
 (0)