mirror of
https://git.teknik.io/Teknikode/Teknik.git
synced 2023-08-02 14:16:22 +02:00
Initial conversion to use routing by domain as well.
This commit is contained in:
parent
37ab1e2eb3
commit
952beef0a2
@ -11,27 +11,33 @@ namespace Teknik
|
||||
{
|
||||
public List<string> Subdomains { get; set; }
|
||||
|
||||
public SubdomainRoute(List<string> subdomains, string url, IRouteHandler handler)
|
||||
public List<string> Domains { get; set; }
|
||||
|
||||
public SubdomainRoute(List<string> subdomains, List<string> domains, string url, IRouteHandler handler)
|
||||
: base(url, handler)
|
||||
{
|
||||
this.Subdomains = subdomains;
|
||||
this.Domains = domains;
|
||||
}
|
||||
public SubdomainRoute(List<string> subdomains, string url, RouteValueDictionary defaults, IRouteHandler handler)
|
||||
public SubdomainRoute(List<string> subdomains, List<string> domains, string url, RouteValueDictionary defaults, IRouteHandler handler)
|
||||
: base(url, defaults, handler)
|
||||
{
|
||||
this.Subdomains = subdomains;
|
||||
this.Domains = domains;
|
||||
}
|
||||
|
||||
public SubdomainRoute(List<string> subdomains, string url, RouteValueDictionary defaults, RouteValueDictionary constraints, IRouteHandler handler)
|
||||
public SubdomainRoute(List<string> subdomains, List<string> domains, string url, RouteValueDictionary defaults, RouteValueDictionary constraints, IRouteHandler handler)
|
||||
: base(url, defaults, constraints, handler)
|
||||
{
|
||||
this.Subdomains = subdomains;
|
||||
this.Domains = domains;
|
||||
}
|
||||
|
||||
public SubdomainRoute(List<string> subdomains, string url, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler handler)
|
||||
public SubdomainRoute(List<string> subdomains, List<string> domains, string url, RouteValueDictionary defaults, RouteValueDictionary constraints, RouteValueDictionary dataTokens, IRouteHandler handler)
|
||||
: base(url, defaults, constraints, dataTokens, handler)
|
||||
{
|
||||
this.Subdomains = subdomains;
|
||||
this.Domains = domains;
|
||||
}
|
||||
|
||||
public override RouteData GetRouteData(HttpContextBase httpContext)
|
||||
@ -41,6 +47,7 @@ namespace Teknik
|
||||
string subdomain = httpContext.Request.QueryString["sub"]; // A subdomain specified as a query parameter takes precedence over the hostname.
|
||||
string host = httpContext.Request.Headers["Host"];
|
||||
string curSub = host.GetSubdomain();
|
||||
string domain = host.GetDomain();
|
||||
|
||||
// special consideration for 'dev' subdomain
|
||||
if (subdomain == null || subdomain == "dev")
|
||||
@ -68,11 +75,15 @@ namespace Teknik
|
||||
}
|
||||
}
|
||||
|
||||
//routeData.Values["sub"] = subdomain;
|
||||
// Check if this route is valid for the current domain
|
||||
if (httpContext.Request.IsLocal || Domains.Contains(domain))
|
||||
{
|
||||
// Check if this route is valid for the current subdomain ('*' means any subdomain is valid)
|
||||
if (Subdomains.Contains("*") || Subdomains.Contains(subdomain))
|
||||
{
|
||||
return routeData;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,11 @@ namespace Teknik
|
||||
{
|
||||
public static class SubdomainRouteExtension
|
||||
{
|
||||
public static SubdomainRoute MapSubdomainRoute(this RouteCollection routes, string name, List<string> subDomains, string url, object defaults)
|
||||
public static SubdomainRoute MapSubdomainRoute(this RouteCollection routes, string name, List<string> subDomains, List<string> domains, string url, object defaults)
|
||||
{
|
||||
SubdomainRoute route = new SubdomainRoute(
|
||||
subDomains,
|
||||
domains,
|
||||
url,
|
||||
new RouteValueDictionary(defaults),
|
||||
new MvcRouteHandler());
|
||||
@ -18,10 +19,11 @@ namespace Teknik
|
||||
return route;
|
||||
}
|
||||
|
||||
public static SubdomainRoute MapSubdomainRoute(this RouteCollection routes, string name, List<string> subDomains, string url, object defaults, object constraints)
|
||||
public static SubdomainRoute MapSubdomainRoute(this RouteCollection routes, string name, List<string> subDomains, List<string> domains, string url, object defaults, object constraints)
|
||||
{
|
||||
SubdomainRoute route = new SubdomainRoute(
|
||||
subDomains,
|
||||
domains,
|
||||
url,
|
||||
new RouteValueDictionary(defaults),
|
||||
new RouteValueDictionary(constraints),
|
||||
@ -30,10 +32,11 @@ namespace Teknik
|
||||
return route;
|
||||
}
|
||||
|
||||
public static SubdomainRoute MapSubdomainRoute(this RouteCollection routes, string name, List<string> subDomains, string area, string url, object defaults, string[] namespaces)
|
||||
public static SubdomainRoute MapSubdomainRoute(this RouteCollection routes, string name, List<string> subDomains, List<string> domains, string area, string url, object defaults, string[] namespaces)
|
||||
{
|
||||
SubdomainRoute route = new SubdomainRoute(
|
||||
subDomains,
|
||||
domains,
|
||||
url,
|
||||
new RouteValueDictionary(defaults),
|
||||
new RouteValueDictionary(new { }),
|
||||
@ -43,10 +46,11 @@ namespace Teknik
|
||||
return route;
|
||||
}
|
||||
|
||||
public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, string url, object defaults)
|
||||
public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, List<string> domains, string url, object defaults)
|
||||
{
|
||||
SubdomainRoute route = new SubdomainRoute(
|
||||
subDomains,
|
||||
domains,
|
||||
url,
|
||||
new RouteValueDictionary(defaults),
|
||||
new RouteValueDictionary(new {}),
|
||||
@ -57,10 +61,11 @@ namespace Teknik
|
||||
return route;
|
||||
}
|
||||
|
||||
public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, string url, object defaults, object constraints)
|
||||
public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, List<string> domains, string url, object defaults, object constraints)
|
||||
{
|
||||
SubdomainRoute route = new SubdomainRoute(
|
||||
subDomains,
|
||||
domains,
|
||||
url,
|
||||
new RouteValueDictionary(defaults),
|
||||
new RouteValueDictionary(constraints),
|
||||
@ -71,10 +76,11 @@ namespace Teknik
|
||||
return route;
|
||||
}
|
||||
|
||||
public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, string url, object defaults, string[] namespaces)
|
||||
public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, List<string> domains, string url, object defaults, string[] namespaces)
|
||||
{
|
||||
SubdomainRoute route = new SubdomainRoute(
|
||||
subDomains,
|
||||
domains,
|
||||
url,
|
||||
new RouteValueDictionary(defaults),
|
||||
new RouteValueDictionary(new {}),
|
||||
@ -85,10 +91,11 @@ namespace Teknik
|
||||
return route;
|
||||
}
|
||||
|
||||
public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, string url, string area, object defaults)
|
||||
public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, List<string> domains, string url, string area, object defaults)
|
||||
{
|
||||
SubdomainRoute route = new SubdomainRoute(
|
||||
subDomains,
|
||||
domains,
|
||||
url,
|
||||
new RouteValueDictionary(defaults),
|
||||
new RouteValueDictionary(new { }),
|
||||
@ -99,10 +106,11 @@ namespace Teknik
|
||||
return route;
|
||||
}
|
||||
|
||||
public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, string url, string area, object defaults, object constraints)
|
||||
public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, List<string> domains, string url, string area, object defaults, object constraints)
|
||||
{
|
||||
SubdomainRoute route = new SubdomainRoute(
|
||||
subDomains,
|
||||
domains,
|
||||
url,
|
||||
new RouteValueDictionary(defaults),
|
||||
new RouteValueDictionary(constraints),
|
||||
@ -113,10 +121,11 @@ namespace Teknik
|
||||
return route;
|
||||
}
|
||||
|
||||
public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, string url, string area, object defaults, string[] namespaces)
|
||||
public static SubdomainRoute MapSubdomainRoute(this AreaRegistrationContext context, string name, List<string> subDomains, List<string> domains, string url, string area, object defaults, string[] namespaces)
|
||||
{
|
||||
SubdomainRoute route = new SubdomainRoute(
|
||||
subDomains,
|
||||
domains,
|
||||
url,
|
||||
new RouteValueDictionary(defaults),
|
||||
new RouteValueDictionary(new { }),
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.API
|
||||
{
|
||||
@ -15,11 +16,13 @@ namespace Teknik.Areas.API
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
#region API v1
|
||||
// Base Routing
|
||||
context.MapSubdomainRoute(
|
||||
"API.v1.Index", // Route name
|
||||
new List<string>() { "dev", "api" },
|
||||
new List<string>() { config.Host },
|
||||
"v1", // URL with parameters
|
||||
new { controller = "APIv1", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.APIv1Controller).Namespace }
|
||||
@ -28,6 +31,7 @@ namespace Teknik.Areas.API
|
||||
context.MapSubdomainRoute(
|
||||
"API.v1.Upload", // Route name
|
||||
new List<string>() { "dev", "api" },
|
||||
new List<string>() { config.Host },
|
||||
"v1/Upload", // URL with parameters
|
||||
new { controller = "APIv1", action = "Upload" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.APIv1Controller).Namespace }
|
||||
@ -35,6 +39,7 @@ namespace Teknik.Areas.API
|
||||
context.MapSubdomainRoute(
|
||||
"API.v1.Paste", // Route name
|
||||
new List<string>() { "dev", "api" },
|
||||
new List<string>() { config.Host },
|
||||
"v1/Paste", // URL with parameters
|
||||
new { controller = "APIv1", action = "Paste" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.APIv1Controller).Namespace }
|
||||
@ -45,6 +50,7 @@ namespace Teknik.Areas.API
|
||||
context.MapSubdomainRoute(
|
||||
"API.Index", // Route name
|
||||
new List<string>() { "dev", "" },
|
||||
new List<string>() { config.Host },
|
||||
"", // URL with parameters
|
||||
new { controller = "API", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.APIController).Namespace }
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.About
|
||||
{
|
||||
@ -15,9 +16,11 @@ namespace Teknik.Areas.About
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
context.MapSubdomainRoute(
|
||||
"About.Index", // Route name
|
||||
new List<string>() { "dev", "about" },
|
||||
new List<string>() { config.Host },
|
||||
"", // URL with parameters
|
||||
new { controller = "About", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.AboutController).Namespace }
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Optimization;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.Blog
|
||||
{
|
||||
@ -16,9 +17,11 @@ namespace Teknik.Areas.Blog
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
context.MapSubdomainRoute(
|
||||
"Blog.Blog", // Route name
|
||||
new List<string>() { "dev", "blog" }, // Subdomains
|
||||
new List<string>() { config.Host },
|
||||
"{username}", // URL with parameters
|
||||
new { controller = "Blog", action = "Blog", username = string.Empty }, // Parameter defaults
|
||||
new[] { typeof(Controllers.BlogController).Namespace }
|
||||
@ -26,6 +29,7 @@ namespace Teknik.Areas.Blog
|
||||
context.MapSubdomainRoute(
|
||||
"Blog.Post", // Route name
|
||||
new List<string>() { "dev", "blog" }, // Subdomains
|
||||
new List<string>() { config.Host },
|
||||
"{username}/{id}", // URL with parameters
|
||||
new { controller = "Blog", action = "Post", username = "", id = 0 }, // Parameter defaults
|
||||
new[] { typeof(Controllers.BlogController).Namespace }
|
||||
@ -33,6 +37,7 @@ namespace Teknik.Areas.Blog
|
||||
context.MapSubdomainRoute(
|
||||
"Blog.Action", // Route name
|
||||
new List<string>() { "dev", "blog" }, // Subdomains
|
||||
new List<string>() { config.Host },
|
||||
"Action/{controller}/{action}", // URL with parameters
|
||||
new { controller = "Blog", action = "Blog" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.BlogController).Namespace }
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Optimization;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.Contact
|
||||
{
|
||||
@ -16,9 +17,11 @@ namespace Teknik.Areas.Contact
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
context.MapSubdomainRoute(
|
||||
"Contact.Index", // Route name
|
||||
new List<string>() { "dev", "contact" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"", // URL with parameters
|
||||
new { controller = "Contact", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.ContactController).Namespace }
|
||||
@ -26,6 +29,7 @@ namespace Teknik.Areas.Contact
|
||||
context.MapSubdomainRoute(
|
||||
"Contact.Action", // Route name
|
||||
new List<string>() { "dev", "contact" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"{action}", // URL with parameters
|
||||
new { controller = "Contact", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.ContactController).Namespace }
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using Teknik.Areas.Home.Controllers;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.Dev
|
||||
{
|
||||
@ -16,9 +17,11 @@ namespace Teknik.Areas.Dev
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
context.MapSubdomainRoute(
|
||||
"Dev.Index", // Route name
|
||||
new List<string>() { "dev" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"", // URL with parameters
|
||||
new { controller = "Dev", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.DevController).Namespace }
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.Error
|
||||
{
|
||||
@ -15,9 +16,11 @@ namespace Teknik.Areas.Error
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
context.MapSubdomainRoute(
|
||||
"Error.Http404", // Route name
|
||||
new List<string>() { "*", "error" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"404", // URL with parameters
|
||||
new { controller = "Error", action = "Http404" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.ErrorController).Namespace }
|
||||
@ -25,6 +28,7 @@ namespace Teknik.Areas.Error
|
||||
context.MapSubdomainRoute(
|
||||
"Error.Http403", // Route name
|
||||
new List<string>() { "*", "error" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"403", // URL with parameters
|
||||
new { controller = "Error", action = "Http403" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.ErrorController).Namespace }
|
||||
@ -32,6 +36,7 @@ namespace Teknik.Areas.Error
|
||||
context.MapSubdomainRoute(
|
||||
"Error.Http500", // Route name
|
||||
new List<string>() { "*", "error" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"500", // URL with parameters
|
||||
new { controller = "Error", action = "Http500" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.ErrorController).Namespace }
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Optimization;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.Help
|
||||
{
|
||||
@ -16,9 +17,11 @@ namespace Teknik.Areas.Help
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
context.MapSubdomainRoute(
|
||||
"Help.Index", // Route name
|
||||
new List<string>() { "dev", "help" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"", // URL with parameters
|
||||
new { controller = "Help", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.HelpController).Namespace }
|
||||
@ -26,6 +29,7 @@ namespace Teknik.Areas.Help
|
||||
context.MapSubdomainRoute(
|
||||
"Help.API", // Route name
|
||||
new List<string>() { "dev", "help" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"API/{version}/{service}", // URL with parameters
|
||||
new { controller = "Help", action = "API", version = UrlParameter.Optional, service = UrlParameter.Optional }, // Parameter defaults
|
||||
new[] { typeof(Controllers.HelpController).Namespace }
|
||||
@ -33,6 +37,7 @@ namespace Teknik.Areas.Help
|
||||
context.MapSubdomainRoute(
|
||||
"Help.Blog", // Route name
|
||||
new List<string>() { "dev", "help" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Blog", // URL with parameters
|
||||
new { controller = "Help", action = "Blog" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.HelpController).Namespace }
|
||||
@ -40,6 +45,7 @@ namespace Teknik.Areas.Help
|
||||
context.MapSubdomainRoute(
|
||||
"Help.Git", // Route name
|
||||
new List<string>() { "dev", "help" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Git", // URL with parameters
|
||||
new { controller = "Help", action = "Git" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.HelpController).Namespace }
|
||||
@ -47,6 +53,7 @@ namespace Teknik.Areas.Help
|
||||
context.MapSubdomainRoute(
|
||||
"Help.IRC", // Route name
|
||||
new List<string>() { "dev", "help" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"IRC", // URL with parameters
|
||||
new { controller = "Help", action = "IRC" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.HelpController).Namespace }
|
||||
@ -54,6 +61,7 @@ namespace Teknik.Areas.Help
|
||||
context.MapSubdomainRoute(
|
||||
"Help.Mail", // Route name
|
||||
new List<string>() { "dev", "help" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Mail", // URL with parameters
|
||||
new { controller = "Help", action = "Mail" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.HelpController).Namespace }
|
||||
@ -61,6 +69,7 @@ namespace Teknik.Areas.Help
|
||||
context.MapSubdomainRoute(
|
||||
"Help.Mumble", // Route name
|
||||
new List<string>() { "dev", "help" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Mumble", // URL with parameters
|
||||
new { controller = "Help", action = "Mumble" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.HelpController).Namespace }
|
||||
@ -68,6 +77,7 @@ namespace Teknik.Areas.Help
|
||||
context.MapSubdomainRoute(
|
||||
"Help.RSS", // Route name
|
||||
new List<string>() { "dev", "help" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"RSS", // URL with parameters
|
||||
new { controller = "Help", action = "RSS" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.HelpController).Namespace }
|
||||
@ -75,6 +85,7 @@ namespace Teknik.Areas.Help
|
||||
context.MapSubdomainRoute(
|
||||
"Help.Upload", // Route name
|
||||
new List<string>() { "dev", "help" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Upload", // URL with parameters
|
||||
new { controller = "Help", action = "Upload" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.HelpController).Namespace }
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Optimization;
|
||||
using Teknik;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.Home
|
||||
{
|
||||
@ -17,9 +18,11 @@ namespace Teknik.Areas.Home
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
context.MapSubdomainRoute(
|
||||
"Home.Index", // Route name
|
||||
new List<string>() { "dev", "www", string.Empty }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"", // URL with parameters
|
||||
new { controller = "Home", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.HomeController).Namespace }
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Optimization;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.Paste
|
||||
{
|
||||
@ -16,9 +17,11 @@ namespace Teknik.Areas.Paste
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
context.MapSubdomainRoute(
|
||||
"Paste.Index", // Route name
|
||||
new List<string>() { "dev", "paste", "p" },
|
||||
new List<string>() { config.Host }, // domains
|
||||
"", // URL with parameters
|
||||
new { controller = "Paste", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.PasteController).Namespace }
|
||||
@ -26,6 +29,7 @@ namespace Teknik.Areas.Paste
|
||||
context.MapSubdomainRoute(
|
||||
"Paste.Simple", // Route name
|
||||
new List<string>() { "dev", "paste", "p" },
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Simple/{url}/{password}", // URL with parameters
|
||||
new { controller = "Paste", action = "ViewPaste", type = "Simple", password = UrlParameter.Optional }, // Parameter defaults
|
||||
new[] { typeof(Controllers.PasteController).Namespace }
|
||||
@ -33,6 +37,7 @@ namespace Teknik.Areas.Paste
|
||||
context.MapSubdomainRoute(
|
||||
"Paste.Raw", // Route name
|
||||
new List<string>() { "dev", "paste", "p" },
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Raw/{url}/{password}", // URL with parameters
|
||||
new { controller = "Paste", action = "ViewPaste", type = "Raw", password = UrlParameter.Optional }, // Parameter defaults
|
||||
new[] { typeof(Controllers.PasteController).Namespace }
|
||||
@ -40,6 +45,7 @@ namespace Teknik.Areas.Paste
|
||||
context.MapSubdomainRoute(
|
||||
"Paste.Download", // Route name
|
||||
new List<string>() { "dev", "paste", "p" },
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Download/{url}/{password}", // URL with parameters
|
||||
new { controller = "Paste", action = "ViewPaste", type = "Download", password = UrlParameter.Optional }, // Parameter defaults
|
||||
new[] { typeof(Controllers.PasteController).Namespace }
|
||||
@ -47,6 +53,7 @@ namespace Teknik.Areas.Paste
|
||||
context.MapSubdomainRoute(
|
||||
"Paste.Action", // Route name
|
||||
new List<string>() { "dev", "paste", "p" },
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Action/{action}", // URL with parameters
|
||||
new { controller = "Paste", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.PasteController).Namespace }
|
||||
@ -54,6 +61,7 @@ namespace Teknik.Areas.Paste
|
||||
context.MapSubdomainRoute(
|
||||
"Paste.View", // Route name
|
||||
new List<string>() { "dev", "paste", "p" },
|
||||
new List<string>() { config.Host }, // domains
|
||||
"{url}/{password}", // URL with parameters
|
||||
new { controller = "Paste", action = "ViewPaste", type = "Full", password = UrlParameter.Optional }, // Parameter defaults
|
||||
new[] { typeof(Controllers.PasteController).Namespace }
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Optimization;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.Podcast
|
||||
{
|
||||
@ -16,9 +17,11 @@ namespace Teknik.Areas.Podcast
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
context.MapSubdomainRoute(
|
||||
"Podcast.Index", // Route name
|
||||
new List<string>() { "dev", "podcast" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"", // URL with parameters
|
||||
new { controller = "Podcast", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.PodcastController).Namespace }
|
||||
@ -26,6 +29,7 @@ namespace Teknik.Areas.Podcast
|
||||
context.MapSubdomainRoute(
|
||||
"Podcast.View", // Route name
|
||||
new List<string>() { "dev", "podcast" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"{episode}", // URL with parameters
|
||||
new { controller = "Podcast", action = "View" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.PodcastController).Namespace }
|
||||
@ -33,6 +37,7 @@ namespace Teknik.Areas.Podcast
|
||||
context.MapSubdomainRoute(
|
||||
"Podcast.Download", // Route name
|
||||
new List<string>() { "dev", "podcast" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"File/{episode}/{fileName}", // URL with parameters
|
||||
new { controller = "Podcast", action = "Download" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.PodcastController).Namespace }
|
||||
@ -40,6 +45,7 @@ namespace Teknik.Areas.Podcast
|
||||
context.MapSubdomainRoute(
|
||||
"Podcast.Action", // Route name
|
||||
new List<string>() { "dev", "podcast" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Action/{controller}/{action}", // URL with parameters
|
||||
new { controller = "Podcast", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.PodcastController).Namespace }
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.Privacy
|
||||
{
|
||||
@ -15,9 +16,11 @@ namespace Teknik.Areas.Privacy
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
context.MapSubdomainRoute(
|
||||
"Privacy.Index", // Route name
|
||||
new List<string>() { "dev", "privacy" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"", // URL with parameters
|
||||
new { controller = "Privacy", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.PrivacyController).Namespace }
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Optimization;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.Profile
|
||||
{
|
||||
@ -16,9 +17,11 @@ namespace Teknik.Areas.Profile
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
context.MapSubdomainRoute(
|
||||
"Profile.Login", // Route name
|
||||
new List<string>() { "dev", "profile", "www", string.Empty }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Login", // URL with parameters
|
||||
new { controller = "Profile", action = "Login" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.ProfileController).Namespace }
|
||||
@ -26,6 +29,7 @@ namespace Teknik.Areas.Profile
|
||||
context.MapSubdomainRoute(
|
||||
"Profile.Logout", // Route name
|
||||
new List<string>() { "dev", "profile", "www", string.Empty }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Logout", // URL with parameters
|
||||
new { controller = "Profile", action = "Logout" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.ProfileController).Namespace }
|
||||
@ -33,6 +37,7 @@ namespace Teknik.Areas.Profile
|
||||
context.MapSubdomainRoute(
|
||||
"Profile.Register", // Route name
|
||||
new List<string>() { "dev", "profile", "www", string.Empty }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Register", // URL with parameters
|
||||
new { controller = "Profile", action = "Register" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.ProfileController).Namespace }
|
||||
@ -40,6 +45,7 @@ namespace Teknik.Areas.Profile
|
||||
context.MapSubdomainRoute(
|
||||
"Profile.Settings", // Route name
|
||||
new List<string>() { "dev", "profile" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Settings", // URL with parameters
|
||||
new { controller = "Profile", action = "Settings" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.ProfileController).Namespace }
|
||||
@ -47,6 +53,7 @@ namespace Teknik.Areas.Profile
|
||||
context.MapSubdomainRoute(
|
||||
"Profile.Index", // Route name
|
||||
new List<string>() { "dev", "profile" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"{username}", // URL with parameters
|
||||
new { controller = "Profile", action = "Index", username = UrlParameter.Optional }, // Parameter defaults
|
||||
new[] { typeof(Controllers.ProfileController).Namespace }
|
||||
@ -54,6 +61,7 @@ namespace Teknik.Areas.Profile
|
||||
context.MapSubdomainRoute(
|
||||
"Profile.Action", // Route name
|
||||
new List<string>() { "dev", "profile" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Action/{action}", // URL with parameters
|
||||
new { controller = "Profile", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.ProfileController).Namespace }
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.RSS
|
||||
{
|
||||
@ -15,9 +16,11 @@ namespace Teknik.Areas.RSS
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
context.MapSubdomainRoute(
|
||||
"RSS.Index", // Route name
|
||||
new List<string>() { "dev", "rss" },
|
||||
new List<string>() { config.Host }, // domains
|
||||
"", // URL with parameters
|
||||
new { controller = "RSS", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.RSSController).Namespace }
|
||||
@ -25,6 +28,7 @@ namespace Teknik.Areas.RSS
|
||||
context.MapSubdomainRoute(
|
||||
"RSS.Blog", // Route name
|
||||
new List<string>() { "dev", "rss" },
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Blog/{username}", // URL with parameters
|
||||
new { controller = "RSS", action = "Blog", username = UrlParameter.Optional }, // Parameter defaults
|
||||
new[] { typeof(Controllers.RSSController).Namespace }
|
||||
@ -32,6 +36,7 @@ namespace Teknik.Areas.RSS
|
||||
context.MapSubdomainRoute(
|
||||
"RSS.Podcast", // Route name
|
||||
new List<string>() { "dev", "rss" },
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Podcast", // URL with parameters
|
||||
new { controller = "RSS", action = "Podcast" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.RSSController).Namespace }
|
||||
|
18
Teknik/Areas/Shortener/Controllers/ShortenerController.cs
Normal file
18
Teknik/Areas/Shortener/Controllers/ShortenerController.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Teknik.Controllers;
|
||||
|
||||
namespace Teknik.Areas.Shortener.Controllers
|
||||
{
|
||||
public class ShortenerController : DefaultController
|
||||
{
|
||||
// GET: Shortener/Shortener
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
30
Teknik/Areas/Shortener/ShortenerAreaRegistration.cs
Normal file
30
Teknik/Areas/Shortener/ShortenerAreaRegistration.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.Shortener
|
||||
{
|
||||
public class ShortenerAreaRegistration : AreaRegistration
|
||||
{
|
||||
public override string AreaName
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Shortener";
|
||||
}
|
||||
}
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
context.MapSubdomainRoute(
|
||||
"Stream.Index", // Route name
|
||||
new List<string>() { "dev", "shorten", "s" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"", // URL with parameters
|
||||
new { controller = "Shortener", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.ShortenerController).Namespace }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
36
Teknik/Areas/Shortener/Views/web.config
Normal file
36
Teknik/Areas/Shortener/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>
|
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.Stream
|
||||
{
|
||||
@ -15,9 +16,11 @@ namespace Teknik.Areas.Stream
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
context.MapSubdomainRoute(
|
||||
"Stream.Index", // Route name
|
||||
new List<string>() { "dev", "stream" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"", // URL with parameters
|
||||
new { controller = "Stream", action = "Index" }, // Parameter defaults
|
||||
new[] { typeof(Controllers.StreamController).Namespace }
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.Transparency
|
||||
{
|
||||
@ -15,9 +16,11 @@ namespace Teknik.Areas.Transparency
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
context.MapSubdomainRoute(
|
||||
"Transparency.Index",
|
||||
new List<string>() { "dev", "transparency" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"",
|
||||
new { controller = "Transparency", action = "Index" },
|
||||
new[] { typeof(Controllers.TransparencyController).Namespace }
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Optimization;
|
||||
using Teknik.Configuration;
|
||||
|
||||
namespace Teknik.Areas.Upload
|
||||
{
|
||||
@ -16,9 +17,11 @@ namespace Teknik.Areas.Upload
|
||||
|
||||
public override void RegisterArea(AreaRegistrationContext context)
|
||||
{
|
||||
Config config = Config.Load();
|
||||
context.MapSubdomainRoute(
|
||||
"Upload.Index",
|
||||
new List<string>() { "dev", "upload", "u" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"",
|
||||
new { controller = "Upload", action = "Index" },
|
||||
new[] { typeof(Controllers.UploadController).Namespace }
|
||||
@ -26,6 +29,7 @@ namespace Teknik.Areas.Upload
|
||||
context.MapSubdomainRoute(
|
||||
"Upload.Download",
|
||||
new List<string>() { "dev", "upload", "u" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"{file}",
|
||||
new { controller = "Upload", action = "Download", file = string.Empty },
|
||||
new[] { typeof(Controllers.UploadController).Namespace }
|
||||
@ -33,6 +37,7 @@ namespace Teknik.Areas.Upload
|
||||
context.MapSubdomainRoute(
|
||||
"Upload.Delete",
|
||||
new List<string>() { "dev", "upload", "u" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"{file}/{key}",
|
||||
new { controller = "Upload", action = "Delete", file = string.Empty, key = string.Empty },
|
||||
new[] { typeof(Controllers.UploadController).Namespace }
|
||||
@ -40,6 +45,7 @@ namespace Teknik.Areas.Upload
|
||||
context.MapSubdomainRoute(
|
||||
"Upload.Action",
|
||||
new List<string>() { "dev", "upload", "u" }, // Subdomains
|
||||
new List<string>() { config.Host }, // domains
|
||||
"Action/{controller}/{action}",
|
||||
new { controller = "Upload", action = "Index" },
|
||||
new[] { typeof(Controllers.UploadController).Namespace }
|
||||
|
@ -207,6 +207,8 @@
|
||||
<Compile Include="Areas\Profile\ViewModels\SettingsViewModel.cs" />
|
||||
<Compile Include="Areas\RSS\Controllers\RSSController.cs" />
|
||||
<Compile Include="Areas\RSS\RSSAreaRegistration.cs" />
|
||||
<Compile Include="Areas\Shortener\Controllers\ShortenerController.cs" />
|
||||
<Compile Include="Areas\Shortener\ShortenerAreaRegistration.cs" />
|
||||
<Compile Include="Areas\Stream\Controllers\StreamController.cs" />
|
||||
<Compile Include="Areas\Stream\StreamAreaRegistration.cs" />
|
||||
<Compile Include="Areas\Stream\ViewModels\StreamViewModel.cs" />
|
||||
@ -475,6 +477,7 @@
|
||||
<Content Include="Areas\Stream\Views\web.config" />
|
||||
<Content Include="Areas\Stream\Views\_ViewStart.cshtml" />
|
||||
<Content Include="Areas\Stream\Views\Stream\Index.cshtml" />
|
||||
<Content Include="Areas\Shortener\Views\web.config" />
|
||||
<None Include="Properties\PublishProfiles\Teknik Dev.pubxml" />
|
||||
<None Include="Properties\PublishProfiles\Teknik Production.pubxml" />
|
||||
<None Include="Scripts\jquery-2.1.4.intellisense.js" />
|
||||
@ -565,6 +568,9 @@
|
||||
<Folder Include="Areas\Privacy\Models\" />
|
||||
<Folder Include="Areas\Privacy\Views\Shared\" />
|
||||
<Folder Include="Areas\Profile\Views\Shared\" />
|
||||
<Folder Include="Areas\Shortener\Models\" />
|
||||
<Folder Include="Areas\Shortener\Views\Shared\" />
|
||||
<Folder Include="Areas\Shortener\Views\Shortener\" />
|
||||
<Folder Include="Areas\Stream\Views\Shared\" />
|
||||
<Folder Include="Areas\Transparency\Views\Shared\" />
|
||||
<Folder Include="Areas\Upload\Views\Shared\" />
|
||||
|
Loading…
Reference in New Issue
Block a user