From 8e1c91b4d7245f6d58c0dbf49dd06a6e553e5727 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 15 Oct 2023 11:14:18 -0500 Subject: [PATCH] support nico video for the submission encode embed link field --- TASVideos/Pages/Shared/_NicoEmbed.cshtml | 11 +++++++++++ TASVideos/Pages/Submissions/View.cshtml | 5 ++++- TASVideos/TASVideos.csproj | 3 +++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 TASVideos/Pages/Shared/_NicoEmbed.cshtml diff --git a/TASVideos/Pages/Shared/_NicoEmbed.cshtml b/TASVideos/Pages/Shared/_NicoEmbed.cshtml new file mode 100644 index 000000000..77f0e5fde --- /dev/null +++ b/TASVideos/Pages/Shared/_NicoEmbed.cshtml @@ -0,0 +1,11 @@ +@model string +@{ + var code = Model.Split('/').Last(); + var embedLink = $"//embed.nicovideo.jp/watch/{code}"; + var fullLink = $"//www.nicovideo.jp/watch/{code}"; +} +
+ +
+ (Link to video) +
\ No newline at end of file diff --git a/TASVideos/Pages/Submissions/View.cshtml b/TASVideos/Pages/Submissions/View.cshtml index a88605b2f..fd73affd1 100644 --- a/TASVideos/Pages/Submissions/View.cshtml +++ b/TASVideos/Pages/Submissions/View.cshtml @@ -29,6 +29,8 @@ ? "https://i.ytimg.com/vi/" + Model.Submission.EncodeEmbedLink.Split('/').Last() + "/hqdefault.jpg" : null; + var isNicoEmbed = hasEncode && Model.Submission.EncodeEmbedLink!.Contains("nicovideo"); + ViewData.SetMetaTags(new MetaTagModel { Title = Model.Submission.Title, @@ -60,7 +62,8 @@
- + +