webmusic/Pages/Index.cshtml

47 lines
1.4 KiB
Plaintext

@page
@using System.Web
@model IndexModel
@{
ViewData["Title"] = "webmusic";
var path = HttpUtility.UrlDecode(Request.QueryString.Value.TrimStart('?'));
if (path.EndsWith(".m3u"))
{
Layout = null;
Response.ContentType = "text/plain";
}
}
@if (Model.path.Contains(".."))
{
return;
}
@if (path.EndsWith(".m3u"))
{
@foreach (var file in Model.files)
{
@Html.Raw(Request.Scheme + "://" + Request.Host + "/" + Model.fullpath + "/" + file.Replace("?", "%3F") +"\n")
}
}
else
{
<h2>@Model.displaypath <span id="state"></span> <span id="flags"></span></h2>
<a class="action-muted">[..]</a>
<a href="?@Model.path_oneup" class="entry-muted cfont"> Go back</a><br/>
<a class="action-muted">[--]</a>
<a href="/@(Request.QueryString).m3u" class="entry-muted cfont"> Download m3u</a><br/><br/>
@foreach (var dir in Model.dirs)
{
<a class="action" href="#">[--]</a>
<a href="?@Model.path/@dir"> @dir</a>
<br/>
}
@foreach (var file in Model.files)
{
var jspath = Model.Encode(Model.fullpath);
var jsfile = jspath + "/" + Model.Encode(file);
<script>queue.push('@Html.Raw(jsfile)')</script>
<a class="action" href="@Html.Raw(Model.Encode(Model.fullpath+"/"+file))" download>[DL]</a>
<a href="#" onclick="playSong('@Html.Raw(jsfile)')"> @file</a>
<br/>
}
}