64 lines
2.1 KiB
Plaintext
64 lines
2.1 KiB
Plaintext
@page
|
|
@using System.IO
|
|
@model IndexModel
|
|
@{
|
|
ViewData["Title"] = $"webmusic on .NET {Environment.Version}";
|
|
}
|
|
@if (Model.Path.Contains("/..")) {
|
|
return;
|
|
}
|
|
@if (Model.Path.EndsWith(".lrc")) {
|
|
Layout = "Shared/_LayoutNojs";
|
|
<h3>@Model.Path</h3>
|
|
<p>@Html.Raw((await System.IO.File.ReadAllTextAsync("music" + Model.Path)).Replace("\n", "<br/>"))</p>
|
|
}
|
|
else {
|
|
<h2>
|
|
@Model.Displaypath <span id="state"></span> <span id="flags">[<span id="repeatButton">R</span><span id="continuousButton">C</span>]</span>
|
|
</h2>
|
|
<a class="action-muted">[..]</a>
|
|
<a href="?@IndexModel.Encode(Model.PathOneup)" id="back" class="entry-muted cfont"> Go back</a>
|
|
@if (Model.LogConditionsMet) {
|
|
<br/>
|
|
<a class="action-muted">[--]</a>
|
|
<span id="log" onclick="get('/log?artist=@Model.LogArtist&album=@Model.LogAlbum&url=@Model.LogUrl')" class="entry-muted cfont" style="cursor: pointer"> Log playback</span>
|
|
}
|
|
<br/>
|
|
<a class="action-muted">[--]</a>
|
|
<a href="/playlist/@(Request.QueryString).m3u" class="entry-muted cfont"> Download playlist</a>
|
|
<br/>
|
|
<br/>
|
|
@foreach (var dir in Model.Dirs) {
|
|
<li>
|
|
<a class="action" href="#">[--]</a>
|
|
<a class="dir" href="?@IndexModel.Encode(Model.Path + "/" + dir)"> @dir</a>
|
|
</li>
|
|
}
|
|
@foreach (var file in Model.Files) {
|
|
var basename = System.IO.Path.GetFileNameWithoutExtension(file);
|
|
var lrcfile = basename + ".lrc";
|
|
var lrcpath = System.IO.Path.Combine(Model.Fullpath, lrcfile);
|
|
|
|
<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>
|
|
}
|
|
else if (Directory.GetFiles(@Model.Fullpath, "*.lrc").Length != 0) {
|
|
<a class="action">[---]</a>
|
|
}
|
|
<a class="file" href="@Html.Raw(IndexModel.Encode(Model.Fullpath + "/" + file))"> @file</a>
|
|
</li>
|
|
}
|
|
}
|
|
|
|
<script>
|
|
function get(url) {
|
|
fetch(url).then(function(response) {
|
|
return response.text();
|
|
}).then(function(text) {
|
|
document.getElementById('log').innerText = ' Log playback (' + text + ')';
|
|
});
|
|
}
|
|
</script>
|