Replace player with official Zorn and check if comments are enabled or not
This commit is contained in:
parent
e2566cce31
commit
c39e006b5c
1 changed files with 29 additions and 19 deletions
|
@ -1,15 +1,16 @@
|
||||||
---
|
---
|
||||||
import { t, changeLanguage } from "i18next";
|
import { t, changeLanguage } from "i18next"
|
||||||
import Base from "@layouts/Default.astro";
|
import Base from "@layouts/Default.astro"
|
||||||
import "@styles/video.scss";
|
import "@styles/video.scss"
|
||||||
|
|
||||||
// Configuration
|
// Configuration
|
||||||
import { DEFAULT_MEDIA_PROXY, DEFAULT_MEDIA_DATA_PROXY, DEFAULT_IMAGE_PROXY, SERVER_DOMAIN } from '@utils/GetConfig'
|
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
|
// Components
|
||||||
import Dialog from '@components/Dialog.astro'
|
import Dialog from '@components/Dialog.astro'
|
||||||
import Video from '@components/VideoItem.astro'
|
import Video from '@components/VideoItem.astro'
|
||||||
import Player from "@components/video-player/Player.astro";
|
import { Zorn } from "@minpluto/zorn"
|
||||||
|
|
||||||
// Fetch
|
// Fetch
|
||||||
const SWV = Astro.url.href.split("watch?v=").pop();
|
const SWV = Astro.url.href.split("watch?v=").pop();
|
||||||
|
@ -21,6 +22,15 @@ const Views = video.viewCount;
|
||||||
const VideoSeconds = video.lengthSeconds;
|
const VideoSeconds = video.lengthSeconds;
|
||||||
let DescriptionFormat = Description.replaceAll("\n", " <br/> ");
|
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
|
// Format Published Date
|
||||||
const DateFormat = new Date(UploadDate * 1000).toLocaleDateString();
|
const DateFormat = new Date(UploadDate * 1000).toLocaleDateString();
|
||||||
|
|
||||||
|
@ -74,10 +84,12 @@ if (EightK === true) { // 571
|
||||||
---
|
---
|
||||||
|
|
||||||
<Base Title={video.title}>
|
<Base Title={video.title}>
|
||||||
<Player
|
<Zorn
|
||||||
Poster={DEFAULT_IMAGE_PROXY + '/https://i.ytimg.com/vi/' + video.videoId + '/maxresdefault.jpg'}
|
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'}
|
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'}
|
Audio={DEFAULT_MEDIA_DATA_PROXY + '/latest_version?id=' + video.videoId + '&itag=140'}
|
||||||
|
VideoAttributes="muted"
|
||||||
|
AudioAttributes=""
|
||||||
/>
|
/>
|
||||||
<div class="video-rea">
|
<div class="video-rea">
|
||||||
<div class="rea-details">
|
<div class="rea-details">
|
||||||
|
@ -108,26 +120,24 @@ if (EightK === true) { // 571
|
||||||
<div style="display: flex; gap: 24px;">
|
<div style="display: flex; gap: 24px;">
|
||||||
<div class="rea-comments">
|
<div class="rea-comments">
|
||||||
<h2>{t("WATCH.COMMENTS")}</h2>
|
<h2>{t("WATCH.COMMENTS")}</h2>
|
||||||
{
|
{EnableComments ?
|
||||||
comments.comments.map((comment) => (
|
comments.comments.map((comment) => (
|
||||||
<div class="comment">
|
<div class="comment">
|
||||||
<img
|
<img src={DEFAULT_IMAGE_PROXY + "/" + comment.authorThumbnails[0].url}/>
|
||||||
src={
|
|
||||||
DEFAULT_IMAGE_PROXY + "/" + comment.authorThumbnails[0].url
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p><a href={comment.authorUrl}>{comment.author}</a> - 2 Months Ago</p>
|
||||||
<a href={comment.authorUrl}>{comment.author}</a> - 2 Months
|
|
||||||
Ago
|
|
||||||
</p>
|
|
||||||
<p>{comment.contentHtml}</p>
|
<p>{comment.contentHtml}</p>
|
||||||
<p>
|
<p><ThumbsUp /> {comment.likeCount}</p>
|
||||||
<ThumbsUp /> {comment.likeCount}
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
|
:
|
||||||
|
<p>Comments are disabled on this video.</p>
|
||||||
|
<style is:global>
|
||||||
|
.rea-comments {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="rea-recommendations">
|
<div class="rea-recommendations">
|
||||||
|
|
Reference in a new issue