Migrate from old git host
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
@page "/Error"
|
||||
@using System.Diagnostics
|
||||
|
||||
<PageTitle>Error</PageTitle>
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
|
||||
@code{
|
||||
[CascadingParameter] private HttpContext? HttpContext { get; set; }
|
||||
|
||||
private string? RequestId { get; set; }
|
||||
private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
|
||||
protected override void OnInitialized() =>
|
||||
RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
@page "/"
|
||||
@rendermode InteractiveServer
|
||||
|
||||
@using BlazorApp1.Handler.Interfaces
|
||||
@using BlazorApp1.Helpers
|
||||
@using BlazorApp1.Models
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
|
||||
@inject IFileHandler FileHandler
|
||||
@inject IVideoHandler VideoHandler
|
||||
|
||||
@attribute [Authorize]
|
||||
|
||||
<PageTitle>Auth</PageTitle>
|
||||
|
||||
<h1>You are authenticated</h1>
|
||||
|
||||
<AuthorizeView>
|
||||
Hello @context.User.Identity?.Name!
|
||||
</AuthorizeView>
|
||||
<br/>
|
||||
|
||||
<label>1 Gb max allowed</label>
|
||||
<EditForm Model="@File" OnSubmit="Upload">
|
||||
<InputFile OnChange="OnFileSelected"></InputFile>
|
||||
|
||||
<InputSelect @bind-Value="Codec">
|
||||
@foreach (FFOptionsCodecs codec in Enum.GetValues<FFOptionsCodecs>())
|
||||
{
|
||||
<option value="@codec">@codec</option>
|
||||
}
|
||||
</InputSelect>
|
||||
|
||||
<InputSelect @bind-Value="Filters">
|
||||
@foreach (FFOptionsFilters filter in Enum.GetValues<FFOptionsFilters>())
|
||||
{
|
||||
<option value="@filter">@filter</option>
|
||||
}
|
||||
</InputSelect>
|
||||
|
||||
<button type="submit">Upload</button>
|
||||
</EditForm>
|
||||
|
||||
<a href="/Videos/Final/@NewFilePath">Download new video</a>
|
||||
|
||||
@code
|
||||
{
|
||||
[SupplyParameterFromForm(FormName = "UploadFile")]
|
||||
private FileInput? File { get; set; } = new();
|
||||
|
||||
private IBrowserFile? _browserFile;
|
||||
private FFOptionsCodecs Codec { get; set; }
|
||||
private FFOptionsFilters Filters { get; set; }
|
||||
private string NewFilePath { get; set; } = "";
|
||||
|
||||
private void OnFileSelected(InputFileChangeEventArgs e)
|
||||
{
|
||||
_browserFile = e.File;
|
||||
}
|
||||
|
||||
private async Task Upload()
|
||||
{
|
||||
if (_browserFile is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await FileHandler.SaveFile(_browserFile);
|
||||
string filePath = FileHandler.GetFileReference(_browserFile.Name);
|
||||
|
||||
VideoHandler.ConvertVideo(filePath, Codec, Filters, out string newFilePath);
|
||||
|
||||
await FileHandler.DeleteTempFile(filePath);
|
||||
|
||||
NewFilePath = newFilePath.GetFileNameFromPath();
|
||||
}
|
||||
|
||||
|
||||
public class FileInput
|
||||
{
|
||||
public IFormFile FileForm { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user