From a54d592038df2578cdcd7eae104c34101f708e8d Mon Sep 17 00:00:00 2001 From: Ilya Y <75578537+ilya-bkv@users.noreply.github.com> Date: Fri, 27 Oct 2023 21:50:13 +0300 Subject: [PATCH] Feature/thumbor (#284) * thumbor integration * disabled lazy loading for some images * add profile userpic upload error message --------- Co-authored-by: Igor Lobanov --- api/image.mjs | 24 ------------ package.json | 3 +- .../Article/AudioHeader/AudioHeader.tsx | 4 +- .../Article/AudioPlayer/AudioPlayer.tsx | 4 +- src/components/Article/FullArticle.tsx | 6 ++- .../Author/Userpic/Userpic.module.scss | 7 ---- src/components/Author/Userpic/Userpic.tsx | 39 ++++++------------- src/components/Editor/Editor.tsx | 7 ++-- src/components/Editor/SimplifiedEditor.tsx | 3 +- .../UploadModalContent/UploadModalContent.tsx | 23 +++++++---- .../Feed/ArticleCard/ArticleCard.module.scss | 1 + .../Feed/ArticleCard/ArticleCard.tsx | 10 ++--- src/components/Inbox/DialogAvatar.tsx | 7 +++- src/components/Nav/Header/Header.module.scss | 10 +++-- .../Topic/TopicBadge/TopicBadge.tsx | 8 +++- .../Views/Author/Author.module.scss | 5 ++- src/components/Views/Author/Author.tsx | 1 - src/components/Views/Edit.tsx | 6 ++- .../Views/PublishSettings/PublishSettings.tsx | 8 +--- .../CheckButton/CheckButton.module.scss | 2 + src/components/_shared/DropArea/DropArea.tsx | 4 +- .../FloatingPanel/FloatingPanel.module.scss | 4 -- src/components/_shared/Image/Image.tsx | 17 +++++--- .../_shared/Popup/Popup.module.scss | 2 + .../_shared/SolidSwiper/SolidSwiper.tsx | 13 ++++--- .../_shared/SolidSwiper/Swiper.module.scss | 14 ++++--- src/pages/index.page.tsx | 6 ++- src/pages/profile/Settings.module.scss | 12 +++++- src/pages/profile/profileSettings.page.tsx | 12 ++++-- src/utils/config.ts | 3 ++ src/utils/getImageUrl.ts | 29 ++++++++++++++ src/utils/handleImageUpload.ts | 22 +++++++++++ src/utils/imageProxy.ts | 8 ---- src/utils/renderUploadedImage.ts | 3 +- 34 files changed, 186 insertions(+), 141 deletions(-) delete mode 100644 api/image.mjs create mode 100644 src/utils/getImageUrl.ts create mode 100644 src/utils/handleImageUpload.ts delete mode 100644 src/utils/imageProxy.ts diff --git a/api/image.mjs b/api/image.mjs deleted file mode 100644 index 6311d618..00000000 --- a/api/image.mjs +++ /dev/null @@ -1,24 +0,0 @@ -import fetch from 'node-fetch' - -export default async function handler(req, res) { - const imageUrl = req.query.url - - if (!imageUrl) { - return res.status(400).send('Missing URL parameter') - } - - try { - const imageRes = await fetch(imageUrl) - - if (!imageRes.ok) { - return res.status(404).send('Image not found') - } - - res.setHeader('Content-Type', imageRes.headers.get('content-type')) - - imageRes.body.pipe(res) - } catch (err) { - console.error(err) - return res.status(404).send('Error') - } -} diff --git a/package.json b/package.json index 789d8af9..988290eb 100644 --- a/package.json +++ b/package.json @@ -34,8 +34,7 @@ "i18next-icu": "2.3.0", "intl-messageformat": "10.5.3", "just-throttle": "4.2.0", - "mailgun.js": "8.2.1", - "node-fetch": "3.3.1" + "mailgun.js": "8.2.1" }, "devDependencies": { "@babel/core": "7.21.8", diff --git a/src/components/Article/AudioHeader/AudioHeader.tsx b/src/components/Article/AudioHeader/AudioHeader.tsx index 09f80bd9..ac8f38d4 100644 --- a/src/components/Article/AudioHeader/AudioHeader.tsx +++ b/src/components/Article/AudioHeader/AudioHeader.tsx @@ -1,11 +1,11 @@ import { clsx } from 'clsx' import styles from './AudioHeader.module.scss' -import { imageProxy } from '../../../utils/imageProxy' import { MediaItem } from '../../../pages/types' import { createSignal, Show } from 'solid-js' import { Icon } from '../../_shared/Icon' import { Topic } from '../../../graphql/types.gen' import { CardTopic } from '../../Feed/CardTopic' +import { Image } from '../../_shared/Image' type Props = { title: string @@ -19,7 +19,7 @@ export const AudioHeader = (props: Props) => { return (
- {props.title} + {props.title}
- {title + {title}
diff --git a/src/components/Inbox/DialogAvatar.tsx b/src/components/Inbox/DialogAvatar.tsx index a04a058c..bb3382dc 100644 --- a/src/components/Inbox/DialogAvatar.tsx +++ b/src/components/Inbox/DialogAvatar.tsx @@ -2,7 +2,7 @@ import { Show, createMemo } from 'solid-js' import './DialogCard.module.scss' import styles from './DialogAvatar.module.scss' import { clsx } from 'clsx' -import { imageProxy } from '../../utils/imageProxy' +import { getImageUrl } from '../../utils/getImageUrl' type Props = { name: string @@ -47,7 +47,10 @@ const DialogAvatar = (props: Props) => { style={{ 'background-color': `${randomBg()}` }} > {nameFirstLetter()}}> -
+
) diff --git a/src/components/Nav/Header/Header.module.scss b/src/components/Nav/Header/Header.module.scss index 4537f844..37a11d66 100644 --- a/src/components/Nav/Header/Header.module.scss +++ b/src/components/Nav/Header/Header.module.scss @@ -114,6 +114,7 @@ .mainNavigationWrapper { @include font-size(1.7rem); + position: relative; @include media-breakpoint-down(lg) { @@ -127,7 +128,7 @@ .mainNavigation { font-size: 1.4rem !important; - //margin: 0 0 0 -0.4rem !important; + // margin: 0 0 0 -0.4rem !important; opacity: 1; transition: opacity 0.3s; @@ -202,7 +203,7 @@ li { margin-bottom: 0 !important; - &:first-letter { + &::first-letter { text-transform: capitalize; } } @@ -293,7 +294,7 @@ .burgerContainer { box-sizing: content-box; display: inline-flex; - //float: right; + // float: right; padding-left: 0; @include media-breakpoint-up(sm) { @@ -383,6 +384,7 @@ .articleHeader { @include font-size(1.4rem); + left: $container-padding-x; margin: 0.2em 0; overflow: hidden; @@ -624,7 +626,7 @@ } a:hover { - //background-color: var(--link-hover-background) !important; + // background-color: var(--link-hover-background) !important; } } diff --git a/src/components/Topic/TopicBadge/TopicBadge.tsx b/src/components/Topic/TopicBadge/TopicBadge.tsx index a96f34e8..c76f60b3 100644 --- a/src/components/Topic/TopicBadge/TopicBadge.tsx +++ b/src/components/Topic/TopicBadge/TopicBadge.tsx @@ -2,12 +2,12 @@ import { clsx } from 'clsx' import styles from './TopicBadge.module.scss' import { FollowingEntity, Topic } from '../../../graphql/types.gen' import { createMemo, createSignal, Show } from 'solid-js' -import { imageProxy } from '../../../utils/imageProxy' import { Button } from '../../_shared/Button' import { useSession } from '../../../context/session' import { useLocalize } from '../../../context/localize' import { follow, unfollow } from '../../../stores/zine/common' import { CheckButton } from '../../_shared/CheckButton' +import { getImageUrl } from '../../../utils/getImageUrl' type Props = { topic: Topic @@ -43,7 +43,11 @@ export const TopicBadge = (props: Props) => { {props.topic.title} diff --git a/src/components/Views/Author/Author.module.scss b/src/components/Views/Author/Author.module.scss index a9215987..a898c9db 100644 --- a/src/components/Views/Author/Author.module.scss +++ b/src/components/Views/Author/Author.module.scss @@ -30,12 +30,14 @@ .ratingContainer { @include font-size(1.5rem); + display: inline-flex; vertical-align: top; } .ratingControl { @include font-size(1.5rem); + display: inline-flex; margin-left: 1em; vertical-align: middle; @@ -103,10 +105,11 @@ } .longBioExpandedControl { + @include font-size(1.6rem); + border-radius: 1.2rem; display: block; height: auto; - @include font-size(1.6rem); padding-bottom: 1.2rem; padding-top: 1.2rem; position: relative; diff --git a/src/components/Views/Author/Author.tsx b/src/components/Views/Author/Author.tsx index 3fd947b3..f0e432ca 100644 --- a/src/components/Views/Author/Author.tsx +++ b/src/components/Views/Author/Author.tsx @@ -17,7 +17,6 @@ import { Comment } from '../../Article/Comment' import { useLocalize } from '../../../context/localize' import { AuthorRatingControl } from '../../Author/AuthorRatingControl' import { getPagePath } from '@nanostores/router' -import { useSession } from '../../../context/session' import { Loading } from '../../_shared/Loading' type Props = { diff --git a/src/components/Views/Edit.tsx b/src/components/Views/Edit.tsx index 5a1eafe3..0ada4297 100644 --- a/src/components/Views/Edit.tsx +++ b/src/components/Views/Edit.tsx @@ -8,7 +8,6 @@ import { ShoutForm, useEditorContext } from '../../context/editor' import { Editor, Panel } from '../Editor' import { Icon } from '../_shared/Icon' import styles from './Edit.module.scss' -import { imageProxy } from '../../utils/imageProxy' import { GrowingTextarea } from '../_shared/GrowingTextarea' import { VideoUploader } from '../Editor/VideoUploader' import { AudioUploader } from '../Editor/AudioUploader' @@ -24,6 +23,7 @@ import { createStore } from 'solid-js/store' import SimplifiedEditor from '../Editor/SimplifiedEditor' import { isDesktop } from '../../utils/media-query' import { TableOfContents } from '../TableOfContents' +import { getImageUrl } from '../../utils/getImageUrl' type Props = { shout: Shout @@ -362,7 +362,9 @@ export const EditView = (props: Props) => { >
diff --git a/src/components/Views/PublishSettings/PublishSettings.tsx b/src/components/Views/PublishSettings/PublishSettings.tsx index b9f62582..de277609 100644 --- a/src/components/Views/PublishSettings/PublishSettings.tsx +++ b/src/components/Views/PublishSettings/PublishSettings.tsx @@ -4,7 +4,6 @@ import { createSignal, onMount, Show } from 'solid-js' import { TopicSelect, UploadModalContent } from '../../Editor' import { Button } from '../../_shared/Button' import { hideModal, showModal } from '../../../stores/ui' -import { imageProxy } from '../../../utils/imageProxy' import { ShoutForm, useEditorContext } from '../../../context/editor' import { useLocalize } from '../../../context/localize' import { Modal } from '../../Nav/Modal' @@ -20,6 +19,7 @@ import { GrowingTextarea } from '../../_shared/GrowingTextarea' import { createStore } from 'solid-js/store' import { UploadedFile } from '../../../pages/types' import SimplifiedEditor, { MAX_DESCRIPTION_LIMIT } from '../../Editor/SimplifiedEditor' +import { Image } from '../../_shared/Image' type Props = { shoutId: number @@ -141,11 +141,7 @@ export const PublishSettings = (props: Props) => { >
- {initialData.title} + {initialData.title}
diff --git a/src/components/_shared/CheckButton/CheckButton.module.scss b/src/components/_shared/CheckButton/CheckButton.module.scss index d62742f1..f7d6fd94 100644 --- a/src/components/_shared/CheckButton/CheckButton.module.scss +++ b/src/components/_shared/CheckButton/CheckButton.module.scss @@ -21,9 +21,11 @@ &:hover { background: var(--background-color-invert); color: var(--default-color-invert); + .check { display: none; } + .close { display: block; } diff --git a/src/components/_shared/DropArea/DropArea.tsx b/src/components/_shared/DropArea/DropArea.tsx index 2430d46b..8b0ca6e6 100644 --- a/src/components/_shared/DropArea/DropArea.tsx +++ b/src/components/_shared/DropArea/DropArea.tsx @@ -7,6 +7,7 @@ import { validateFiles } from '../../../utils/validateFile' import type { FileTypeToUpload } from '../../../pages/types' import { handleFileUpload } from '../../../utils/handleFileUpload' import { UploadedFile } from '../../../pages/types' +import { handleImageUpload } from '../../../utils/handleImageUpload' type Props = { class?: string @@ -30,7 +31,8 @@ export const DropArea = (props: Props) => { const results: UploadedFile[] = [] for (const file of files) { - const result = await handleFileUpload(file) + const handler = props.fileType === 'image' ? handleImageUpload : handleFileUpload + const result = await handler(file) results.push(result) } props.onUpload(results) diff --git a/src/components/_shared/FloatingPanel/FloatingPanel.module.scss b/src/components/_shared/FloatingPanel/FloatingPanel.module.scss index b21e0326..f5e72ec7 100644 --- a/src/components/_shared/FloatingPanel/FloatingPanel.module.scss +++ b/src/components/_shared/FloatingPanel/FloatingPanel.module.scss @@ -3,18 +3,14 @@ bottom: 20px; left: 0; right: 0; - display: none; align-items: center; justify-content: space-between; - max-width: 430px; width: auto; height: auto; - margin: 0 auto; padding: 14px; - background-color: var(--background-color); border: 2px solid black; diff --git a/src/components/_shared/Image/Image.tsx b/src/components/_shared/Image/Image.tsx index fa957458..df5ae79c 100644 --- a/src/components/_shared/Image/Image.tsx +++ b/src/components/_shared/Image/Image.tsx @@ -1,9 +1,16 @@ import { splitProps } from 'solid-js' import type { JSX } from 'solid-js' -import { imageProxy } from '../../../utils/imageProxy' +import { getImageUrl } from '../../../utils/getImageUrl' -export const Image = (props: JSX.ImgHTMLAttributes) => { - const [local, others] = splitProps(props, ['src']) - - return +type Props = JSX.ImgHTMLAttributes & { + width: number + alt: string +} + +export const Image = (props: Props) => { + const [local, others] = splitProps(props, ['src', 'alt']) + + const src = getImageUrl(local.src, { width: others.width }) + + return {local.alt} } diff --git a/src/components/_shared/Popup/Popup.module.scss b/src/components/_shared/Popup/Popup.module.scss index 79985fd6..0bdde227 100644 --- a/src/components/_shared/Popup/Popup.module.scss +++ b/src/components/_shared/Popup/Popup.module.scss @@ -31,6 +31,7 @@ &.bordered { @include font-size(1.6rem); + border: 2px solid #000; padding: 2.4rem; @@ -45,6 +46,7 @@ &.tiny { @include font-size(1.4rem); + box-shadow: 0 4px 60px rgb(0 0 0 / 10%); padding: 1rem; diff --git a/src/components/_shared/SolidSwiper/SolidSwiper.tsx b/src/components/_shared/SolidSwiper/SolidSwiper.tsx index 0c670873..faad65d5 100644 --- a/src/components/_shared/SolidSwiper/SolidSwiper.tsx +++ b/src/components/_shared/SolidSwiper/SolidSwiper.tsx @@ -9,14 +9,15 @@ import { createFileUploader } from '@solid-primitives/upload' import SwiperCore, { Manipulation, Navigation, Pagination } from 'swiper' import { SwiperRef } from './swiper' import { validateFiles } from '../../../utils/validateFile' -import { handleFileUpload } from '../../../utils/handleFileUpload' import { useSnackbar } from '../../../context/snackbar' import { Loading } from '../Loading' -import { imageProxy } from '../../../utils/imageProxy' import { clsx } from 'clsx' import styles from './Swiper.module.scss' import { composeMediaItems } from '../../../utils/composeMediaItems' import SimplifiedEditor from '../../Editor/SimplifiedEditor' +import { handleImageUpload } from '../../../utils/handleImageUpload' +import { getImageUrl } from '../../../utils/getImageUrl' +import { Image } from '../Image' type Props = { images: MediaItem[] @@ -95,7 +96,7 @@ export const SolidSwiper = (props: Props) => { setLoading(true) const results: UploadedFile[] = [] for (const file of selectedFiles) { - const result = await handleFileUpload(file) + const result = await handleImageUpload(file) results.push(result) } props.onImagesAdd(composeMediaItems(results)) @@ -172,7 +173,7 @@ export const SolidSwiper = (props: Props) => { // @ts-ignore
- {slide.title} + {slide.title} {(triggerRef: (el) => void) => ( @@ -232,7 +233,9 @@ export const SolidSwiper = (props: Props) => {
diff --git a/src/components/_shared/SolidSwiper/Swiper.module.scss b/src/components/_shared/SolidSwiper/Swiper.module.scss index 33a4eb1e..44ecd210 100644 --- a/src/components/_shared/SolidSwiper/Swiper.module.scss +++ b/src/components/_shared/SolidSwiper/Swiper.module.scss @@ -82,6 +82,10 @@ $navigation-reserve: 32px; &.editorMode { color: #0d0d0d; + + .holder { + width: 100%; + } } .action { @@ -112,6 +116,7 @@ $navigation-reserve: 32px; .counter { @include font-size(1.2rem); + position: absolute; z-index: 2; top: 477px; @@ -139,11 +144,6 @@ $navigation-reserve: 32px; display: flex; } } - &.editorMode { - .holder { - width: 100%; - } - } .navigation { background: rgb(0 0 0 / 40%); @@ -253,7 +253,9 @@ $navigation-reserve: 32px; background-color: var(--placeholder-color-semi); opacity: 0.5; filter: grayscale(1); - transition: filter 0.3s ease-in-out, opacity 0.5s ease-in-out; + transition: + filter 0.3s ease-in-out, + opacity 0.5s ease-in-out; .thumbAction { display: none; diff --git a/src/pages/index.page.tsx b/src/pages/index.page.tsx index d3aada42..c086cb46 100644 --- a/src/pages/index.page.tsx +++ b/src/pages/index.page.tsx @@ -18,8 +18,10 @@ export const HomePage = (props: PageProps) => { return } - await loadShouts({ filters: { visibility: 'public' }, limit: PRERENDERED_ARTICLES_COUNT }) - await loadRandomTopics({ amount: RANDOM_TOPICS_COUNT }) + await Promise.all([ + loadShouts({ filters: { visibility: 'public' }, limit: PRERENDERED_ARTICLES_COUNT }), + loadRandomTopics({ amount: RANDOM_TOPICS_COUNT }) + ]) setIsLoaded(true) }) diff --git a/src/pages/profile/Settings.module.scss b/src/pages/profile/Settings.module.scss index a6ce9407..54d620e3 100644 --- a/src/pages/profile/Settings.module.scss +++ b/src/pages/profile/Settings.module.scss @@ -17,6 +17,14 @@ h5 { margin-top: 3rem; } +.error { + @include font-size(1.6rem); + + text-align: center; + color: var(--danger-color); + margin-top: 1.6rem; +} + .multipleControlsItem { position: relative; @@ -133,7 +141,9 @@ h5 { color: #000; display: flex; padding: 0.8em 1em; - transition: background-color 0.3s, color 0.3s; + transition: + background-color 0.3s, + color 0.3s; &:hover { background: #000; diff --git a/src/pages/profile/profileSettings.page.tsx b/src/pages/profile/profileSettings.page.tsx index 3d8de392..c5251456 100644 --- a/src/pages/profile/profileSettings.page.tsx +++ b/src/pages/profile/profileSettings.page.tsx @@ -12,19 +12,20 @@ import { useSession } from '../../context/session' import FloatingPanel from '../../components/_shared/FloatingPanel/FloatingPanel' import { useSnackbar } from '../../context/snackbar' import { useLocalize } from '../../context/localize' -import { handleFileUpload } from '../../utils/handleFileUpload' import { Userpic } from '../../components/Author/Userpic' import { createStore } from 'solid-js/store' import { clone } from '../../utils/clone' import SimplifiedEditor from '../../components/Editor/SimplifiedEditor' import { GrowingTextarea } from '../../components/_shared/GrowingTextarea' import { AuthGuard } from '../../components/AuthGuard' +import { handleImageUpload } from '../../utils/handleImageUpload' export const ProfileSettingsPage = () => { const { t } = useLocalize() const [addLinkForm, setAddLinkForm] = createSignal(false) const [incorrectUrl, setIncorrectUrl] = createSignal(false) const [isUserpicUpdating, setIsUserpicUpdating] = createSignal(false) + const [uploadError, setUploadError] = createSignal(false) const [isFloatingPanelVisible, setIsFloatingPanelVisible] = createSignal(false) const { @@ -63,14 +64,16 @@ export const ProfileSettingsPage = () => { const { selectFiles } = createFileUploader({ multiple: false, accept: 'image/*' }) const handleAvatarClick = async () => { - await selectFiles(async ([uploadFile]) => { + selectFiles(async ([uploadFile]) => { try { + setUploadError(false) setIsUserpicUpdating(true) - const result = await handleFileUpload(uploadFile) + const result = await handleImageUpload(uploadFile) updateFormField('userpic', result.url) setIsUserpicUpdating(false) setIsFloatingPanelVisible(true) } catch (error) { + setUploadError(true) console.error('[upload avatar] error', error) } }) @@ -131,6 +134,9 @@ export const ProfileSettingsPage = () => { onClick={handleAvatarClick} loading={isUserpicUpdating()} /> + +
{t('Upload error')}
+

{t('Name')}

diff --git a/src/utils/config.ts b/src/utils/config.ts index e0c3788b..3039e213 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -3,4 +3,7 @@ export const isDev = import.meta.env.MODE === 'development' const defaultApiUrl = 'https://testapi.discours.io' export const apiBaseUrl = import.meta.env.PUBLIC_API_URL || defaultApiUrl +const defaultThumborUrl = 'https://images.discours.io' +export const thumborUrl = import.meta.env.PUBLIC_THUMBOR_URL || defaultThumborUrl + export const SENTRY_DSN = import.meta.env.PUBLIC_SENTRY_DSN || '' diff --git a/src/utils/getImageUrl.ts b/src/utils/getImageUrl.ts new file mode 100644 index 00000000..a36b4544 --- /dev/null +++ b/src/utils/getImageUrl.ts @@ -0,0 +1,29 @@ +import { thumborUrl } from './config' + +const getSizeUrlPart = (options: { width?: number; height?: number } = {}) => { + const widthString = options.width ? options.width.toString() : '' + const heightString = options.height ? options.height.toString() : '' + + if (!widthString && !heightString) { + return '' + } + + return `${widthString}x${heightString}/` +} + +// I'm not proud of this +export const getImageUrl = (src: string, options: { width?: number; height?: number } = {}) => { + const sizeUrlPart = getSizeUrlPart(options) + + if (!src.startsWith(thumborUrl)) { + return `${thumborUrl}/unsafe/${sizeUrlPart}${src}` + } + + if (src.startsWith(`${thumborUrl}/unsafe`)) { + const thumborKey = src.replace(`${thumborUrl}/unsafe`, '') + return `${thumborUrl}/unsafe/${sizeUrlPart}${thumborKey}` + } + + const thumborKey = src.replace(`${thumborUrl}`, '') + return `${thumborUrl}/${sizeUrlPart}${thumborKey}` +} diff --git a/src/utils/handleImageUpload.ts b/src/utils/handleImageUpload.ts new file mode 100644 index 00000000..92ab03a3 --- /dev/null +++ b/src/utils/handleImageUpload.ts @@ -0,0 +1,22 @@ +import { UploadFile } from '@solid-primitives/upload' +import { UploadedFile } from '../pages/types' +import { thumborUrl } from './config' + +export const handleImageUpload = async (uploadFile: UploadFile): Promise => { + const formData = new FormData() + formData.append('media', uploadFile.file, uploadFile.name) + const response = await fetch(`${thumborUrl}/image`, { + method: 'POST', + body: formData + }) + + const location = response.headers.get('Location') + + const url = `${thumborUrl}/unsafe/production${location.slice(0, location.lastIndexOf('/'))}` + const originalFilename = location.slice(location.lastIndexOf('/') + 1) + + return { + originalFilename, + url + } +} diff --git a/src/utils/imageProxy.ts b/src/utils/imageProxy.ts deleted file mode 100644 index c48530e6..00000000 --- a/src/utils/imageProxy.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { isDev } from './config' -export const imageProxy = (url: string) => { - return `${isDev ? 'https://new.discours.io' : ''}/api/image?url=${encodeURI(url)}` -} - -export const audioProxy = (url: string) => { - return `${isDev ? 'https://new.discours.io' : ''}/api/audio?url=${encodeURI(url)}` -} diff --git a/src/utils/renderUploadedImage.ts b/src/utils/renderUploadedImage.ts index 40b95f14..e4e61279 100644 --- a/src/utils/renderUploadedImage.ts +++ b/src/utils/renderUploadedImage.ts @@ -1,5 +1,4 @@ import { UploadedFile } from '../pages/types' -import { imageProxy } from './imageProxy' import { hideModal } from '../stores/ui' import { Editor } from '@tiptap/core' @@ -22,7 +21,7 @@ export const renderUploadedImage = (editor: Editor, image: UploadedFile) => { { type: 'image', attrs: { - src: imageProxy(image.url) + src: image.url } } ]