1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

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

This commit is contained in:
Uncled1023 2019-03-30 01:00:58 -07:00
parent 372997f995
commit e901bbda6d
7 changed files with 161 additions and 145 deletions

View File

@ -2,13 +2,17 @@
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
using Teknik.Areas.Help.ViewModels; using Teknik.Areas.Help.ViewModels;
using Teknik.Areas.Users.Models;
using Teknik.Areas.Users.Utility;
using Teknik.Attributes; using Teknik.Attributes;
using Teknik.Configuration; using Teknik.Configuration;
using Teknik.Controllers; using Teknik.Controllers;
using Teknik.Data; using Teknik.Data;
using Teknik.Filters; using Teknik.Filters;
using Teknik.Logging; using Teknik.Logging;
using Teknik.Utilities;
namespace Teknik.Areas.Help.Controllers namespace Teknik.Areas.Help.Controllers
{ {
@ -109,10 +113,25 @@ namespace Teknik.Areas.Help.Controllers
} }
[AllowAnonymous] [AllowAnonymous]
public IActionResult Upload() public async Task<IActionResult> Upload()
{ {
ViewBag.Title = "Upload Service Help"; 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); return View("~/Areas/Help/Views/Help/Upload.cshtml", model);
} }
} }

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; }
}
}

View File

@ -17,33 +17,6 @@
<p>This is a description of the API commands available for the Paste service.</p> <p>This is a description of the API commands available for the Paste service.</p>
<h3>Submit a Paste</h3> <h3>Submit a Paste</h3>
<pre><code>POST @Url.SubRouteUrl("api", "API.v1.Paste")</code></pre> <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> <h4>Parameters</h4>
<table> <table>
<thead> <thead>
@ -154,20 +127,6 @@
Specify a password to encrypt and lock the paste with. Specify a password to encrypt and lock the paste with.
</td> </td>
</tr> </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> </tbody>
</table> </table>
<h4>Response</h4> <h4>Response</h4>

View File

@ -15,33 +15,6 @@
<p>This is a description of the API commands available for the Url Shortening service.</p> <p>This is a description of the API commands available for the Url Shortening service.</p>
<h3>Shorten a Url</h3> <h3>Shorten a Url</h3>
<pre><code>POST @Url.SubRouteUrl("api", "API.v1.Shorten")</code></pre> <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> <h4>Parameters</h4>
<table> <table>
<thead> <thead>

View File

@ -15,33 +15,6 @@
<p>This is a description of the API commands available for the Upload service.</p> <p>This is a description of the API commands available for the Upload service.</p>
<h3>Upload a File</h3> <h3>Upload a File</h3>
<pre><code>POST @Url.SubRouteUrl("api", "API.v1.Upload")</code></pre> <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> <h4>Parameters</h4>
<table> <table>
<thead> <thead>
@ -166,6 +139,34 @@
The size of the iv provided in bits. Only needed if encrypting and no iv is provided. The size of the iv provided in bits. Only needed if encrypting and no iv is provided.
</td> </td>
</tr> </tr>
<tr>
<td>
<code>expireUnit</code>
</td>
<td>
<code>string</code>
</td>
<td>
<var>never</var>
</td>
<td>
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> <tr>
<td> <td>
<code>genDeletionKey</code> <code>genDeletionKey</code>
@ -180,20 +181,6 @@
Generates a deletion key. Generates a deletion key.
</td> </td>
</tr> </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> </tbody>
</table> </table>
<h4>Response</h4> <h4>Response</h4>
@ -297,6 +284,28 @@
The size of the iv used in bits. The size of the iv used in bits.
</td> </td>
</tr> </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> <tr>
<td> <td>
<code>deletionKey</code> <code>deletionKey</code>

View File

@ -1,4 +1,4 @@
@model Teknik.Areas.Help.ViewModels.HelpViewModel @model Teknik.Areas.Help.ViewModels.UploadHelpViewModel
<div class="container"> <div class="container">
<ol class="breadcrumb"> <ol class="breadcrumb">
@ -38,7 +38,7 @@
</p> </p>
<h3>Upload Requirements</h3> <h3>Upload Requirements</h3>
<p> <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>
<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. 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.

View File

@ -91,42 +91,85 @@
</div> </div>
<br /> <br />
<div class="panel-body"> <div class="panel-body">
<a conditional href="@Url.SubRouteUrl("help", "Help.Mail")" asp-condition="@User.Identity.IsAuthenticated"> <div class="row">
<div class="col-md-3 text-center text-primary"> <a conditional href="@Url.SubRouteUrl("upload", "Upload.Index")" asp-condition="@User.Identity.IsAuthenticated">
<br /> <div class="col-md-3 text-center text-primary">
<i class="fa fa-envelope fa-5x"></i> <br />
<div class="caption"> <i class="fa fa-clock-o fa-5x"></i>
<h3>Email Account</h3> <div class="caption">
<h3>Non-Expiring Uploads</h3>
</div>
</div> </div>
</div> </a>
</a> <a conditional href="@Config.GitConfig.Host" asp-condition="@User.Identity.IsAuthenticated">
<a conditional href="@Config.GitConfig.Host" asp-condition="@User.Identity.IsAuthenticated"> <div class="col-md-3 text-center text-primary">
<div class="col-md-3 text-center text-primary"> <br />
<br /> <i class="fa fa-git fa-5x"></i>
<i class="fa fa-git fa-5x"></i> <div class="caption">
<div class="caption"> <h3>Unlimited Git Repos</h3>
<h3>Unlimited Git Repos</h3> </div>
</div> </div>
</div> </a>
</a> <a conditional href="@Url.SubRouteUrl("blog", "Blog.Blog", new { username = User.Identity.Name })" asp-condition="@User.Identity.IsAuthenticated">
<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">
<div class="col-md-3 text-center text-primary"> <br />
<br /> <i class="fa fa-book fa-5x"></i>
<i class="fa fa-book fa-5x"></i> <div class="caption">
<div class="caption"> <h3>Personal Blog</h3>
<h3>Personal Blog</h3> </div>
</div> </div>
</div> </a>
</a> <a conditional href="@Url.SubRouteUrl("account", "User.ViewServiceData")" asp-condition="@User.Identity.IsAuthenticated">
<a conditional href="@Url.SubRouteUrl("account", "User.ViewServiceData")" asp-condition="@User.Identity.IsAuthenticated"> <div class="col-md-3 text-center text-primary">
<div class="col-md-3 text-center text-primary"> <br />
<br /> <i class="fa fa-database fa-5x"></i>
<i class="fa fa-database fa-5x"></i> <div class="caption">
<div class="caption"> <h3>Service Data</h3>
<h3>Service Data</h3> </div>
</div> </div>
</div> </a>
</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>
</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>
</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>
</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>
</a>
</div>
</div> </div>
</div> </div>
</div> </div>