fix s3url

This commit is contained in:
2024-12-05 00:17:38 +08:00
parent a9d6ab7b34
commit 0460443a9d
6 changed files with 7583 additions and 6074 deletions

View File

@@ -102,5 +102,6 @@
"ts-jest": "^29.1.2",
"typescript": "^5.4.2",
"vite": "^5.2.0"
}
},
"packageManager": "pnpm@10.0.0-beta.1+sha512.629de0531b9ae9a3f8e372d014ef8f5a57906d9a48095ced54bbfbd246b4136381478032c8d13819fd1eedde8330517a799ea6756eedd9a136e36524fa3083cf"
}

13634
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,4 @@
import { useContextFix } from "@/hooks/useContentFix";
import { Badge, Card, Group, Image, Text } from "@mantine/core";
import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime";
@@ -14,6 +15,8 @@ export function ParagraphCard({
id,
}: Paragraph) {
const url = `/paragraph/${id}`;
cover = useContextFix(cover);
return (
<Card withBorder radius="md" padding="lg" shadow="sm">
<Card.Section>

View File

@@ -0,0 +1,9 @@
import { useAppSelector } from "@/store";
export function useContextFix(content: string) {
const { s3Url } = useAppSelector((state) => state.options);
return content.replace(
/https?:\/\/(?:minio-hdd)\.yoshino-s\.(?:online|xyz)\//g,
s3Url,
);
}

View File

@@ -1,3 +1,4 @@
import { useContextFix } from "@/hooks/useContentFix";
import {
Badge,
Container,
@@ -54,9 +55,10 @@ dayjs.extend(relativeTime);
export default function ParagraphPage() {
const paragraph = useLoaderData() as Paragraph;
console.log(paragraph);
const content = stripStyles(paragraph.content);
let content = stripStyles(paragraph.content);
content = useContextFix(content);
return (
<Container py="2rem">

View File

@@ -10,7 +10,7 @@ const initialState: OptionsState = {
meilisearchUrl: "https://meilisearch.yoshino-s.xyz/",
meilisearchToken:
"a568afad53a4dd124c508b9acd26ec35ff65665c07020913533cd7b176a28a04",
s3Url: "https://minio-hdd.yoshino-s.xyz",
s3Url: "https://minio-hdd.yoshino-s.xyz/",
};
const optionsSlice = createSlice({