Move lyrics to new page

This commit is contained in:
Laura Hausmann 2023-05-27 03:45:36 +02:00
parent 2d81029c29
commit 2522214a97
Signed by: zotan
GPG key ID: D044E84C5BE01605
2 changed files with 19 additions and 1 deletions

View file

@ -48,7 +48,7 @@ else {
<li>
<a class="action" href="@Html.Raw(IndexModel.Encode(Model.Fullpath + "/" + file))" download>[DL]</a>
@if (System.IO.File.Exists(lrcpath)) {
<a class="action" href="?@Html.Raw(IndexModel.Encode(Model.Path + "/" + lrcfile))" target="_blank">[LRC]</a>
<a class="action" href="/lyrics/?@Html.Raw(IndexModel.Encode(Model.Path + "/" + lrcfile))" target="_blank">[LRC]</a>
}
else if (Directory.GetFiles(Model.Fullpath, "*.lrc").Length != 0) {
<a class="action">[---]</a>

18
Pages/lyrics.cshtml Normal file
View file

@ -0,0 +1,18 @@
@page
@using System.IO
@model IndexModel
@{
ViewData["Title"] = $"webmusic on .NET {Environment.Version}";
}
@if (Model.Path.Contains("/..")) {
return;
}
@if (!Model.Path.EndsWith(".lrc")) {
Response.Redirect("/" + Request.QueryString);
return;
}
@{
Layout = "Shared/_LayoutNojs";
}
<h3>@Model.Path</h3>
<p>@Html.Raw((await System.IO.File.ReadAllTextAsync("music" + Model.Path)).Replace("\n", "<br/>"))</p>