Skip to content

Commit 9e592b2

Browse files
update supabase image url (#2822)
* refactor(images): update Supabase storage URL to custom domain * fix(changelog): rewrite image url transformation function * style(tiptap): adjust CSS indentation and image styling
1 parent 66c6fc6 commit 9e592b2

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

apps/desktop/src/components/main/body/changelog/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@ function stripFrontmatter(content: string): string {
4747
return content.trim();
4848
}
4949

50-
function stripImageLine(content: string): string {
51-
return content.replace(/^!\[.*?\]\(.*?\)\s*\n*/m, "");
50+
function fixImageUrls(content: string): string {
51+
return content.replace(
52+
/!\[([^\]]*)\]\(\/api\/images\/([^)]+)\)/g,
53+
"![$1](https://auth.hyprnote.com/storage/v1/object/public/public_images/$2)",
54+
);
5255
}
5356

5457
function addEmptyParagraphsBeforeHeaders(
@@ -188,7 +191,7 @@ function useChangelogContent(version: string) {
188191

189192
changelogFiles[key]()
190193
.then((raw) => {
191-
const markdown = stripImageLine(stripFrontmatter(raw as string));
194+
const markdown = fixImageUrls(stripFrontmatter(raw as string));
192195
const json = md2json(markdown);
193196
setContent(addEmptyParagraphsBeforeHeaders(json));
194197
setLoading(false);

apps/web/src/routes/api/images.$.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createFileRoute } from "@tanstack/react-router";
22

33
const SUPABASE_STORAGE_URL =
4-
"https://ijoptyyjrfqwaqhyxkxj.supabase.co/storage/v1/object/public/public_images";
4+
"https://auth.hyprnote.com/storage/v1/object/public/public_images";
55

66
const SAFE_SEGMENT = /^[A-Za-z0-9._+-]+$/;
77

packages/tiptap/src/styles/base.css

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,21 @@
3232
margin-bottom: 0.25rem;
3333
}
3434

35+
.tiptap-image-wrapper {
36+
padding-top: 0.5rem;
37+
padding-bottom: 0.5rem;
38+
}
39+
40+
> .tiptap-image-wrapper:first-child {
41+
padding-top: 0;
42+
}
43+
44+
> .tiptap-image-wrapper:last-child {
45+
padding-bottom: 0;
46+
}
47+
3548
.tiptap-image {
36-
max-width: 240px;
49+
max-width: 100%;
3750
height: auto;
3851
display: block;
3952
}

0 commit comments

Comments
 (0)