Skip to content

Commit 8f0d351

Browse files
committed
edges: Fix EC url on local
web,api: Fix edge URLs for issue numbers with spaces Apply lint
1 parent b108c78 commit 8f0d351

File tree

6 files changed

+18
-20
lines changed

6 files changed

+18
-20
lines changed

apps/edges/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
EDGECREATOR_URL=http://host.docker.internal:3002
1+
EDGECREATOR_URL=http://localhost:3002

apps/web/src/components/BookcaseBook.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const edgeUrl = computed(
138138
`${import.meta.env.VITE_EDGES_ROOT}${issue.value.publicationcode.replace(
139139
"/",
140140
"/gen/",
141-
)}.${issue.value.issuenumber}.png`,
141+
)}.${issue.value.issuenumber.replaceAll(" ", "")}.png`,
142142
);
143143
const currentIssueEntryDetails = computed(
144144
() => issueDetails.value?.[issuecode],
@@ -181,13 +181,13 @@ const bookClosed = () => {
181181
182182
watch(currentPage, (newValue) => {
183183
currentTabIndex.value = entries.value?.findIndex(
184-
(entry) => entry.storycode === pagesWithUrl.value[newValue].storycode,
184+
(entry) => entry.storycode === pagesWithUrl.value[newValue]?.storycode,
185185
);
186186
});
187187
188188
watch(currentTabIndex, (newValue) => {
189189
currentPage.value = pagesWithUrl.value.findIndex(
190-
(page) => page.storycode === entries.value[newValue].storycode,
190+
(page) => page.storycode === entries.value[newValue]?.storycode,
191191
);
192192
});
193193

apps/web/src/pages/admin/edges/progress.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const getEdgeUrl = (issuecode: string): string => {
146146
const [country, magazine] = publicationcode.split("/");
147147
return `${
148148
import.meta.env.VITE_EDGES_ROOT
149-
}/${country}/gen/${magazine}.${issuenumber}.png`;
149+
}/${country}/gen/${magazine}.${issuenumber.replaceAll(" ", "")}.png`;
150150
};
151151
const open = (inducksIssuecode: string) => {
152152
if (

packages/api/scripts/group-entryurl-files-by-storycode.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
import path from "path";
21
import dotenv from "dotenv";
2+
import path from "path";
33

44
dotenv.config({
55
path: ".env",
66
});
77

8-
import { existsSync, linkSync, mkdirSync, readdirSync } from "fs";
9-
import type {
10-
inducks_storyversion,
11-
} from "~prisma-schemas/client_coa/client";
12-
import { prismaClient as prismaCoa } from "~prisma-schemas/schemas/coa/client";
8+
import { existsSync, mkdirSync, readdirSync } from "fs";
139

10+
import type { inducks_storyversion } from "~prisma-schemas/client_coa/client";
11+
import { prismaClient as prismaCoa } from "~prisma-schemas/schemas/coa/client";
1412

1513
declare global {
1614
interface ImportMeta {
@@ -39,7 +37,7 @@ for (const file of files) {
3937
const storycode = (
4038
await prismaCoa.$queryRaw<
4139
{
42-
storycode: inducks_storyversion['storycode'];
40+
storycode: inducks_storyversion["storycode"];
4341
}[]
4442
>`
4543
SELECT sv.storycode
@@ -58,13 +56,13 @@ WHERE sitecode = 'webusers'
5856
}
5957
if (existsSync(path.join(storycodeDir, file.name))) {
6058
console.debug(`File already exists for ${relativePath}`);
61-
}
62-
else {
63-
console.log(`ln -s '${path.join(root, relativePath)}' '${path.join(storycodeDir, file.name)}'`);
59+
} else {
60+
console.log(
61+
`ln -s '${path.join(root, relativePath)}' '${path.join(storycodeDir, file.name)}'`,
62+
);
6463
}
6564
console.log(`Linked ${relativePath} to ${storycodeDir}`);
66-
}
67-
else {
65+
} else {
6866
console.debug(`Storycode not found for ${relativePath}`);
6967
}
70-
}
68+
}

packages/api/services/edgecreator/edge-publication/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export default () => ({
5858
edgeId,
5959
isNew,
6060
contributors,
61-
url: `${process.env.VITE_EDGES_ROOT}/${country}/gen/${magazine}.${issuenumber}.png`,
61+
url: `${process.env.VITE_EDGES_ROOT}/${country}/gen/${magazine}.${issuenumber.replaceAll(" ", "")}.png`,
6262
};
6363
},
6464
});

packages/api/services/edgecreator/edge-sprites/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default () => ({
5959

6060
console.log(`Uploading edge with ID ${id} and slug ${slug}...`);
6161
await cloudinaryV2.uploader.upload(
62-
`${process.env.VITE_EDGES_ROOT}${countrycode}/gen/${magazinecode}.${issuenumber}.png`,
62+
`${process.env.VITE_EDGES_ROOT}${countrycode}/gen/${magazinecode}.${issuenumber.replaceAll(" ", "")}.png`,
6363
{
6464
public_id: slug!,
6565
},

0 commit comments

Comments
 (0)