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

- 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.
This commit is contained in:
Uncled1023 2017-02-19 17:50:05 -08:00
parent b967bc07d6
commit da3d923ab7
48 changed files with 616 additions and 66 deletions

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -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.
</p>
<p>
You can view our complete activity and statistics by visiting the <a href="@Url.SubRouteUrl("transparency", "Transparency.Index")">Transparency</a> page.
You can view our complete activity and statistics by visiting the <a href="@Url.SubRouteUrl("status", "Status.Index")">status</a> page.
</p>
<br />
<hr>
<h2 class="text-center">Comparison of Features</h2>
<h2 class="text-center">What can you do with Teknik?</h2>
<br />
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
@ -33,8 +34,8 @@
</tr>
<!-- Prices -->
<tr>
<td class="text-left"><b>Features</b></td>
<td class="text-center">$5 Donation</td>
<td class="text-left"></td>
<td class="text-center">$@Model.Config.UserConfig.PremiumAccountPrice @Model.Config.UserConfig.PaymentType</td>
<td class="text-center">Free</td>
<td class="text-center">Free</td>
</tr>
@ -112,8 +113,8 @@
</tr>
<tr>
<td class="text-left">Max Upload Filesize</td>
<td class="text-center">@StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSize * 2)</td>
<td class="text-center">@StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSize)</td>
<td class="text-center">@StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSizePremium)</td>
<td class="text-center">@StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSizeBasic)</td>
<td class="text-center">@StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSize)</td>
</tr>
<tr>
@ -166,7 +167,7 @@
</p>
</div>
</div>
<br />
<hr>
<h2 class="text-center">How can I help?</h2>
<br />

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -0,0 +1,4 @@
.faqHeader {
font-size: 27px;
margin: 20px;
}

View File

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

View File

@ -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<string>() { "faq" },
new List<string>() { 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"));
}
}
}

View File

@ -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
{
}
}

View File

@ -0,0 +1,181 @@
@model Teknik.Areas.FAQ.ViewModels.FAQViewModel
@using Teknik.Utilities
@Styles.Render("~/Content/faq")
<div class="container">
<div class="row">
<div class="col-sm-12">
<div class="panel-group" id="accordion" role="tablist">
<div class="faqHeader">General Questions</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse0">What does Teknik mean?</a>
</h4>
</div>
<div id="collapse0" class="panel-collapse collapse" role="tabpanel">
<div class="panel-body">
Teknik means <i>Technology</i> in swedish.
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse3">Why did you make Teknik?</a>
</h4>
</div>
<div id="collapse3" class="panel-collapse collapse" role="tabpanel">
<div class="panel-body">
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.
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse2">How can I contact you?</a>
</h4>
</div>
<div id="collapse2" class="panel-collapse collapse" role="tabpanel">
<div class="panel-body">
You can contact us via the <a href="@Url.SubRouteUrl("contact", "Contact.Index")">Contact page</a> or email us at <a href="mailto:@Model.Config.SupportEmail">@Model.Config.SupportEmail</a>.
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse4">Can I view the source of Teknik?</a>
</h4>
</div>
<div id="collapse4" class="panel-collapse collapse" role="tabpanel">
<div class="panel-body">
You can view the source of Teknik as well as contribute by viewing our <a href="http://git.teknik.io/Teknikode/Teknik">git repository</a>.
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse1">Is Uncled1023 actually an uncle?</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse" role="tabpanel">
<div class="panel-body">
Yes :)
</div>
</div>
</div>
</div>
<div class="panel-group" id="accordion" role="tablist">
<div class="faqHeader">Accounts</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse100">Is account registration required?</a>
</h4>
</div>
<div id="collapse100" class="panel-collapse collapse" role="tabpanel">
<div class="panel-body">
Account registration is not required at <strong>Teknik</strong> 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 <a href="@Url.SubRouteUrl("about", "About.Index")">About Page</a>.
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse101">How do I sign up for an account?</a>
</h4>
</div>
<div id="collapse101" class="panel-collapse collapse" role="tabpanel">
<div class="panel-body">
To sign up for an account, you just need to click the <strong>Sign Up</strong> button on the top right of the navigation panel, or visit the <a href="@Url.SubRouteUrl("user", "User.Register")">Registration Page</a>.
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab">
<h4 class="panel-title">
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse102">How do I purchase a Premium Account?</a>
</h4>
</div>
<div id="collapse102" class="panel-collapse collapse" role="tabpanel">
<div class="panel-body">
To purchase a premium account, you can navigate to the <a href="@Url.SubRouteUrl("user", "User.PurchasePremium")">premium account</a> page and choose the method of payment and follow the instructions provided.
</div>
</div>
</div>
</div>
<div class="panel-group" id="accordion" role="tablist">
<div class="faqHeader">Uploads</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse200">What is the largest file size I can upload?</a>
</h4>
</div>
<div id="collapse200" class="panel-collapse collapse" role="tabpanel">
<div class="panel-body">
The max file size for everyone is <strong>@StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSize)</strong>, basic accounts are <strong>@StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSizeBasic)</strong>, and Premium accounts are <strong>@StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSizePremium)</strong>.
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse201">What files am I allowed to upload?</a>
</h4>
</div>
<div id="collapse201" class="panel-collapse collapse" role="tabpanel">
<div class="panel-body">
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 <a href="@Url.SubRouteUrl("tos", "TOS.Index")">Terms of Service</a>.
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse202">Can I delete a file I uploaded?</a>
</h4>
</div>
<div id="collapse202" class="panel-collapse collapse" role="tabpanel">
<div class="panel-body">
Every file has a deletion key generated when uploaded. When you are uploading a file, this key can be obtained by clicking the <strong>Deletion Link</strong> 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.
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse203">What does the option <strong>Encrypt in Browser</strong> mean?</a>
</h4>
</div>
<div id="collapse203" class="panel-collapse collapse" role="tabpanel">
<div class="panel-body">
When uploading a file, you have the option to encrypt the file using an <a href="https://en.wikipedia.org/wiki/Advanced_Encryption_Standard">AES-256 CTR</a> 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.
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" role="tab">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse204">My file is returning a 404 - Not Found, but I didn't delete it. Where is it?</a>
</h4>
</div>
<div id="collapse204" class="panel-collapse collapse" role="tabpanel">
<div class="panel-body">
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.
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,3 @@
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}

View File

@ -0,0 +1,36 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.Optimization" />
<add namespace="Teknik" />
</namespaces>
</pages>
</system.web.webPages.razor>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.webServer>
<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
</configuration>

View File

@ -9,8 +9,10 @@
<hr>
<h3 class="text-center">Important Links</h3>
<dl class="dl-horizontal">
<dt><a href="@Url.SubRouteUrl("transparency", "Transparency.Index")" target="_blank">Site Transparency</a></dt>
<dd>All the site's transactions, statistics, and data effecting actions.</dd>
<dt><a href="@Url.SubRouteUrl("faq", "FAQ.Index")" target="_blank">Frequently Asked Questions</a></dt>
<dd>Some of the more commonly asked questions and some answers regarding them.</dd>
<dt><a href="@Url.SubRouteUrl("status", "Status.Index")" target="_blank">Site Statistics</a></dt>
<dd>Current status of the server, and all the site's statistics, transactions, and data effecting actions.</dd>
<dt><a href="@Url.SubRouteUrl("privacy", "Privacy.Index")" target="_blank">Privacy Policy</a></dt>
<dd>Everything about how we handle your privacy.</dd>
<dt><a href="@Url.SubRouteUrl("tos", "TOS.Index")" target="_blank">Terms of Service</a></dt>

View File

@ -16,7 +16,7 @@
You can either access your email via the <a href="@Url.SubRouteUrl("mail", "Mail.Index")" target="_blank">Web Client</a> or by using a client of your choosing with support for IMAP(143|993) or POP3(110).
</p>
<div class="row">
<div class="col-md-12">
<div class="col-sm-12">
<ul class="list-group">
<li class="list-group-item text-center"><h4>Outlook</h4></li>
<br />
@ -44,7 +44,7 @@
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-sm-12">
<ul class="list-group">
<li class="list-group-item text-center"><h4>Thunderbird</h4></li>
<br />
@ -71,5 +71,44 @@
</ul>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<ul class="list-group">
<li class="list-group-item text-center"><h4>Mutt</h4></li>
<br />
<div class="col-sm-10 col-sm-offset-1">
<pre>#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</pre>
</div>
</ul>
</div>
</div>
</div>
</div>

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -45,6 +45,20 @@ $(document).ready(function () {
crosshairs: true,
pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.y:.2f}%</b><br/>'
},
plotOptions: {
line: {
marker: {
enabled: false,
symbol: 'circle',
radius: 2,
states: {
hover: {
enabled: true
}
}
}
}
},
credits: {
enabled: false
},
@ -108,6 +122,20 @@ $(document).ready(function () {
return '<span style="color:' + this.color + '">\u25CF</span> ' + this.series.name + ': <b>' + yVal + '</b><br/>';
}
},
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 '<span style="color:' + this.color + '">\u25CF</span> ' + this.series.name + ': <b>' + yVal + '</b><br/>';
}
},
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());
})
});

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -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;
}
}
}
<script>
var encScriptSrc = '@Scripts.Url("~/bundles/cryptoWorker")';
var aesScriptSrc = '@Scripts.Url("~/bundles/crypto")';
var uploadFileURL = '@Url.SubRouteUrl(Model.CurrentSub, "Upload.Action", new { action = "Upload" })';
var maxUploadSize = @Model.Config.UploadConfig.MaxUploadSize;
var maxUploadSize = @maxUploadSize;
var chunkSize = @Model.Config.UploadConfig.ChunkSize;
var keySize = @Model.Config.UploadConfig.KeySize;
var blockSize = @Model.Config.UploadConfig.BlockSize;
@ -78,7 +90,7 @@
To view the file decrypted, you must use the direct Teknik link in a javascript enabled browser.
</p>
<p>
The maximum file size per upload is <b>@StringHelper.GetBytesReadable(Model.Config.UploadConfig.MaxUploadSize)</b>
The maximum file size per upload is <b>@StringHelper.GetBytesReadable(maxUploadSize)</b>
</p>
</div>
<div class="text-center">

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using Teknik.Attributes;
using Teknik.Models;
using Teknik.Utilities;
namespace Teknik.Areas.Users.Models
{
@ -23,6 +24,8 @@ namespace Teknik.Areas.Users.Models
public DateTime LastSeen { get; set; }
public AccountType AccountType { get; set; }
public virtual ICollection<Group> Groups { get; set; }
public virtual UserSettings UserSettings { get; set; }
@ -52,6 +55,7 @@ namespace Teknik.Areas.Users.Models
Transfers = new List<TransferType>();
JoinDate = DateTime.Now;
LastSeen = DateTime.Now;
AccountType = AccountType.Basic;
Groups = new List<Group>();
TrustedDevices = new List<TrustedDevice>();
AuthTokens = new List<AuthToken>();

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

25
Teknik/BaseViewPage.cs Normal file
View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Teknik.Security;
namespace Teknik
{
public abstract class BaseViewPage : WebViewPage
{
public virtual new TeknikPrincipal User
{
get { return base.User as TeknikPrincipal; }
}
}
public abstract class BaseViewPage<TModel> : WebViewPage<TModel>
{
public virtual new TeknikPrincipal User
{
get { return base.User as TeknikPrincipal; }
}
}
}

View File

@ -5,6 +5,7 @@ using Teknik.Areas.Error.Controllers;
using Teknik.Configuration;
using Teknik.Filters;
using Teknik.Security;
using Teknik.Utilities;
namespace Teknik.Controllers
@ -30,6 +31,10 @@ namespace Teknik.Controllers
return _config;
}
}
protected virtual new TeknikPrincipal User
{
get { return HttpContext.User as TeknikPrincipal; }
}
public DefaultController()
{

View File

@ -15,6 +15,7 @@ using System.Diagnostics;
using Teknik.Utilities;
using System.Text;
using Teknik.Areas.Users.Utility;
using Teknik.Security;
namespace Teknik
{
@ -79,7 +80,6 @@ namespace Teknik
// Username and Roles for the current user
string username = string.Empty;
List<string> roles = new List<string>();
bool hasAuthToken = false;
if (Request != null)
@ -136,29 +136,7 @@ namespace Teknik
}
}
// Create the new user if we found one from the supplied auth info
if (!string.IsNullOrEmpty(username))
{
using (TeknikEntities entities = new TeknikEntities())
{
User user = UserHelper.GetUser(entities, username);
// Grab all their roles
foreach (Group grp in user.Groups)
{
foreach (Role role in grp.Roles)
{
if (!roles.Contains(role.Name))
{
roles.Add(role.Name);
}
}
}
}
HttpContext.Current.User = new System.Security.Principal.GenericPrincipal(
new System.Security.Principal.GenericIdentity(username, "Forms"), roles.ToArray());
}
HttpContext.Current.User = new TeknikPrincipal(username);
}
protected void Application_Error(object sender, EventArgs e)

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Web;
using Teknik.Areas.Users.Models;
namespace Teknik.Security
{
public interface ITeknikPrincipal : IPrincipal
{
User Info { get; }
}
}

View File

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Web;
using Teknik.Areas.Users.Models;
using Teknik.Areas.Users.Utility;
using Teknik.Models;
namespace Teknik.Security
{
public class TeknikPrincipal : ITeknikPrincipal
{
TeknikEntities entities = new TeknikEntities();
private IIdentity _Identity;
public IIdentity Identity
{
get
{
return this._Identity;
}
}
private User m_Info;
public User Info
{
get
{
if (m_Info == null && Identity != null && Identity.IsAuthenticated)
{
m_Info = UserHelper.GetUser(entities, Identity.Name);
}
return m_Info;
}
}
public TeknikPrincipal(string username)
{
this._Identity = new GenericIdentity(username, "Forms");
}
public bool IsInRole(string role)
{
if (Info != null)
{
// Grab all their roles
foreach (Group grp in Info.Groups)
{
foreach (Role curRole in grp.Roles)
{
if (curRole.Name == role)
{
return true;
}
}
}
}
return false;
}
}
}

View File

@ -12,6 +12,7 @@ namespace Teknik
public void Configuration(IAppBuilder app)
{
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888
// Start the SignalR Mappings
app.MapSignalR();
}
}

View File

@ -238,6 +238,9 @@
<Compile Include="Areas\Error\Controllers\ErrorController.cs" />
<Compile Include="Areas\Error\ErrorAreaRegistration.cs" />
<Compile Include="Areas\Error\ViewModels\ErrorViewModel.cs" />
<Compile Include="Areas\FAQ\Controllers\FAQController.cs" />
<Compile Include="Areas\FAQ\FAQAreaRegistration.cs" />
<Compile Include="Areas\FAQ\ViewModels\FAQViewModel.cs" />
<Compile Include="Areas\Help\Controllers\HelpController.cs" />
<Compile Include="Areas\Help\HelpAreaRegistration.cs" />
<Compile Include="Areas\Help\ViewModels\HelpViewModel.cs" />
@ -291,6 +294,8 @@
<Compile Include="Areas\Vault\ViewModels\PasteItemViewModel.cs" />
<Compile Include="Areas\Vault\ViewModels\VaultItemViewModel.cs" />
<Compile Include="Attributes\TeknikAuthorizeAttribute.cs" />
<Compile Include="Security\ITeknikPrincipal.cs" />
<Compile Include="Security\TeknikPrincipal.cs" />
<Compile Include="Filters\CORSActionFilter.cs" />
<Compile Include="Hubs\ServerUsageHub.cs" />
<Compile Include="Models\DataPoint.cs" />
@ -358,6 +363,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="App_Start\SubdomainRoute.cs" />
<Compile Include="App_Start\SubdomainRouteExtension.cs" />
<Compile Include="BaseViewPage.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="App_Data\reservedUsernames.txt">
@ -370,6 +376,7 @@
<Content Include="Areas\Blog\Content\Blog.css" />
<Content Include="Areas\Blog\Scripts\Blog.js" />
<Content Include="Areas\Contact\Scripts\Contact.js" />
<Content Include="Areas\FAQ\Content\FAQ.css" />
<Content Include="Areas\Help\Content\Help.css" />
<Content Include="Areas\Home\Content\Home.css" />
<Content Include="Areas\Home\Scripts\Home.js" />
@ -628,6 +635,9 @@
<Content Include="Areas\Status\Views\Status\OneTimes.cshtml" />
<Content Include="Areas\Status\Views\Status\Donations.cshtml" />
<Content Include="Areas\Status\Views\Status\Takedowns.cshtml" />
<Content Include="Areas\FAQ\Views\web.config" />
<Content Include="Areas\FAQ\Views\_ViewStart.cshtml" />
<Content Include="Areas\FAQ\Views\FAQ\Index.cshtml" />
<None Include="Properties\PublishProfiles\Teknik Dev.pubxml" />
<None Include="Properties\PublishProfiles\Teknik Production.pubxml" />
<None Include="Scripts\jquery-2.1.4.intellisense.js" />
@ -717,6 +727,8 @@
<Folder Include="Areas\Dev\Views\Shared\" />
<Folder Include="Areas\Error\Models\" />
<Folder Include="Areas\Error\Views\Shared\" />
<Folder Include="Areas\FAQ\Models\" />
<Folder Include="Areas\FAQ\Views\Shared\" />
<Folder Include="Areas\Help\Models\" />
<Folder Include="Areas\Help\Views\Shared\" />
<Folder Include="Areas\Home\Models\" />

View File

@ -51,7 +51,7 @@
}
<div class="row">
<div class="col-sm-5 col-sm-offset-1 text-left text-muted">
&copy; Teknik 2013-2017 | <a href="@Url.SubRouteUrl("privacy", "Privacy.Index")">Privacy</a> | <a href="@Url.SubRouteUrl("tos", "TOS.Index")">TOS</a> | <a href="@Url.SubRouteUrl("status", "Status.Index")">Status</a>
&copy; Teknik 2013-2017 | <a href="@Url.SubRouteUrl("faq", "FAQ.Index")">FAQ</a> | <a href="@Url.SubRouteUrl("privacy", "Privacy.Index")">Privacy</a> | <a href="@Url.SubRouteUrl("tos", "TOS.Index")">TOS</a> | <a href="@Url.SubRouteUrl("status", "Status.Index")">Status</a>
</div>
<div class="col-sm-5 text-right text-muted">
<div id="pagetime" style="display:none;">

View File

@ -10,7 +10,7 @@
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<pages pageBaseType="Teknik.BaseViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />

View File

@ -41,7 +41,6 @@ namespace Teknik.Configuration
private ShortenerConfig _ShortenerConfig;
private VaultConfig _VaultConfig;
private StatusConfig _StatusConfig;
private DatabaseConfig _DatabaseConfig;
private LoggingConfig _LoggingConfig;
private PiwikConfig _PiwikConfig;
@ -100,9 +99,6 @@ namespace Teknik.Configuration
// Status Configuration
public StatusConfig StatusConfig { get { return _StatusConfig; } set { _StatusConfig = value; } }
// Database Configuration
public DatabaseConfig DatabaseConfig { get { return _DatabaseConfig; } set { _DatabaseConfig = value; } }
// Logging Configuration
public LoggingConfig LoggingConfig { get { return _LoggingConfig; } set { _LoggingConfig = value; } }
@ -147,7 +143,6 @@ namespace Teknik.Configuration
ShortenerConfig = new ShortenerConfig();
VaultConfig = new VaultConfig();
StatusConfig = new StatusConfig();
DatabaseConfig = new DatabaseConfig();
LoggingConfig = new LoggingConfig();
PiwikConfig = new PiwikConfig();
}

View File

@ -2,7 +2,6 @@
{
public class DatabaseConfig
{
public bool Migrate { get; set; }
public string Server { get; set; }
public int Port { get; set; }
public string Database { get; set; }
@ -16,7 +15,6 @@
public void SetDefaults()
{
Migrate = false;
Server = "localhost";
Port = 3306;
Database = string.Empty;

View File

@ -12,6 +12,10 @@ namespace Teknik.Configuration
public bool DownloadEnabled { get; set; }
// Max upload size in bytes
public long MaxUploadSize { get; set; }
// Max Upload Size for basic users
public long MaxUploadSizeBasic { get; set; }
// Max Upload Size for premium users
public long MaxUploadSizePremium { get; set; }
// Location of the upload directory
public string UploadDirectory { get; set; }
// File Extension for saved files
@ -38,6 +42,8 @@ namespace Teknik.Configuration
UploadEnabled = true;
DownloadEnabled = true;
MaxUploadSize = 100000000;
MaxUploadSizeBasic = 100000000;
MaxUploadSizePremium = 100000000;
UploadDirectory = Directory.GetCurrentDirectory();
FileExtension = "enc";
UrlLength = 5;

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Teknik.Utilities;
namespace Teknik.Configuration
{
@ -16,6 +17,8 @@ namespace Teknik.Configuration
public int MinUsernameLength { get; set; }
public int MaxUsernameLength { get; set; }
public string ReservedUsernameDefinitionFile { get; set; }
public decimal PremiumAccountPrice { get; set; }
public string PaymentType { get; set; }
public UserConfig()
{
@ -27,6 +30,8 @@ namespace Teknik.Configuration
MinUsernameLength = 1;
MaxUsernameLength = 35;
ReservedUsernameDefinitionFile = string.Empty;
PremiumAccountPrice = 0;
PaymentType = "Donation";
}
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Teknik.Utilities
{
public enum AccountType
{
Basic,
Premium
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Teknik.Utilities
{
public static class EntityExtensions
{
}
}

View File

@ -105,8 +105,10 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AccountType.cs" />
<Compile Include="CurrencyHelper.cs" />
<Compile Include="CurrencyType.cs" />
<Compile Include="EntityExtensions.cs" />
<Compile Include="FileGenerateResult.cs" />
<Compile Include="HttpWebResponseResult.cs" />
<Compile Include="BundleExtensions.cs" />