Replace player with official Zorn and check if comments are enabled or not

This commit is contained in:
Korbs 2024-09-07 04:03:03 -04:00
parent e2566cce31
commit c39e006b5c

View file

@ -1,15 +1,16 @@
---
import { t, changeLanguage } from "i18next";
import Base from "@layouts/Default.astro";
import "@styles/video.scss";
import { t, changeLanguage } from "i18next"
import Base from "@layouts/Default.astro"
import "@styles/video.scss"
// Configuration
import { DEFAULT_MEDIA_PROXY, DEFAULT_MEDIA_DATA_PROXY, DEFAULT_IMAGE_PROXY, SERVER_DOMAIN } from '@utils/GetConfig'
import { Donate, Download, ShareIos, ThumbsUp, MediaVideo } from "@iconoir/vue";
import { Donate, Download, ShareIos, ThumbsUp, MediaVideo } from "@iconoir/vue"
// Components
import Dialog from '@components/Dialog.astro'
import Video from '@components/VideoItem.astro'
import Player from "@components/video-player/Player.astro";
import { Zorn } from "@minpluto/zorn"
// Fetch
const SWV = Astro.url.href.split("watch?v=").pop();
@ -21,6 +22,15 @@ const Views = video.viewCount;
const VideoSeconds = video.lengthSeconds;
let DescriptionFormat = Description.replaceAll("\n", " <br/> ");
var CheckComments = console.log(comments) // If not found, disable comment section
if (CheckComments = "{ error: 'Comments not found.' }") {
var EnableComments = false
} else {
var EnableComments = true
}
// Format Published Date
const DateFormat = new Date(UploadDate * 1000).toLocaleDateString();
@ -74,10 +84,12 @@ if (EightK === true) { // 571
---
<Base Title={video.title}>
<Player
<Zorn
Poster={DEFAULT_IMAGE_PROXY + '/https://i.ytimg.com/vi/' + video.videoId + '/maxresdefault.jpg'}
Video={DEFAULT_MEDIA_DATA_PROXY + '/latest_version?id=' + video.videoId + '&itag=' + Quality + '&local=true'}
Audio={DEFAULT_MEDIA_DATA_PROXY + '/latest_version?id=' + video.videoId + '&itag=140'}
VideoAttributes="muted"
AudioAttributes=""
/>
<div class="video-rea">
<div class="rea-details">
@ -108,26 +120,24 @@ if (EightK === true) { // 571
<div style="display: flex; gap: 24px;">
<div class="rea-comments">
<h2>{t("WATCH.COMMENTS")}</h2>
{
{EnableComments ?
comments.comments.map((comment) => (
<div class="comment">
<img
src={
DEFAULT_IMAGE_PROXY + "/" + comment.authorThumbnails[0].url
}
/>
<img src={DEFAULT_IMAGE_PROXY + "/" + comment.authorThumbnails[0].url}/>
<div>
<p>
<a href={comment.authorUrl}>{comment.author}</a> - 2 Months
Ago
</p>
<p><a href={comment.authorUrl}>{comment.author}</a> - 2 Months Ago</p>
<p>{comment.contentHtml}</p>
<p>
<ThumbsUp /> {comment.likeCount}
</p>
<p><ThumbsUp /> {comment.likeCount}</p>
</div>
</div>
))
:
<p>Comments are disabled on this video.</p>
<style is:global>
.rea-comments {
width: 100%;
}
</style>
}
</div>
<div class="rea-recommendations">