Browse Source

Initial creation of the Vault

tags/2.0.3
Teknikode 3 years ago
parent
commit
1f485c0aee

+ 1
- 0
Teknik/App_Start/BundleConfig.cs View File

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

+ 1
- 8
Teknik/App_Start/RouteConfig.cs View File

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

+ 3
- 1
Teknik/Areas/Error/Views/Error/Exception.cshtml View File

@@ -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 @@
{
<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
- 0
Teknik/Areas/Paste/PasteAreaRegistration.cs View File

@@ -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
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" },

+ 3
- 1
Teknik/Areas/Upload/Controllers/UploadController.cs View File

@@ -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
}
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
- 0
Teknik/Areas/Upload/UploadAreaRegistration.cs View File

@@ -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
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
- 0
Teknik/Areas/Vault/Controllers/VaultController.cs View File

@@ -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
- 0
Teknik/Areas/Vault/Models/PasteItem.cs View File

@@ -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
- 0
Teknik/Areas/Vault/Models/UploadItem.cs View File

@@ -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
- 0
Teknik/Areas/Vault/Models/Vault.cs View File

@@ -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
- 0
Teknik/Areas/Vault/Models/VaultItem.cs View File

@@ -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
- 0
Teknik/Areas/Vault/VaultAreaRegistration.cs View File

@@ -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
- 0
Teknik/Areas/Vault/ViewModels/VaultViewModel.cs View File

@@ -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
- 0
Teknik/Areas/Vault/Views/Vault/ViewVault.cshtml View File

@@ -0,0 +1,7 @@
@model Teknik.Areas.Vault.ViewModels.VaultViewModel

@using Teknik.Helpers

<div class="container">
<p>Coming Soon!</p>
</div>

Teknik/Areas/Transparency/Views/_ViewStart.cshtml → Teknik/Areas/Vault/Views/_ViewStart.cshtml View File


+ 36
- 0
Teknik/Areas/Vault/Views/web.config 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="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
- 0
Teknik/Controllers/DefaultController.cs View File

@@ -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)]

+ 12
- 1
Teknik/Teknik.csproj View File

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