From 2522214a979cdf4e8568d5e3ffc8b087d5f40fc2 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sat, 27 May 2023 03:45:36 +0200 Subject: [PATCH] Move lyrics to new page --- Pages/Index.cshtml | 2 +- Pages/lyrics.cshtml | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 Pages/lyrics.cshtml diff --git a/Pages/Index.cshtml b/Pages/Index.cshtml index e73c9dd..9316d8d 100644 --- a/Pages/Index.cshtml +++ b/Pages/Index.cshtml @@ -48,7 +48,7 @@ else {
  • [DL] @if (System.IO.File.Exists(lrcpath)) { - [LRC] + [LRC] } else if (Directory.GetFiles(Model.Fullpath, "*.lrc").Length != 0) { [---] diff --git a/Pages/lyrics.cshtml b/Pages/lyrics.cshtml new file mode 100644 index 0000000..75392f3 --- /dev/null +++ b/Pages/lyrics.cshtml @@ -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"; +} +

    @Model.Path

    +

    @Html.Raw((await System.IO.File.ReadAllTextAsync("music" + Model.Path)).Replace("\n", "
    "))