Browse Source

Update help information around uploads, API, and home page user features

master
Teknikode 7 months ago
parent
commit
e901bbda6d

+ 21
- 2
Teknik/Areas/Help/Controllers/HelpController.cs View File

@@ -2,13 +2,17 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
using Teknik.Areas.Help.ViewModels;
using Teknik.Areas.Users.Models;
using Teknik.Areas.Users.Utility;
using Teknik.Attributes;
using Teknik.Configuration;
using Teknik.Controllers;
using Teknik.Data;
using Teknik.Filters;
using Teknik.Logging;
using Teknik.Utilities;

namespace Teknik.Areas.Help.Controllers
{
@@ -109,10 +113,25 @@ namespace Teknik.Areas.Help.Controllers
}
[AllowAnonymous]
public IActionResult Upload()
public async Task<IActionResult> Upload()
{
ViewBag.Title = "Upload Service Help";
HelpViewModel model = new HelpViewModel();
UploadHelpViewModel model = new UploadHelpViewModel();

model.MaxUploadSize = _config.UploadConfig.MaxUploadSize;
if (User.Identity.IsAuthenticated)
{
User user = UserHelper.GetUser(_dbContext, User.Identity.Name);
if (user != null)
{
model.MaxUploadSize = _config.UploadConfig.MaxUploadSizeBasic;
IdentityUserInfo userInfo = await IdentityHelper.GetIdentityUserInfo(_config, User.Identity.Name);
if (userInfo.AccountType == AccountType.Premium)
{
model.MaxUploadSize = _config.UploadConfig.MaxUploadSizePremium;
}
}
}
return View("~/Areas/Help/Views/Help/Upload.cshtml", model);
}
}

+ 13
- 0
Teknik/Areas/Help/ViewModels/UploadHelpViewModel.cs View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Teknik.ViewModels;

namespace Teknik.Areas.Help.ViewModels
{
public class UploadHelpViewModel : ViewModelBase
{
public long MaxUploadSize { get; set; }
}
}

+ 0
- 41
Teknik/Areas/Help/Views/Help/API/v1/Paste.cshtml View File

@@ -17,33 +17,6 @@
<p>This is a description of the API commands available for the Paste service.</p>
<h3>Submit a Paste</h3>
<pre><code>POST @Url.SubRouteUrl("api", "API.v1.Paste")</code></pre>
<h4>Headers</h4>
<table>
<thead>
<tr>
<th>Name</th>
<th>Value</th>
<th>Default Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>Authorization</code>
</td>
<td>
<code>Basic <i>Encoding.Base64</i>(&lt;username&gt;:&lt;token&gt;)</code>
</td>
<td>
<var>NULL</var>
</td>
<td>
Basic Authentication to associate the paste with your account.
</td>
</tr>
</tbody>
</table>
<h4>Parameters</h4>
<table>
<thead>
@@ -154,20 +127,6 @@
Specify a password to encrypt and lock the paste with.
</td>
</tr>
<tr>
<td>
<code>doNotTrack</code>
</td>
<td>
<code>bool</code>
</td>
<td>
<var>false</var>
</td>
<td>
If you do not want the api request to be tracked as defined in the privacy policy.
</td>
</tr>
</tbody>
</table>
<h4>Response</h4>

+ 0
- 27
Teknik/Areas/Help/Views/Help/API/v1/Shorten.cshtml View File

@@ -15,33 +15,6 @@
<p>This is a description of the API commands available for the Url Shortening service.</p>
<h3>Shorten a Url</h3>
<pre><code>POST @Url.SubRouteUrl("api", "API.v1.Shorten")</code></pre>
<h4>Headers</h4>
<table>
<thead>
<tr>
<th>Name</th>
<th>Value</th>
<th>Default Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>Authorization</code>
</td>
<td>
<code>Basic <i>Encoding.Base64</i>(&lt;username&gt;:&lt;token&gt;)</code>
</td>
<td>
<var>NULL</var>
</td>
<td>
Basic Authentication to associate the shortened url with your account.
</td>
</tr>
</tbody>
</table>
<h4>Parameters</h4>
<table>
<thead>

+ 42
- 33
Teknik/Areas/Help/Views/Help/API/v1/Upload.cshtml View File

@@ -15,33 +15,6 @@
<p>This is a description of the API commands available for the Upload service.</p>
<h3>Upload a File</h3>
<pre><code>POST @Url.SubRouteUrl("api", "API.v1.Upload")</code></pre>
<h4>Headers</h4>
<table>
<thead>
<tr>
<th>Name</th>
<th>Value</th>
<th>Default Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>Authorization</code>
</td>
<td>
<code>Basic <i>Encoding.Base64</i>(&lt;username&gt;:&lt;token&gt;)</code>
</td>
<td>
<var>NULL</var>
</td>
<td>
Basic Authentication to associate the upload with your account.
</td>
</tr>
</tbody>
</table>
<h4>Parameters</h4>
<table>
<thead>
@@ -168,21 +141,35 @@
</tr>
<tr>
<td>
<code>genDeletionKey</code>
<code>expireUnit</code>
</td>
<td>
<code>bool</code>
<code>string</code>
</td>
<td>
<var>false</var>
<var>never</var>
</td>
<td>
Generates a deletion key.
The expiration type for the paste. Possible values are <code>view</code> (Max number of Downloads) or a date value <code>minute</code>, <code>hour</code>, <code>day</code>, <code>month</code>, <code>year</code>
</td>
</tr>
<tr>
<td>
<code>expireLength</code>
</td>
<td>
<code>int</code>
</td>
<td>
<var>1</var>
</td>
<td>
The length of whatever unit you choose before the paste is deleted.
</td>
</tr>
<tr>
<td>
<code>doNotTrack</code>
<code>genDeletionKey</code>
</td>
<td>
<code>bool</code>
@@ -191,7 +178,7 @@
<var>false</var>
</td>
<td>
If you do not want the api request to be tracked as defined in the privacy policy.
Generates a deletion key.
</td>
</tr>
</tbody>
@@ -297,6 +284,28 @@
The size of the iv used in bits.
</td>
</tr>
<tr>
<td>
<code>maxDownloads</code>
</td>
<td>
<code>int</code>
</td>
<td>
The maximum number of uploads before the upload is deleted.
</td>
</tr>
<tr>
<td>
<code>expirationDate</code>
</td>
<td>
<code>datetime</code>
</td>
<td>
The date of expiration of the upload.
</td>
</tr>
<tr>
<td>
<code>deletionKey</code>

+ 2
- 2
Teknik/Areas/Help/Views/Help/Upload.cshtml View File

@@ -1,4 +1,4 @@
@model Teknik.Areas.Help.ViewModels.HelpViewModel
@model Teknik.Areas.Help.ViewModels.UploadHelpViewModel

<div class="container">
<ol class="breadcrumb">
@@ -38,7 +38,7 @@
</p>
<h3>Upload Requirements</h3>
<p>
The maximum file size per upload is <b>@StringHelper.GetBytesReadable(Config.UploadConfig.MaxUploadSize)</b>
The maximum file size per upload is <b>@StringHelper.GetBytesReadable(Model.MaxUploadSize)</b>
</p>
<p>
Each file is scanned for viruses at upload. If it fails, it will cancel the upload. Currently only files that are unencrypted when being sent to the server will be scanned successfully for viruses. If the file is encrypted client side, the encrypted data will be checked. This could create a false positive, but since the key is randomly generated, the next attempt should not be flagged.

+ 75
- 32
Teknik/Areas/Home/Views/Home/Index.cshtml View File

@@ -91,42 +91,85 @@
</div>
<br />
<div class="panel-body">
<a conditional href="@Url.SubRouteUrl("help", "Help.Mail")" asp-condition="@User.Identity.IsAuthenticated">
<div class="col-md-3 text-center text-primary">
<br />
<i class="fa fa-envelope fa-5x"></i>
<div class="caption">
<h3>Email Account</h3>
<div class="row">
<a conditional href="@Url.SubRouteUrl("upload", "Upload.Index")" asp-condition="@User.Identity.IsAuthenticated">
<div class="col-md-3 text-center text-primary">
<br />
<i class="fa fa-clock-o fa-5x"></i>
<div class="caption">
<h3>Non-Expiring Uploads</h3>
</div>
</div>
</a>
<a conditional href="@Config.GitConfig.Host" asp-condition="@User.Identity.IsAuthenticated">
<div class="col-md-3 text-center text-primary">
<br />
<i class="fa fa-git fa-5x"></i>
<div class="caption">
<h3>Unlimited Git Repos</h3>
</div>
</div>
</a>
<a conditional href="@Url.SubRouteUrl("blog", "Blog.Blog", new { username = User.Identity.Name })" asp-condition="@User.Identity.IsAuthenticated">
<div class="col-md-3 text-center text-primary">
<br />
<i class="fa fa-book fa-5x"></i>
<div class="caption">
<h3>Personal Blog</h3>
</div>
</div>
</a>
<a conditional href="@Url.SubRouteUrl("account", "User.ViewServiceData")" asp-condition="@User.Identity.IsAuthenticated">
<div class="col-md-3 text-center text-primary">
<br />
<i class="fa fa-database fa-5x"></i>
<div class="caption">
<h3>Service Data</h3>
</div>
</div>
</a>
</div>
<br />
<hr />
<h2 class="text-center"><a href="@Url.SubRouteUrl("account", "User.GetPremium")">Upgrade to Premium</a> for even more features!</h2>
<div class="row">
<a conditional href="@Url.SubRouteUrl("help", "Help.Mail")" asp-condition="@User.Identity.IsAuthenticated">
<div class="col-md-3 text-center text-primary">
<br />
<i class="fa fa-envelope fa-5x"></i>
<div class="caption">
<h3>Email Account</h3>
</div>
</div>
</div>
</a>
<a conditional href="@Config.GitConfig.Host" asp-condition="@User.Identity.IsAuthenticated">
<div class="col-md-3 text-center text-primary">
<br />
<i class="fa fa-git fa-5x"></i>
<div class="caption">
<h3>Unlimited Git Repos</h3>
</a>
<a conditional href="@Url.SubRouteUrl("upload", "Upload.Index")" asp-condition="@User.Identity.IsAuthenticated">
<div class="col-md-3 text-center text-primary">
<br />
<i class="fa fa-upload fa-5x"></i>
<div class="caption">
<h3>Larger Upload Size</h3>
</div>
</div>
</div>
</a>
<a conditional href="@Url.SubRouteUrl("blog", "Blog.Blog", new { username = User.Identity.Name })" asp-condition="@User.Identity.IsAuthenticated">
<div class="col-md-3 text-center text-primary">
<br />
<i class="fa fa-book fa-5x"></i>
<div class="caption">
<h3>Personal Blog</h3>
</a>
<a conditional href="@Url.SubRouteUrl("upload", "Upload.Index")" asp-condition="@User.Identity.IsAuthenticated">
<div class="col-md-3 text-center text-primary">
<br />
<i class="fa fa-film fa-5x"></i>
<div class="caption">
<h3>No Embed Limits</h3>
</div>
</div>
</div>
</a>
<a conditional href="@Url.SubRouteUrl("account", "User.ViewServiceData")" asp-condition="@User.Identity.IsAuthenticated">
<div class="col-md-3 text-center text-primary">
<br />
<i class="fa fa-database fa-5x"></i>
<div class="caption">
<h3>Service Data</h3>
</a>
<a conditional href="@Url.SubRouteUrl("about", "About.Index")" asp-condition="@User.Identity.IsAuthenticated">
<div class="col-md-3 text-center text-primary">
<br />
<i class="fa fa-heart fa-5x"></i>
<div class="caption">
<h3>Lifetime Account</h3>
</div>
</div>
</div>
</a>
</a>
</div>
</div>
</div>
</div>

Loading…
Cancel
Save