Browse Source

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

Teknikode 3 weeks ago
parent
commit
e901bbda6d

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

@@ -2,13 +2,17 @@
2 2
 using Microsoft.AspNetCore.Http;
3 3
 using Microsoft.AspNetCore.Mvc;
4 4
 using Microsoft.Extensions.Logging;
5
+using System.Threading.Tasks;
5 6
 using Teknik.Areas.Help.ViewModels;
7
+using Teknik.Areas.Users.Models;
8
+using Teknik.Areas.Users.Utility;
6 9
 using Teknik.Attributes;
7 10
 using Teknik.Configuration;
8 11
 using Teknik.Controllers;
9 12
 using Teknik.Data;
10 13
 using Teknik.Filters;
11 14
 using Teknik.Logging;
15
+using Teknik.Utilities;
12 16
 
13 17
 namespace Teknik.Areas.Help.Controllers
14 18
 {
@@ -109,10 +113,25 @@ namespace Teknik.Areas.Help.Controllers
109 113
         }
110 114
         
111 115
         [AllowAnonymous]
112
-        public IActionResult Upload()
116
+        public async Task<IActionResult> Upload()
113 117
         {
114 118
             ViewBag.Title = "Upload Service Help";
115
-            HelpViewModel model = new HelpViewModel();
119
+            UploadHelpViewModel model = new UploadHelpViewModel();
120
+
121
+            model.MaxUploadSize = _config.UploadConfig.MaxUploadSize;
122
+            if (User.Identity.IsAuthenticated)
123
+            {
124
+                User user = UserHelper.GetUser(_dbContext, User.Identity.Name);
125
+                if (user != null)
126
+                {
127
+                    model.MaxUploadSize = _config.UploadConfig.MaxUploadSizeBasic;
128
+                    IdentityUserInfo userInfo = await IdentityHelper.GetIdentityUserInfo(_config, User.Identity.Name);
129
+                    if (userInfo.AccountType == AccountType.Premium)
130
+                    {
131
+                        model.MaxUploadSize = _config.UploadConfig.MaxUploadSizePremium;
132
+                    }
133
+                }
134
+            }
116 135
             return View("~/Areas/Help/Views/Help/Upload.cshtml", model);
117 136
         }
118 137
     }

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

@@ -0,0 +1,13 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Threading.Tasks;
5
+using Teknik.ViewModels;
6
+
7
+namespace Teknik.Areas.Help.ViewModels
8
+{
9
+    public class UploadHelpViewModel : ViewModelBase
10
+    {
11
+        public long MaxUploadSize { get; set; }
12
+    }
13
+}

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

@@ -17,33 +17,6 @@
17 17
         <p>This is a description of the API commands available for the Paste service.</p>
18 18
         <h3>Submit a Paste</h3>
19 19
         <pre><code>POST @Url.SubRouteUrl("api", "API.v1.Paste")</code></pre>
20
-        <h4>Headers</h4>
21
-        <table>
22
-            <thead>
23
-                <tr>
24
-                    <th>Name</th>
25
-                    <th>Value</th>
26
-                    <th>Default Value</th>
27
-                    <th>Description</th>
28
-                </tr>
29
-            </thead>
30
-            <tbody>
31
-                <tr>
32
-                    <td>
33
-                        <code>Authorization</code>
34
-                    </td>
35
-                    <td>
36
-                        <code>Basic <i>Encoding.Base64</i>(&lt;username&gt;:&lt;token&gt;)</code>
37
-                    </td>
38
-                    <td>
39
-                        <var>NULL</var>
40
-                    </td>
41
-                    <td>
42
-                        Basic Authentication to associate the paste with your account.
43
-                    </td>
44
-                </tr>
45
-            </tbody>
46
-        </table>
47 20
         <h4>Parameters</h4>
48 21
         <table>
49 22
             <thead>
@@ -154,20 +127,6 @@
154 127
                         Specify a password to encrypt and lock the paste with.
155 128
                     </td>
156 129
                 </tr>
157
-                <tr>
158
-                    <td>
159
-                        <code>doNotTrack</code>
160
-                    </td>
161
-                    <td>
162
-                        <code>bool</code>
163
-                    </td>
164
-                    <td>
165
-                        <var>false</var>
166
-                    </td>
167
-                    <td>
168
-                        If you do not want the api request to be tracked as defined in the privacy policy.
169
-                    </td>
170
-                </tr>
171 130
             </tbody>
172 131
         </table>
173 132
         <h4>Response</h4>

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

@@ -15,33 +15,6 @@
15 15
         <p>This is a description of the API commands available for the Url Shortening service.</p>
16 16
         <h3>Shorten a Url</h3>
17 17
         <pre><code>POST @Url.SubRouteUrl("api", "API.v1.Shorten")</code></pre>
18
-        <h4>Headers</h4>
19
-        <table>
20
-            <thead>
21
-                <tr>
22
-                    <th>Name</th>
23
-                    <th>Value</th>
24
-                    <th>Default Value</th>
25
-                    <th>Description</th>
26
-                </tr>
27
-            </thead>
28
-            <tbody>
29
-                <tr>
30
-                    <td>
31
-                        <code>Authorization</code>
32
-                    </td>
33
-                    <td>
34
-                        <code>Basic <i>Encoding.Base64</i>(&lt;username&gt;:&lt;token&gt;)</code>
35
-                    </td>
36
-                    <td>
37
-                        <var>NULL</var>
38
-                    </td>
39
-                    <td>
40
-                        Basic Authentication to associate the shortened url with your account.
41
-                    </td>
42
-                </tr>
43
-            </tbody>
44
-        </table>
45 18
         <h4>Parameters</h4>
46 19
         <table>
47 20
             <thead>

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

@@ -15,33 +15,6 @@
15 15
         <p>This is a description of the API commands available for the Upload service.</p>
16 16
         <h3>Upload a File</h3>
17 17
         <pre><code>POST @Url.SubRouteUrl("api", "API.v1.Upload")</code></pre>
18
-        <h4>Headers</h4>
19
-        <table>
20
-            <thead>
21
-                <tr>
22
-                    <th>Name</th>
23
-                    <th>Value</th>
24
-                    <th>Default Value</th>
25
-                    <th>Description</th>
26
-                </tr>
27
-            </thead>
28
-            <tbody>
29
-                <tr>
30
-                    <td>
31
-                        <code>Authorization</code>
32
-                    </td>
33
-                    <td>
34
-                        <code>Basic <i>Encoding.Base64</i>(&lt;username&gt;:&lt;token&gt;)</code>
35
-                    </td>
36
-                    <td>
37
-                        <var>NULL</var>
38
-                    </td>
39
-                    <td>
40
-                        Basic Authentication to associate the upload with your account.
41
-                    </td>
42
-                </tr>
43
-            </tbody>
44
-        </table>
45 18
         <h4>Parameters</h4>
46 19
         <table>
47 20
             <thead>
@@ -168,21 +141,35 @@
168 141
                 </tr>
169 142
                 <tr>
170 143
                     <td>
171
-                        <code>genDeletionKey</code>
144
+                        <code>expireUnit</code>
172 145
                     </td>
173 146
                     <td>
174
-                        <code>bool</code>
147
+                        <code>string</code>
175 148
                     </td>
176 149
                     <td>
177
-                        <var>false</var>
150
+                        <var>never</var>
178 151
                     </td>
179 152
                     <td>
180
-                        Generates a deletion key.
153
+                        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>
154
+                    </td>
155
+                </tr>
156
+                <tr>
157
+                    <td>
158
+                        <code>expireLength</code>
159
+                    </td>
160
+                    <td>
161
+                        <code>int</code>
162
+                    </td>
163
+                    <td>
164
+                        <var>1</var>
165
+                    </td>
166
+                    <td>
167
+                        The length of whatever unit you choose before the paste is deleted.
181 168
                     </td>
182 169
                 </tr>
183 170
                 <tr>
184 171
                     <td>
185
-                        <code>doNotTrack</code>
172
+                        <code>genDeletionKey</code>
186 173
                     </td>
187 174
                     <td>
188 175
                         <code>bool</code>
@@ -191,7 +178,7 @@
191 178
                         <var>false</var>
192 179
                     </td>
193 180
                     <td>
194
-                        If you do not want the api request to be tracked as defined in the privacy policy.
181
+                        Generates a deletion key.
195 182
                     </td>
196 183
                 </tr>
197 184
             </tbody>
@@ -297,6 +284,28 @@
297 284
                         The size of the iv used in bits.
298 285
                     </td>
299 286
                 </tr>
287
+                <tr>
288
+                    <td>
289
+                        <code>maxDownloads</code>
290
+                    </td>
291
+                    <td>
292
+                        <code>int</code>
293
+                    </td>
294
+                    <td>
295
+                        The maximum number of uploads before the upload is deleted.
296
+                    </td>
297
+                </tr>
298
+                <tr>
299
+                    <td>
300
+                        <code>expirationDate</code>
301
+                    </td>
302
+                    <td>
303
+                        <code>datetime</code>
304
+                    </td>
305
+                    <td>
306
+                        The date of expiration of the upload.
307
+                    </td>
308
+                </tr>
300 309
                 <tr>
301 310
                     <td>
302 311
                         <code>deletionKey</code>

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

@@ -1,4 +1,4 @@
1
-@model Teknik.Areas.Help.ViewModels.HelpViewModel
1
+@model Teknik.Areas.Help.ViewModels.UploadHelpViewModel
2 2
 
3 3
 <div class="container">
4 4
     <ol class="breadcrumb">
@@ -38,7 +38,7 @@
38 38
             </p>
39 39
             <h3>Upload Requirements</h3>
40 40
             <p>
41
-                The maximum file size per upload is <b>@StringHelper.GetBytesReadable(Config.UploadConfig.MaxUploadSize)</b>
41
+                The maximum file size per upload is <b>@StringHelper.GetBytesReadable(Model.MaxUploadSize)</b>
42 42
             </p>
43 43
             <p>
44 44
                 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 @@
91 91
                 </div>
92 92
                 <br />
93 93
                 <div class="panel-body">
94
-                    <a conditional href="@Url.SubRouteUrl("help", "Help.Mail")" asp-condition="@User.Identity.IsAuthenticated">
95
-                        <div class="col-md-3 text-center text-primary">
96
-                            <br />
97
-                            <i class="fa fa-envelope fa-5x"></i>
98
-                            <div class="caption">
99
-                                <h3>Email Account</h3>
94
+                    <div class="row">
95
+                        <a conditional href="@Url.SubRouteUrl("upload", "Upload.Index")" asp-condition="@User.Identity.IsAuthenticated">
96
+                            <div class="col-md-3 text-center text-primary">
97
+                                <br />
98
+                                <i class="fa fa-clock-o fa-5x"></i>
99
+                                <div class="caption">
100
+                                    <h3>Non-Expiring Uploads</h3>
101
+                                </div>
102
+                            </div>
103
+                        </a>
104
+                        <a conditional href="@Config.GitConfig.Host" asp-condition="@User.Identity.IsAuthenticated">
105
+                            <div class="col-md-3 text-center text-primary">
106
+                                <br />
107
+                                <i class="fa fa-git fa-5x"></i>
108
+                                <div class="caption">
109
+                                    <h3>Unlimited Git Repos</h3>
110
+                                </div>
111
+                            </div>
112
+                        </a>
113
+                        <a conditional href="@Url.SubRouteUrl("blog", "Blog.Blog", new { username = User.Identity.Name })" asp-condition="@User.Identity.IsAuthenticated">
114
+                            <div class="col-md-3 text-center text-primary">
115
+                                <br />
116
+                                <i class="fa fa-book fa-5x"></i>
117
+                                <div class="caption">
118
+                                    <h3>Personal Blog</h3>
119
+                                </div>
120
+                            </div>
121
+                        </a>
122
+                        <a conditional href="@Url.SubRouteUrl("account", "User.ViewServiceData")" asp-condition="@User.Identity.IsAuthenticated">
123
+                            <div class="col-md-3 text-center text-primary">
124
+                                <br />
125
+                                <i class="fa fa-database fa-5x"></i>
126
+                                <div class="caption">
127
+                                    <h3>Service Data</h3>
128
+                                </div>
129
+                            </div>
130
+                        </a>
131
+                    </div>
132
+                    <br />
133
+                    <hr />
134
+                    <h2 class="text-center"><a href="@Url.SubRouteUrl("account", "User.GetPremium")">Upgrade to Premium</a> for even more features!</h2>
135
+                    <div class="row">
136
+                        <a conditional href="@Url.SubRouteUrl("help", "Help.Mail")" asp-condition="@User.Identity.IsAuthenticated">
137
+                            <div class="col-md-3 text-center text-primary">
138
+                                <br />
139
+                                <i class="fa fa-envelope fa-5x"></i>
140
+                                <div class="caption">
141
+                                    <h3>Email Account</h3>
142
+                                </div>
100 143
                             </div>
101
-                        </div>
102
-                    </a>
103
-                    <a conditional href="@Config.GitConfig.Host" asp-condition="@User.Identity.IsAuthenticated">
104
-                        <div class="col-md-3 text-center text-primary">
105
-                            <br />
106
-                            <i class="fa fa-git fa-5x"></i>
107
-                            <div class="caption">
108
-                                <h3>Unlimited Git Repos</h3>
144
+                        </a>
145
+                        <a conditional href="@Url.SubRouteUrl("upload", "Upload.Index")" asp-condition="@User.Identity.IsAuthenticated">
146
+                            <div class="col-md-3 text-center text-primary">
147
+                                <br />
148
+                                <i class="fa fa-upload fa-5x"></i>
149
+                                <div class="caption">
150
+                                    <h3>Larger Upload Size</h3>
151
+                                </div>
109 152
                             </div>
110
-                        </div>
111
-                    </a>
112
-                    <a conditional href="@Url.SubRouteUrl("blog", "Blog.Blog", new { username = User.Identity.Name })" asp-condition="@User.Identity.IsAuthenticated">
113
-                        <div class="col-md-3 text-center text-primary">
114
-                            <br />
115
-                            <i class="fa fa-book fa-5x"></i>
116
-                            <div class="caption">
117
-                                <h3>Personal Blog</h3>
153
+                        </a>
154
+                        <a conditional href="@Url.SubRouteUrl("upload", "Upload.Index")" asp-condition="@User.Identity.IsAuthenticated">
155
+                            <div class="col-md-3 text-center text-primary">
156
+                                <br />
157
+                                <i class="fa fa-film fa-5x"></i>
158
+                                <div class="caption">
159
+                                    <h3>No Embed Limits</h3>
160
+                                </div>
118 161
                             </div>
119
-                        </div>
120
-                    </a>
121
-                    <a conditional href="@Url.SubRouteUrl("account", "User.ViewServiceData")" asp-condition="@User.Identity.IsAuthenticated">
122
-                        <div class="col-md-3 text-center text-primary">
123
-                            <br />
124
-                            <i class="fa fa-database fa-5x"></i>
125
-                            <div class="caption">
126
-                                <h3>Service Data</h3>
162
+                        </a>
163
+                        <a conditional href="@Url.SubRouteUrl("about", "About.Index")" asp-condition="@User.Identity.IsAuthenticated">
164
+                            <div class="col-md-3 text-center text-primary">
165
+                                <br />
166
+                                <i class="fa fa-heart fa-5x"></i>
167
+                                <div class="caption">
168
+                                    <h3>Lifetime Account</h3>
169
+                                </div>
127 170
                             </div>
128
-                        </div>
129
-                    </a>
171
+                        </a>
172
+                    </div>
130 173
                 </div>
131 174
             </div>
132 175
         </div>

Loading…
Cancel
Save