From da3d923ab790906500443e150cc6b87b9fc744e2 Mon Sep 17 00:00:00 2001 From: Uncled1023 Date: Sun, 19 Feb 2017 17:50:05 -0800 Subject: [PATCH] - Created custom IPrincipal for the user session to include all the user information. - Added FAQ page with commonly asked questions. - Added separate config options for each tier of max upload size. - Updated help to point to the new pages. --- Teknik/Areas/API/Views/web.config | 2 +- Teknik/Areas/About/Views/About/Index.cshtml | 15 +- Teknik/Areas/About/Views/web.config | 2 +- Teknik/Areas/Admin/Views/web.config | 2 +- Teknik/Areas/Blog/Views/web.config | 2 +- Teknik/Areas/Contact/Views/web.config | 2 +- Teknik/Areas/Dev/Views/web.config | 2 +- Teknik/Areas/Error/Views/web.config | 2 +- Teknik/Areas/FAQ/Content/FAQ.css | 4 + Teknik/Areas/FAQ/Controllers/FAQController.cs | 25 +++ Teknik/Areas/FAQ/FAQAreaRegistration.cs | 36 ++++ Teknik/Areas/FAQ/ViewModels/FAQViewModel.cs | 12 ++ Teknik/Areas/FAQ/Views/FAQ/Index.cshtml | 181 ++++++++++++++++++ Teknik/Areas/FAQ/Views/_ViewStart.cshtml | 3 + Teknik/Areas/FAQ/Views/web.config | 36 ++++ Teknik/Areas/Help/Views/Help/Index.cshtml | 6 +- Teknik/Areas/Help/Views/Help/Mail.cshtml | 43 ++++- Teknik/Areas/Help/Views/web.config | 2 +- Teknik/Areas/Home/Views/web.config | 2 +- Teknik/Areas/Paste/Views/web.config | 2 +- Teknik/Areas/Podcast/Views/web.config | 2 +- Teknik/Areas/Privacy/Views/web.config | 2 +- Teknik/Areas/Shortener/Views/web.config | 2 +- Teknik/Areas/Status/Scripts/Status.js | 68 ++++++- Teknik/Areas/Status/Views/web.config | 2 +- Teknik/Areas/Stream/Views/web.config | 2 +- Teknik/Areas/TOS/Views/web.config | 2 +- Teknik/Areas/Upload/Views/Upload/Index.cshtml | 16 +- Teknik/Areas/Upload/Views/web.config | 2 +- Teknik/Areas/User/Models/User.cs | 4 + Teknik/Areas/User/Views/web.config | 2 +- Teknik/Areas/Vault/Views/web.config | 2 +- Teknik/BaseViewPage.cs | 25 +++ Teknik/Controllers/DefaultController.cs | 5 + Teknik/Global.asax.cs | 26 +-- Teknik/Security/ITeknikPrincipal.cs | 14 ++ Teknik/Security/TeknikPrincipal.cs | 62 ++++++ Teknik/Startup.cs | 1 + Teknik/Teknik.csproj | 12 ++ Teknik/Views/Shared/_Footer.cshtml | 2 +- Teknik/Views/Web.config | 2 +- Utilities/Configuration/Config.cs | 5 - Utilities/Configuration/DatabaseConfig.cs | 2 - Utilities/Configuration/UploadConfig.cs | 6 + Utilities/Configuration/UserConfig.cs | 5 + Utilities/Utilities/AccountType.cs | 14 ++ Utilities/Utilities/EntityExtensions.cs | 12 ++ Utilities/Utilities/Utilities.csproj | 2 + 48 files changed, 616 insertions(+), 66 deletions(-) create mode 100644 Teknik/Areas/FAQ/Content/FAQ.css create mode 100644 Teknik/Areas/FAQ/Controllers/FAQController.cs create mode 100644 Teknik/Areas/FAQ/FAQAreaRegistration.cs create mode 100644 Teknik/Areas/FAQ/ViewModels/FAQViewModel.cs create mode 100644 Teknik/Areas/FAQ/Views/FAQ/Index.cshtml create mode 100644 Teknik/Areas/FAQ/Views/_ViewStart.cshtml create mode 100644 Teknik/Areas/FAQ/Views/web.config create mode 100644 Teknik/BaseViewPage.cs create mode 100644 Teknik/Security/ITeknikPrincipal.cs create mode 100644 Teknik/Security/TeknikPrincipal.cs create mode 100644 Utilities/Utilities/AccountType.cs create mode 100644 Utilities/Utilities/EntityExtensions.cs diff --git a/Teknik/Areas/API/Views/web.config b/Teknik/Areas/API/Views/web.config index ada5aaf..013d8bf 100644 --- a/Teknik/Areas/API/Views/web.config +++ b/Teknik/Areas/API/Views/web.config @@ -10,7 +10,7 @@ - + diff --git a/Teknik/Areas/About/Views/About/Index.cshtml b/Teknik/Areas/About/Views/About/Index.cshtml index 51756c2..9668049 100644 --- a/Teknik/Areas/About/Views/About/Index.cshtml +++ b/Teknik/Areas/About/Views/About/Index.cshtml @@ -16,10 +16,11 @@ Teknik was created to provide our users free services that they can trust. All of our services are treated with the utmost care to provide you with the best experience possible, and the best security with your data that we can give.

- You can view our complete activity and statistics by visiting the Transparency page. + You can view our complete activity and statistics by visiting the status page.

+

-

Comparison of Features

+

What can you do with Teknik?


@@ -33,8 +34,8 @@ - Features - $5 Donation + + $@Model.Config.UserConfig.PremiumAccountPrice @Model.Config.UserConfig.PaymentType Free Free @@ -112,8 +113,8 @@ Max Upload Filesize - @StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSize * 2) - @StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSize) + @StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSizePremium) + @StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSizeBasic) @StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSize) @@ -166,7 +167,7 @@

- +

How can I help?


diff --git a/Teknik/Areas/About/Views/web.config b/Teknik/Areas/About/Views/web.config index ada5aaf..013d8bf 100644 --- a/Teknik/Areas/About/Views/web.config +++ b/Teknik/Areas/About/Views/web.config @@ -10,7 +10,7 @@ - + diff --git a/Teknik/Areas/Admin/Views/web.config b/Teknik/Areas/Admin/Views/web.config index ada5aaf..013d8bf 100644 --- a/Teknik/Areas/Admin/Views/web.config +++ b/Teknik/Areas/Admin/Views/web.config @@ -10,7 +10,7 @@ - + diff --git a/Teknik/Areas/Blog/Views/web.config b/Teknik/Areas/Blog/Views/web.config index ada5aaf..013d8bf 100644 --- a/Teknik/Areas/Blog/Views/web.config +++ b/Teknik/Areas/Blog/Views/web.config @@ -10,7 +10,7 @@ - + diff --git a/Teknik/Areas/Contact/Views/web.config b/Teknik/Areas/Contact/Views/web.config index ada5aaf..013d8bf 100644 --- a/Teknik/Areas/Contact/Views/web.config +++ b/Teknik/Areas/Contact/Views/web.config @@ -10,7 +10,7 @@ - + diff --git a/Teknik/Areas/Dev/Views/web.config b/Teknik/Areas/Dev/Views/web.config index ada5aaf..013d8bf 100644 --- a/Teknik/Areas/Dev/Views/web.config +++ b/Teknik/Areas/Dev/Views/web.config @@ -10,7 +10,7 @@ - + diff --git a/Teknik/Areas/Error/Views/web.config b/Teknik/Areas/Error/Views/web.config index ada5aaf..013d8bf 100644 --- a/Teknik/Areas/Error/Views/web.config +++ b/Teknik/Areas/Error/Views/web.config @@ -10,7 +10,7 @@ - + diff --git a/Teknik/Areas/FAQ/Content/FAQ.css b/Teknik/Areas/FAQ/Content/FAQ.css new file mode 100644 index 0000000..d90bee0 --- /dev/null +++ b/Teknik/Areas/FAQ/Content/FAQ.css @@ -0,0 +1,4 @@ +.faqHeader { + font-size: 27px; + margin: 20px; +} \ No newline at end of file diff --git a/Teknik/Areas/FAQ/Controllers/FAQController.cs b/Teknik/Areas/FAQ/Controllers/FAQController.cs new file mode 100644 index 0000000..f95abda --- /dev/null +++ b/Teknik/Areas/FAQ/Controllers/FAQController.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using Teknik.Areas.FAQ.ViewModels; +using Teknik.Attributes; +using Teknik.Controllers; +using Teknik.Filters; + +namespace Teknik.Areas.FAQ.Controllers +{ + [TeknikAuthorize] + public class FAQController : DefaultController + { + [TrackPageView] + [AllowAnonymous] + public ActionResult Index() + { + ViewBag.Title = "Frequently Asked Questions - " + Config.Title; + FAQViewModel model = new FAQViewModel(); + return View(model); + } + } +} \ No newline at end of file diff --git a/Teknik/Areas/FAQ/FAQAreaRegistration.cs b/Teknik/Areas/FAQ/FAQAreaRegistration.cs new file mode 100644 index 0000000..6426e63 --- /dev/null +++ b/Teknik/Areas/FAQ/FAQAreaRegistration.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using System.Web.Mvc; +using System.Web.Optimization; +using Teknik.Configuration; +using Teknik.Utilities; + +namespace Teknik.Areas.FAQ +{ + public class FAQAreaRegistration : AreaRegistration + { + public override string AreaName + { + get + { + return "FAQ"; + } + } + + public override void RegisterArea(AreaRegistrationContext context) + { + Config config = Config.Load(); + context.MapSubdomainRoute( + "FAQ.Index", // Route name + new List() { "faq" }, + new List() { config.Host }, + "", // URL with parameters + new { controller = "FAQ", action = "Index" }, // Parameter defaults + new[] { typeof(Controllers.FAQController).Namespace } + ); + + // Register Style Bundle + BundleTable.Bundles.Add(new CdnStyleBundle("~/Content/faq", config.CdnHost).Include( + "~/Areas/FAQ/Content/FAQ.css")); + } + } +} \ No newline at end of file diff --git a/Teknik/Areas/FAQ/ViewModels/FAQViewModel.cs b/Teknik/Areas/FAQ/ViewModels/FAQViewModel.cs new file mode 100644 index 0000000..41e514e --- /dev/null +++ b/Teknik/Areas/FAQ/ViewModels/FAQViewModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using Teknik.ViewModels; + +namespace Teknik.Areas.FAQ.ViewModels +{ + public class FAQViewModel : ViewModelBase + { + } +} \ No newline at end of file diff --git a/Teknik/Areas/FAQ/Views/FAQ/Index.cshtml b/Teknik/Areas/FAQ/Views/FAQ/Index.cshtml new file mode 100644 index 0000000..d98bc96 --- /dev/null +++ b/Teknik/Areas/FAQ/Views/FAQ/Index.cshtml @@ -0,0 +1,181 @@ +@model Teknik.Areas.FAQ.ViewModels.FAQViewModel + +@using Teknik.Utilities + +@Styles.Render("~/Content/faq") + +
+
+
+
+
General Questions
+
+ +
+
+ Teknik means Technology in swedish. +
+
+
+
+ +
+
+ I made Teknik originally as a page to showcase an IRC channel I was co-moderating. I began creating different services for the members of the channel, and it quickly grew and interest started to grow from outside the channel. + This led to changing Teknik to be an independent venture away from the IRC channel. As time went on I continued to add new features that I wanted to try out, and that users requested. Today I work on it as a passion project and want to keep providing services that people like to use. +
+
+
+
+ +
+
+ You can contact us via the Contact page or email us at @Model.Config.SupportEmail. +
+
+
+
+ +
+
+ You can view the source of Teknik as well as contribute by viewing our git repository. +
+
+
+
+ +
+
+ Yes :) +
+
+
+
+
+
Accounts
+
+ +
+
+ Account registration is not required at Teknik for most of the free services. If you want to use any of the user specific features, you must register an account. + You can view more about what is available with and without an account on our About Page. +
+
+
+
+ +
+
+ To sign up for an account, you just need to click the Sign Up button on the top right of the navigation panel, or visit the Registration Page. +
+
+
+
+ +
+
+ To purchase a premium account, you can navigate to the premium account page and choose the method of payment and follow the instructions provided. +
+
+
+
+
+
Uploads
+
+ +
+
+ The max file size for everyone is @StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSize), basic accounts are @StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSizeBasic), and Premium accounts are @StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSizePremium). +
+
+
+
+ +
+
+ You are allowed to upload any file that you would like, except for a few exceptions. No Malware, or Copyright information is allowed. For a full look at what is allowed, view the upload section in the Terms of Service. +
+
+
+
+ +
+
+ Every file has a deletion key generated when uploaded. When you are uploading a file, this key can be obtained by clicking the Deletion Link button for that upload. You can then navigate to the deletion link and the file will be deleted. + If you are logged in, you can also go to your profile page to view all your uploads, and delete them from there. +
+
+
+
+ +
+
+ When uploading a file, you have the option to encrypt the file using an AES-256 CTR cipher via Javascript in your browser. + This generates a random key that is not transported to the server, and only available to you. To view files encrypted in the browser, you must supply this key as the anchor tag in the URL, or when prompted for it when viewing the download link for the file. +
+
+
+
+ +
+
+ If an upload is returning a 404 error, this could mean that the upload was deleted due to being scanned and flagged as malware by the automated system, or had a valid DMCA served against it. +
+
+
+
+
+
+
diff --git a/Teknik/Areas/FAQ/Views/_ViewStart.cshtml b/Teknik/Areas/FAQ/Views/_ViewStart.cshtml new file mode 100644 index 0000000..2de6241 --- /dev/null +++ b/Teknik/Areas/FAQ/Views/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "~/Views/Shared/_Layout.cshtml"; +} diff --git a/Teknik/Areas/FAQ/Views/web.config b/Teknik/Areas/FAQ/Views/web.config new file mode 100644 index 0000000..013d8bf --- /dev/null +++ b/Teknik/Areas/FAQ/Views/web.config @@ -0,0 +1,36 @@ + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Teknik/Areas/Help/Views/Help/Index.cshtml b/Teknik/Areas/Help/Views/Help/Index.cshtml index e25fab6..bfbbeb3 100644 --- a/Teknik/Areas/Help/Views/Help/Index.cshtml +++ b/Teknik/Areas/Help/Views/Help/Index.cshtml @@ -9,8 +9,10 @@

Important Links

-
Site Transparency
-
All the site's transactions, statistics, and data effecting actions.
+
Frequently Asked Questions
+
Some of the more commonly asked questions and some answers regarding them.
+
Site Statistics
+
Current status of the server, and all the site's statistics, transactions, and data effecting actions.
Privacy Policy
Everything about how we handle your privacy.
Terms of Service
diff --git a/Teknik/Areas/Help/Views/Help/Mail.cshtml b/Teknik/Areas/Help/Views/Help/Mail.cshtml index 7aa5953..4b23e38 100644 --- a/Teknik/Areas/Help/Views/Help/Mail.cshtml +++ b/Teknik/Areas/Help/Views/Help/Mail.cshtml @@ -16,7 +16,7 @@ You can either access your email via the Web Client or by using a client of your choosing with support for IMAP(143|993) or POP3(110).

-
+
  • Outlook


  • @@ -44,7 +44,7 @@
-
+
  • Thunderbird


  • @@ -71,5 +71,44 @@
+
+
+
    +
  • Mutt

  • +
    +
    +
    #You can set your editor of preference here
    +set editor=vim
    +
    +#It's important to set your real name and from email address to avoid SMTP errors.
    +set realname="My Name"
    +set from=example@teknik.io
    +set use_from=yes
    +
    +set imap_user=example@teknik.io
    +
    +#Don't set your password here, mutt will prompt you for it.
    +#set imap_pass=lulpasshere
    +
    +#This is an example IMAP configuration.
    +set folder="imaps://mail.teknik.io/"
    +set spoolfile=+INBOX
    +set record="Sent"
    +set postponed="Drafts"
    +
    +#This is to send email, uses your imap user to send.
    +#Again, mutt will prompt you for your teknik email password.
    +set smtp_url="smtps://$imap_user@mail.teknik.io/"
    +
    +#Miscellaneous configuration, check mutt man pages or online documentation to see what they do.
    +set ssl_starttls=yes
    +unset imap_passive
    +set imap_check_subscribed
    +set net_inc=5
    +set mail_check = 360
    +
    +
+
+
diff --git a/Teknik/Areas/Help/Views/web.config b/Teknik/Areas/Help/Views/web.config index ada5aaf..013d8bf 100644 --- a/Teknik/Areas/Help/Views/web.config +++ b/Teknik/Areas/Help/Views/web.config @@ -10,7 +10,7 @@ - + diff --git a/Teknik/Areas/Home/Views/web.config b/Teknik/Areas/Home/Views/web.config index ada5aaf..013d8bf 100644 --- a/Teknik/Areas/Home/Views/web.config +++ b/Teknik/Areas/Home/Views/web.config @@ -10,7 +10,7 @@ - + diff --git a/Teknik/Areas/Paste/Views/web.config b/Teknik/Areas/Paste/Views/web.config index 5be3478..7adceda 100644 --- a/Teknik/Areas/Paste/Views/web.config +++ b/Teknik/Areas/Paste/Views/web.config @@ -10,7 +10,7 @@ - + diff --git a/Teknik/Areas/Podcast/Views/web.config b/Teknik/Areas/Podcast/Views/web.config index ada5aaf..013d8bf 100644 --- a/Teknik/Areas/Podcast/Views/web.config +++ b/Teknik/Areas/Podcast/Views/web.config @@ -10,7 +10,7 @@ - + diff --git a/Teknik/Areas/Privacy/Views/web.config b/Teknik/Areas/Privacy/Views/web.config index ada5aaf..013d8bf 100644 --- a/Teknik/Areas/Privacy/Views/web.config +++ b/Teknik/Areas/Privacy/Views/web.config @@ -10,7 +10,7 @@ - + diff --git a/Teknik/Areas/Shortener/Views/web.config b/Teknik/Areas/Shortener/Views/web.config index ada5aaf..013d8bf 100644 --- a/Teknik/Areas/Shortener/Views/web.config +++ b/Teknik/Areas/Shortener/Views/web.config @@ -10,7 +10,7 @@ - + diff --git a/Teknik/Areas/Status/Scripts/Status.js b/Teknik/Areas/Status/Scripts/Status.js index a8603a6..afeea28 100644 --- a/Teknik/Areas/Status/Scripts/Status.js +++ b/Teknik/Areas/Status/Scripts/Status.js @@ -45,6 +45,20 @@ $(document).ready(function () { crosshairs: true, pointFormat: '\u25CF {series.name}: {point.y:.2f}%
' }, + plotOptions: { + line: { + marker: { + enabled: false, + symbol: 'circle', + radius: 2, + states: { + hover: { + enabled: true + } + } + } + } + }, credits: { enabled: false }, @@ -108,6 +122,20 @@ $(document).ready(function () { return '\u25CF ' + this.series.name + ': ' + yVal + '
'; } }, + plotOptions: { + line: { + marker: { + enabled: false, + symbol: 'circle', + radius: 2, + states: { + hover: { + enabled: true + } + } + } + } + }, credits: { enabled: false }, @@ -134,7 +162,6 @@ $(document).ready(function () { chart: { useUTC: false, renderTo: 'network-usage-chart', - type: 'line', marginRight: 10 }, title: { @@ -169,16 +196,48 @@ $(document).ready(function () { return '\u25CF ' + this.series.name + ': ' + yVal + '
'; } }, + plotOptions: { + area: { + marker: { + enabled: false, + symbol: 'circle', + radius: 2, + states: { + hover: { + enabled: true + } + } + } + }, + line: { + marker: { + enabled: false, + symbol: 'circle', + radius: 2, + states: { + hover: { + enabled: true + } + } + } + } + }, credits: { enabled: false }, series: [ { + type: 'line', name: 'Sent', + dashStyle: 'Dash', + color: '#7cb5ec', data: [] }, { + type: 'area', name: 'Received', + color: '#7cb5ec', + fillOpacity: 0.3, data: [] } ] @@ -301,4 +360,11 @@ $(document).ready(function () { $('a[href="#site-stats"]').on('shown.bs.tab', function (e) { visitChart.setSize($('#visitor-chart').width(), $('#visitor-chart').height()); }) + + // Resize the chart when viewing the tab (initial width is wrong due to chart being hidden) + $('a[href="#realtime-stats"]').on('shown.bs.tab', function (e) { + cpuUsageChart.setSize($('#cpu-usage-chart').width(), $('#cpu-usage-chart').height()); + memUsageChart.setSize($('#mem-usage-chart').width(), $('#mem-usage-chart').height()); + networkUsageChart.setSize($('#network-usage-chart').width(), $('#network-usage-chart').height()); + }) }); \ No newline at end of file diff --git a/Teknik/Areas/Status/Views/web.config b/Teknik/Areas/Status/Views/web.config index ada5aaf..013d8bf 100644 --- a/Teknik/Areas/Status/Views/web.config +++ b/Teknik/Areas/Status/Views/web.config @@ -10,7 +10,7 @@ - + diff --git a/Teknik/Areas/Stream/Views/web.config b/Teknik/Areas/Stream/Views/web.config index ada5aaf..013d8bf 100644 --- a/Teknik/Areas/Stream/Views/web.config +++ b/Teknik/Areas/Stream/Views/web.config @@ -10,7 +10,7 @@ - + diff --git a/Teknik/Areas/TOS/Views/web.config b/Teknik/Areas/TOS/Views/web.config index ada5aaf..013d8bf 100644 --- a/Teknik/Areas/TOS/Views/web.config +++ b/Teknik/Areas/TOS/Views/web.config @@ -10,7 +10,7 @@ - + diff --git a/Teknik/Areas/Upload/Views/Upload/Index.cshtml b/Teknik/Areas/Upload/Views/Upload/Index.cshtml index 632b260..ee3a5b4 100644 --- a/Teknik/Areas/Upload/Views/Upload/Index.cshtml +++ b/Teknik/Areas/Upload/Views/Upload/Index.cshtml @@ -3,11 +3,23 @@ @using Teknik.Utilities @using Teknik.Areas.Vault.Models +@{ + long maxUploadSize = Model.Config.UploadConfig.MaxUploadSize; + if (User.Identity.IsAuthenticated) + { + maxUploadSize = Model.Config.UploadConfig.MaxUploadSizeBasic; + if (User.Info.AccountType == AccountType.Premium) + { + maxUploadSize = Model.Config.UploadConfig.MaxUploadSizePremium; + } + } +} +