2019-04-22 09:41:20 +02:00
|
|
|
@model ViewFilesViewModel
|
|
|
|
@{
|
2021-04-08 15:32:42 +02:00
|
|
|
ViewData.SetActivePageAndTitle(ServerNavPages.Files, "File Storage");
|
2019-04-22 09:41:20 +02:00
|
|
|
}
|
|
|
|
|
2021-04-08 15:32:42 +02:00
|
|
|
<h2 class="mb-4">@ViewData["PageTitle"]</h2>
|
2019-04-22 09:41:20 +02:00
|
|
|
|
2021-04-11 21:05:47 +02:00
|
|
|
@if (!Model.StorageConfigured)
|
2020-12-21 12:26:43 +01:00
|
|
|
{
|
2021-04-11 21:05:47 +02:00
|
|
|
<p>
|
|
|
|
Before being able to upload you first need to
|
|
|
|
<a asp-action="storage" asp-route-forceChoice="true" asp-route-returnurl="@ViewData["ReturnUrl"]">
|
2021-04-13 09:27:29 +02:00
|
|
|
choose your file storage service provider
|
2021-04-11 21:05:47 +02:00
|
|
|
</a>.
|
2021-07-06 10:35:42 +02:00
|
|
|
<a href="https://docs.btcpayserver.org/FAQ/FAQ-ServerSettings/#how-to-upload-files-to-btcpay" target="_blank" rel="noreferrer noopener">
|
2021-04-11 21:05:47 +02:00
|
|
|
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
|
|
|
|
</a>
|
|
|
|
</p>
|
2020-12-21 12:26:43 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-04-11 21:05:47 +02:00
|
|
|
<p>
|
2021-04-20 04:05:53 +02:00
|
|
|
Change your <a asp-action="storage" asp-route-forceChoice="true" asp-route-returnurl="@ViewData["ReturnUrl"]">file storage service</a> provider.
|
2021-07-06 10:35:42 +02:00
|
|
|
<a href="https://docs.btcpayserver.org/FAQ/FAQ-ServerSettings/#how-to-upload-files-to-btcpay" target="_blank" rel="noreferrer noopener">
|
2021-04-11 21:05:47 +02:00
|
|
|
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
|
|
|
|
</a>
|
2020-12-21 12:26:43 +01:00
|
|
|
</p>
|
2021-04-11 21:05:47 +02:00
|
|
|
|
|
|
|
@if (Model.Files.Any())
|
|
|
|
{
|
2021-08-20 14:59:31 +02:00
|
|
|
<table class="table table-hover table-responsive-md">
|
2021-04-11 21:05:47 +02:00
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Timestamp</th>
|
|
|
|
<th>User</th>
|
2021-06-06 13:41:14 +02:00
|
|
|
<th class="text-end">Actions</th>
|
2021-04-11 21:05:47 +02:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
@foreach (var file in Model.Files)
|
|
|
|
{
|
|
|
|
<tr>
|
|
|
|
<td>@file.FileName</td>
|
|
|
|
<td>@file.Timestamp.ToBrowserDate()</td>
|
|
|
|
<td>@file.ApplicationUser.UserName</td>
|
2021-06-06 13:41:14 +02:00
|
|
|
<td class="text-end">
|
2021-08-09 16:40:55 +02:00
|
|
|
<a href="@Url.Action("Files", "Server", new { fileIds = new string[] { file.Id} })">Get Link</a>
|
2021-04-11 21:05:47 +02:00
|
|
|
- <a asp-action="CreateTemporaryFileUrl" asp-route-fileId="@file.Id">Get Temp Link</a>
|
|
|
|
- <a asp-action="DeleteFile" asp-route-fileId="@file.Id">Remove</a>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<p class="text-secondary mt-3">
|
|
|
|
There are no files yet.
|
|
|
|
</p>
|
|
|
|
}
|
2020-12-21 12:26:43 +01:00
|
|
|
}
|
2019-04-22 09:41:20 +02:00
|
|
|
|
2021-04-11 21:05:47 +02:00
|
|
|
|
2021-08-09 16:40:55 +02:00
|
|
|
@if(Model.DirectUrlByFiles!=null && Model.DirectUrlByFiles.Count > 0)
|
2019-04-22 09:41:20 +02:00
|
|
|
{
|
2021-08-09 16:40:55 +02:00
|
|
|
foreach (KeyValuePair<string, string> fileUrlPair in Model.DirectUrlByFiles)
|
|
|
|
{
|
|
|
|
var fileId = fileUrlPair.Key;
|
|
|
|
var fileUrl = fileUrlPair.Value;
|
|
|
|
var file = Model.Files.Single(storedFile => storedFile.Id.Equals(fileId, StringComparison.InvariantCultureIgnoreCase));
|
|
|
|
|
|
|
|
|
|
|
|
<div class="card mb-2">
|
|
|
|
<div class="card-text">
|
|
|
|
<ul class="list-group list-group-flush">
|
|
|
|
<li class="list-group-item">
|
|
|
|
@file.FileName
|
|
|
|
</li>
|
|
|
|
<li class="list-group-item">
|
|
|
|
<strong>URL:</strong>
|
|
|
|
<a asp-action="GetFile" asp-controller="Storage" asp-route-fileId="@fileId" target="_blank">
|
|
|
|
@Url.Action("GetFile", "Storage", new
|
|
|
|
{
|
|
|
|
fileId = fileId
|
|
|
|
}, Context.Request.Scheme, Context.Request.Host.ToString())
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li class="list-group-item">
|
|
|
|
<strong>Direct URL:</strong>
|
|
|
|
<a href="@fileUrl" target="_blank" rel="noreferrer noopener">@fileUrl</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2019-04-22 09:41:20 +02:00
|
|
|
</div>
|
2021-08-09 16:40:55 +02:00
|
|
|
}
|
2019-04-22 09:41:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@if (Model.StorageConfigured)
|
|
|
|
{
|
2021-07-21 10:21:22 +02:00
|
|
|
<form asp-action="CreateFiles" method="post" enctype="multipart/form-data">
|
2021-07-20 17:00:20 +02:00
|
|
|
<h4 class="mt-5 mb-3">Upload Files</h4>
|
2021-07-21 10:21:22 +02:00
|
|
|
<input multiple type="file" class="form-control mb-3" name="files" id="files" required>
|
2021-07-20 17:00:20 +02:00
|
|
|
<button class="btn btn-primary" role="button"><span class="fa fa-plus"></span> Upload files</button>
|
|
|
|
</form>
|
2019-04-22 09:41:20 +02:00
|
|
|
}
|