Skip to content

Commit

Permalink
file fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
kavos113 committed Sep 4, 2024
1 parent 8e5f6d1 commit 6d1320e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=M+PLUS+1p:wght@100;300;400;500;700;800;900&display=swap" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue</title>
</head>
Expand Down
10 changes: 7 additions & 3 deletions src/components/Message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ onMounted( async () => {
content.value = await marked.parse(message.value.content)
for (const stamp of message.value.stamps) {
const res = await fetch("/api/files/" + stamp.stampId)
const res = await fetch("/api/stamps/" + stamp.stampId)
const body = await res.blob()
stamp.stampUrl = URL.createObjectURL(body)
}
Expand All @@ -35,13 +35,16 @@ onMounted( async () => {
})
const extraceFileUrls = async () => {
const re = /https:\/\/q.trap.jp\/files\/([^!*]{36)/;
const re = new RegExp("https://q.trap.jp/files/[0-9a-zA-Z-]{36}");
const urls = content.value.match(re)
if(urls === null) return
for (const url of urls) {
const fileId = url.slice("https://q.trap.jp/files/".length)
const res = await fetch("/api/files/" + fileId)
const body = await res.blob()
fileUrls.value.push(URL.createObjectURL(body))
if (body.type.startsWith("image")){
fileUrls.value.push(URL.createObjectURL(body))
}
}
}
</script>
Expand Down Expand Up @@ -82,6 +85,7 @@ const extraceFileUrls = async () => {
.msg{
margin-top: 15px;
padding:5px;
font-family: "M PLUS 1p", sans-serif;
}
.msg_body {
Expand Down

0 comments on commit 6d1320e

Please sign in to comment.