mirror of
https://git.teknik.io/Teknikode/Teknik.git
synced 2023-08-02 14:16:22 +02:00
Initial creation of the Vault
This commit is contained in:
parent
af77b43890
commit
1f485c0aee
@ -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,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
|
||||
{
|
||||
|
@ -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>
|
||||
|
@ -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,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) } });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
Teknik/Areas/Vault/Controllers/VaultController.cs
Normal file
24
Teknik/Areas/Vault/Controllers/VaultController.cs
Normal 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
Teknik/Areas/Vault/Models/PasteItem.cs
Normal file
13
Teknik/Areas/Vault/Models/PasteItem.cs
Normal 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
Teknik/Areas/Vault/Models/UploadItem.cs
Normal file
13
Teknik/Areas/Vault/Models/UploadItem.cs
Normal 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
Teknik/Areas/Vault/Models/Vault.cs
Normal file
28
Teknik/Areas/Vault/Models/Vault.cs
Normal 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
Teknik/Areas/Vault/Models/VaultItem.cs
Normal file
15
Teknik/Areas/Vault/Models/VaultItem.cs
Normal 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
Teknik/Areas/Vault/VaultAreaRegistration.cs
Normal file
35
Teknik/Areas/Vault/VaultAreaRegistration.cs
Normal 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
Teknik/Areas/Vault/ViewModels/VaultViewModel.cs
Normal file
22
Teknik/Areas/Vault/ViewModels/VaultViewModel.cs
Normal 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
Teknik/Areas/Vault/Views/Vault/ViewVault.cshtml
Normal file
7
Teknik/Areas/Vault/Views/Vault/ViewVault.cshtml
Normal file
@ -0,0 +1,7 @@
|
||||
@model Teknik.Areas.Vault.ViewModels.VaultViewModel
|
||||
|
||||
@using Teknik.Helpers
|
||||
|
||||
<div class="container">
|
||||
<p>Coming Soon!</p>
|
||||
</div>
|
36
Teknik/Areas/Vault/Views/web.config
Normal file
36
Teknik/Areas/Vault/Views/web.config
Normal 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>
|
@ -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)]
|
||||
|
@ -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…
Reference in New Issue
Block a user