Browse Source

Initial creation of the Vault

pull/29/head
Teknikode 7 years ago
parent
commit
1f485c0aee
  1. 1
      Teknik/App_Start/BundleConfig.cs
  2. 9
      Teknik/App_Start/RouteConfig.cs
  3. 4
      Teknik/Areas/Error/Views/Error/Exception.cshtml
  4. 9
      Teknik/Areas/Paste/PasteAreaRegistration.cs
  5. 4
      Teknik/Areas/Upload/Controllers/UploadController.cs
  6. 9
      Teknik/Areas/Upload/UploadAreaRegistration.cs
  7. 24
      Teknik/Areas/Vault/Controllers/VaultController.cs
  8. 13
      Teknik/Areas/Vault/Models/PasteItem.cs
  9. 13
      Teknik/Areas/Vault/Models/UploadItem.cs
  10. 28
      Teknik/Areas/Vault/Models/Vault.cs
  11. 15
      Teknik/Areas/Vault/Models/VaultItem.cs
  12. 35
      Teknik/Areas/Vault/VaultAreaRegistration.cs
  13. 22
      Teknik/Areas/Vault/ViewModels/VaultViewModel.cs
  14. 7
      Teknik/Areas/Vault/Views/Vault/ViewVault.cshtml
  15. 0
      Teknik/Areas/Vault/Views/_ViewStart.cshtml
  16. 36
      Teknik/Areas/Vault/Views/web.config
  17. 10
      Teknik/Controllers/DefaultController.cs
  18. 13
      Teknik/Teknik.csproj

1
Teknik/App_Start/BundleConfig.cs

@ -8,6 +8,7 @@ namespace Teknik @@ -8,6 +8,7 @@ namespace Teknik
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
BundleTable.EnableOptimizations = false;
#if !DEBUG
BundleTable.EnableOptimizations = true;
#endif

9
Teknik/App_Start/RouteConfig.cs

@ -1,12 +1,5 @@ @@ -1,12 +1,5 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc;
using System.Web.Routing;
using Teknik.Areas.Error.Controllers;
namespace Teknik
{

4
Teknik/Areas/Error/Views/Error/Exception.cshtml

@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
@model Teknik.Areas.Error.ViewModels.ErrorViewModel
@using Teknik.Helpers
<div class="container">
<div class="row">
<div class="col-md-12">
@ -13,7 +15,7 @@ @@ -13,7 +15,7 @@
{
<div class="text-left">
<p>
<b>Exception:</b> @Model.Exception.Message
<b>Exception:</b> @Model.Exception.GetFullMessage(true)
<br />
<b>Source:</b> @Model.Exception.Source
</p>

9
Teknik/Areas/Paste/PasteAreaRegistration.cs

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
using System.Web.Mvc;
using System.Web.Optimization;
using Teknik.Configuration;
using Teknik.Controllers;
namespace Teknik.Areas.Paste
{
@ -26,6 +27,14 @@ namespace Teknik.Areas.Paste @@ -26,6 +27,14 @@ namespace Teknik.Areas.Paste
new { controller = "Paste", action = "Index" }, // Parameter defaults
new[] { typeof(Controllers.PasteController).Namespace }
);
context.MapSubdomainRoute(
"Paste.Favicon",
new List<string>() { "paste", "p" }, // Subdomains
new List<string>() { config.Host }, // domains
"favicon.ico",
new { controller = "Default", action = "Favicon" },
new[] { typeof(DefaultController).Namespace }
);
context.MapSubdomainRoute(
"Paste.Simple", // Route name
new List<string>() { "paste", "p" },

4
Teknik/Areas/Upload/Controllers/UploadController.cs

@ -3,6 +3,8 @@ using Piwik.Tracker; @@ -3,6 +3,8 @@ using Piwik.Tracker;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Web;
@ -134,7 +136,7 @@ namespace Teknik.Areas.Upload.Controllers @@ -134,7 +136,7 @@ namespace Teknik.Areas.Upload.Controllers
}
catch (Exception ex)
{
return Json(new { error = new { message = "Exception while uploading file: " + ex.Message } });
return Json(new { error = new { message = "Exception while uploading file: " + ex.GetFullMessage(true) } });
}
}

9
Teknik/Areas/Upload/UploadAreaRegistration.cs

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
using System.Web.Mvc;
using System.Web.Optimization;
using Teknik.Configuration;
using Teknik.Controllers;
namespace Teknik.Areas.Upload
{
@ -26,6 +27,14 @@ namespace Teknik.Areas.Upload @@ -26,6 +27,14 @@ namespace Teknik.Areas.Upload
new { controller = "Upload", action = "Index" },
new[] { typeof(Controllers.UploadController).Namespace }
);
context.MapSubdomainRoute(
"Upload.Favicon",
new List<string>() { "upload", "u" }, // Subdomains
new List<string>() { config.Host }, // domains
"favicon.ico",
new { controller = "Default", action = "Favicon" },
new[] { typeof(DefaultController).Namespace }
);
context.MapSubdomainRoute(
"Upload.Download",
new List<string>() { "upload", "u" }, // Subdomains

24
Teknik/Areas/Vault/Controllers/VaultController.cs

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Teknik.Controllers;
namespace Teknik.Areas.Vault.Controllers
{
public class VaultController : DefaultController
{
[AllowAnonymous]
public ActionResult Index()
{
return View();
}
[AllowAnonymous]
public ActionResult ViewVault(string id)
{
return View();
}
}
}

13
Teknik/Areas/Vault/Models/PasteItem.cs

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Teknik.Areas.Vault.Models
{
public class PasteItem : VaultItem
{
public int PasteId { get; set; }
public Paste.Models.Paste Paste { get; set; }
}
}

13
Teknik/Areas/Vault/Models/UploadItem.cs

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Teknik.Areas.Vault.Models
{
public class UploadItem : VaultItem
{
public int UploadId { get; set; }
public Upload.Models.Upload Upload { get; set; }
}
}

28
Teknik/Areas/Vault/Models/Vault.cs

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Teknik.Areas.Vault.Models
{
public class Vault
{
public int VaultId { get; set; }
public int? UserId { get; set; }
public Users.Models.User User { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public DateTime DateCreated { get; set; }
public DateTime DateEdited { get; set; }
public List<VaultItem> Items { get; set; }
public Vault()
{
Title = string.Empty;
Description = string.Empty;
DateCreated = DateTime.Now;
DateEdited = DateTime.Now;
Items = new List<VaultItem>();
}
}
}

15
Teknik/Areas/Vault/Models/VaultItem.cs

@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Teknik.Areas.Vault.Models
{
public class VaultItem
{
public int VaultItemId { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public DateTime DateAdded { get; set; }
}
}

35
Teknik/Areas/Vault/VaultAreaRegistration.cs

@ -0,0 +1,35 @@ @@ -0,0 +1,35 @@
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Optimization;
using Teknik.Configuration;
namespace Teknik.Areas.Vault
{
public class VaultAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Vault";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
Config config = Config.Load();
context.MapSubdomainRoute(
"Vault.Index",
new List<string>() { "vault", "v" }, // Subdomains
new List<string>() { config.Host }, // domains
"",
new { controller = "Vault", action = "Index" },
new[] { typeof(Controllers.VaultController).Namespace }
);
// Register Script Bundle
BundleTable.Bundles.Add(new ScriptBundle("~/bundles/vault").Include(
"~/Areas/Vault/Scripts/Vault.js"));
}
}
}

22
Teknik/Areas/Vault/ViewModels/VaultViewModel.cs

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Teknik.Areas.Vault.Models;
using Teknik.ViewModels;
namespace Teknik.Areas.Vault.ViewModels
{
public class VaultViewModel : ViewModelBase
{
public int VaultId { get; set; }
public int? UserId { get; set; }
public Users.Models.User User { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public DateTime DateCreated { get; set; }
public DateTime DateEdited { get; set; }
public List<UploadItem> Uploads { get; set; }
public List<PasteItem> Pastes { get; set; }
}
}

7
Teknik/Areas/Vault/Views/Vault/ViewVault.cshtml

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
@model Teknik.Areas.Vault.ViewModels.VaultViewModel
@using Teknik.Helpers
<div class="container">
<p>Coming Soon!</p>
</div>

0
Teknik/Areas/Transparency/Views/_ViewStart.cshtml → Teknik/Areas/Vault/Views/_ViewStart.cshtml

36
Teknik/Areas/Vault/Views/web.config

@ -0,0 +1,36 @@ @@ -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="System.Web.Mvc.WebViewPage">
<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>

10
Teknik/Controllers/DefaultController.cs

@ -44,6 +44,16 @@ namespace Teknik.Controllers @@ -44,6 +44,16 @@ namespace Teknik.Controllers
Response.SuppressFormsAuthenticationRedirect = true;
}
}
// Get the Favicon
[HttpGet]
[AllowAnonymous]
public ActionResult Favicon()
{
// Get favicon
string imageFile = Server.MapPath("~/Images/favicon.ico");
return File(imageFile, "image/x-icon");
}
}
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]

13
Teknik/Teknik.csproj

@ -244,6 +244,13 @@ @@ -244,6 +244,13 @@
<Compile Include="Areas\Upload\ViewModels\DeleteViewModel.cs" />
<Compile Include="Areas\Upload\ViewModels\DownloadViewModel.cs" />
<Compile Include="Areas\Upload\ViewModels\UploadViewModel.cs" />
<Compile Include="Areas\Vault\Controllers\VaultController.cs" />
<Compile Include="Areas\Vault\Models\PasteItem.cs" />
<Compile Include="Areas\Vault\Models\UploadItem.cs" />
<Compile Include="Areas\Vault\Models\Vault.cs" />
<Compile Include="Areas\Vault\Models\VaultItem.cs" />
<Compile Include="Areas\Vault\VaultAreaRegistration.cs" />
<Compile Include="Areas\Vault\ViewModels\VaultViewModel.cs" />
<Compile Include="Configuration\PiwikConfig.cs" />
<Compile Include="Configuration\ShortenerConfig.cs" />
<Compile Include="Configuration\TransparencyConfig.cs" />
@ -511,7 +518,7 @@ @@ -511,7 +518,7 @@
<Content Include="App_Data\Config.json" />
<Content Include="Areas\User\Views\User\Settings.cshtml" />
<Content Include="Areas\Transparency\Views\web.config" />
<Content Include="Areas\Transparency\Views\_ViewStart.cshtml" />
<Content Include="Areas\Vault\Views\_ViewStart.cshtml" />
<Content Include="Areas\Transparency\Views\Transparency\Index.cshtml" />
<Content Include="Areas\Help\Views\Help\RSS.cshtml" />
<Content Include="Areas\Stream\Views\web.config" />
@ -524,6 +531,8 @@ @@ -524,6 +531,8 @@
<Content Include="Areas\TOS\Views\web.config" />
<Content Include="Areas\TOS\Views\_ViewStart.cshtml" />
<Content Include="Areas\TOS\Views\TOS\Index.cshtml" />
<Content Include="Areas\Vault\Views\web.config" />
<Content Include="Areas\Vault\Views\Vault\ViewVault.cshtml" />
<None Include="Properties\PublishProfiles\Teknik Dev.pubxml" />
<None Include="Properties\PublishProfiles\Teknik Production.pubxml" />
<None Include="Scripts\jquery-2.1.4.intellisense.js" />
@ -622,6 +631,8 @@ @@ -622,6 +631,8 @@
<Folder Include="Areas\Upload\Views\Shared\" />
<Folder Include="Areas\User\Repositories\" />
<Folder Include="Areas\User\Views\Shared\" />
<Folder Include="Areas\Vault\Scripts\" />
<Folder Include="Areas\Vault\Views\Shared\" />
</ItemGroup>
<ItemGroup>
<Content Include="packages.config">

Loading…
Cancel
Save