diff --git a/pkg/view/package.json b/pkg/view/package.json index 69ee8c3..62e620c 100644 --- a/pkg/view/package.json +++ b/pkg/view/package.json @@ -11,17 +11,18 @@ "dependencies": { "@fortawesome/fontawesome-free": "^6.5.1", "@solidjs/router": "^0.10.10", - "aplayer": "^1.10.1", "artplayer": "^5.1.1", + "dompurify": "^3.0.8", "flv.js": "^1.6.2", "hls.js": "^1.5.3", + "marked": "^12.0.0", "medium-zoom": "^1.1.0", "solid-js": "^1.8.7", - "solid-markdown": "^2.0.0", "universal-cookie": "^7.0.2" }, "devDependencies": { "@tailwindcss/typography": "^0.5.10", + "@types/dompurify": "^3.0.5", "autoprefixer": "^10.4.17", "daisyui": "^4.6.1", "postcss": "^8.4.33", diff --git a/pkg/view/src/components/PostAttachments.tsx b/pkg/view/src/components/PostAttachments.tsx index 7f59ff8..7d95d54 100644 --- a/pkg/view/src/components/PostAttachments.tsx +++ b/pkg/view/src/components/PostAttachments.tsx @@ -3,14 +3,10 @@ import mediumZoom from "medium-zoom"; import styles from "./PostAttachments.module.css"; -// @ts-ignore -import APlayer from "aplayer"; import Artplayer from "artplayer"; import HlsJs from "hls.js"; import FlvJs from "flv.js"; -import "aplayer/dist/APlayer.min.css"; - function Video({ url, ...rest }: any) { let container: any; @@ -21,24 +17,24 @@ function Video({ url, ...rest }: any) { hls.loadSource(url); hls.attachMedia(video); art.hls = hls; - art.on('destroy', () => hls.destroy()); - } else if (video.canPlayType('application/vnd.apple.mpegurl')) { + art.on("destroy", () => hls.destroy()); + } else if (video.canPlayType("application/vnd.apple.mpegurl")) { video.src = url; } else { - art.notice.show = 'Unsupported playback format: m3u8'; + art.notice.show = "Unsupported playback format: m3u8"; } } function playFlv(video: HTMLVideoElement, url: string, art: Artplayer) { if (FlvJs.isSupported()) { if (art.flv) art.flv.destroy(); - const flv = FlvJs.createPlayer({ type: 'flv', url }); + const flv = FlvJs.createPlayer({ type: "flv", url }); flv.attachMediaElement(video); flv.load(); art.flv = flv; - art.on('destroy', () => flv.destroy()); + art.on("destroy", () => flv.destroy()); } else { - art.notice.show = 'Unsupported playback format: flv'; + art.notice.show = "Unsupported playback format: flv"; } } @@ -54,14 +50,11 @@ function Video({ url, ...rest }: any) { subtitleOffset: true, fullscreen: true, fullscreenWeb: true, - screenshot: true, - autoPlayback: true, - airplay: true, theme: "#49509e", customType: { m3u8: playM3u8, - flv: playFlv, - }, + flv: playFlv + } }); }); @@ -71,21 +64,12 @@ function Video({ url, ...rest }: any) { } function Audio({ url, caption, ...rest }: any) { - let container: any; - - createEffect(() => { - new APlayer({ - container: container as HTMLDivElement, - audio: [{ - name: caption, - url: url, - theme: "#49509e" - }] - }); - }); return ( -
+
+
{caption}
+
); } @@ -129,7 +113,7 @@ export default function PostAttachments(props: { attachments: any[] }) {
- Open in browser + Open in browser
@@ -140,7 +124,8 @@ export default function PostAttachments(props: { attachments: any[] }) { -