mirror of
https://git.teknik.io/Teknikode/Teknik.git
synced 2023-08-02 14:16:22 +02:00
- Removed uneeded 'dev' subdomains from routes.
- Made url shortening require absolute url
This commit is contained in:
parent
8e71dd6e2a
commit
f848ff9f42
@ -21,7 +21,7 @@ namespace Teknik.Areas.API
|
|||||||
// Base Routing
|
// Base Routing
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"API.v1.Index", // Route name
|
"API.v1.Index", // Route name
|
||||||
new List<string>() { "dev", "api" },
|
new List<string>() { "api" },
|
||||||
new List<string>() { config.Host },
|
new List<string>() { config.Host },
|
||||||
"v1", // URL with parameters
|
"v1", // URL with parameters
|
||||||
new { controller = "APIv1", action = "Index" }, // Parameter defaults
|
new { controller = "APIv1", action = "Index" }, // Parameter defaults
|
||||||
@ -30,7 +30,7 @@ namespace Teknik.Areas.API
|
|||||||
// Uploads
|
// Uploads
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"API.v1.Upload", // Route name
|
"API.v1.Upload", // Route name
|
||||||
new List<string>() { "dev", "api" },
|
new List<string>() { "api" },
|
||||||
new List<string>() { config.Host },
|
new List<string>() { config.Host },
|
||||||
"v1/Upload", // URL with parameters
|
"v1/Upload", // URL with parameters
|
||||||
new { controller = "APIv1", action = "Upload" }, // Parameter defaults
|
new { controller = "APIv1", action = "Upload" }, // Parameter defaults
|
||||||
@ -38,7 +38,7 @@ namespace Teknik.Areas.API
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"API.v1.Paste", // Route name
|
"API.v1.Paste", // Route name
|
||||||
new List<string>() { "dev", "api" },
|
new List<string>() { "api" },
|
||||||
new List<string>() { config.Host },
|
new List<string>() { config.Host },
|
||||||
"v1/Paste", // URL with parameters
|
"v1/Paste", // URL with parameters
|
||||||
new { controller = "APIv1", action = "Paste" }, // Parameter defaults
|
new { controller = "APIv1", action = "Paste" }, // Parameter defaults
|
||||||
@ -49,7 +49,7 @@ namespace Teknik.Areas.API
|
|||||||
// Default Routing
|
// Default Routing
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"API.Index", // Route name
|
"API.Index", // Route name
|
||||||
new List<string>() { "dev", "" },
|
new List<string>() { "api" },
|
||||||
new List<string>() { config.Host },
|
new List<string>() { config.Host },
|
||||||
"", // URL with parameters
|
"", // URL with parameters
|
||||||
new { controller = "API", action = "Index" }, // Parameter defaults
|
new { controller = "API", action = "Index" }, // Parameter defaults
|
||||||
|
@ -19,7 +19,7 @@ namespace Teknik.Areas.About
|
|||||||
Config config = Config.Load();
|
Config config = Config.Load();
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"About.Index", // Route name
|
"About.Index", // Route name
|
||||||
new List<string>() { "dev", "about" },
|
new List<string>() { "about" },
|
||||||
new List<string>() { config.Host },
|
new List<string>() { config.Host },
|
||||||
"", // URL with parameters
|
"", // URL with parameters
|
||||||
new { controller = "About", action = "Index" }, // Parameter defaults
|
new { controller = "About", action = "Index" }, // Parameter defaults
|
||||||
|
@ -20,7 +20,7 @@ namespace Teknik.Areas.Blog
|
|||||||
Config config = Config.Load();
|
Config config = Config.Load();
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Blog.Blog", // Route name
|
"Blog.Blog", // Route name
|
||||||
new List<string>() { "dev", "blog" }, // Subdomains
|
new List<string>() { "blog" }, // Subdomains
|
||||||
new List<string>() { config.Host },
|
new List<string>() { config.Host },
|
||||||
"{username}", // URL with parameters
|
"{username}", // URL with parameters
|
||||||
new { controller = "Blog", action = "Blog", username = string.Empty }, // Parameter defaults
|
new { controller = "Blog", action = "Blog", username = string.Empty }, // Parameter defaults
|
||||||
@ -28,7 +28,7 @@ namespace Teknik.Areas.Blog
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Blog.Post", // Route name
|
"Blog.Post", // Route name
|
||||||
new List<string>() { "dev", "blog" }, // Subdomains
|
new List<string>() { "blog" }, // Subdomains
|
||||||
new List<string>() { config.Host },
|
new List<string>() { config.Host },
|
||||||
"{username}/{id}", // URL with parameters
|
"{username}/{id}", // URL with parameters
|
||||||
new { controller = "Blog", action = "Post", username = "", id = 0 }, // Parameter defaults
|
new { controller = "Blog", action = "Post", username = "", id = 0 }, // Parameter defaults
|
||||||
@ -36,7 +36,7 @@ namespace Teknik.Areas.Blog
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Blog.Action", // Route name
|
"Blog.Action", // Route name
|
||||||
new List<string>() { "dev", "blog" }, // Subdomains
|
new List<string>() { "blog" }, // Subdomains
|
||||||
new List<string>() { config.Host },
|
new List<string>() { config.Host },
|
||||||
"Action/{controller}/{action}", // URL with parameters
|
"Action/{controller}/{action}", // URL with parameters
|
||||||
new { controller = "Blog", action = "Blog" }, // Parameter defaults
|
new { controller = "Blog", action = "Blog" }, // Parameter defaults
|
||||||
|
@ -20,7 +20,7 @@ namespace Teknik.Areas.Contact
|
|||||||
Config config = Config.Load();
|
Config config = Config.Load();
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Contact.Index", // Route name
|
"Contact.Index", // Route name
|
||||||
new List<string>() { "dev", "contact" }, // Subdomains
|
new List<string>() { "contact" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"", // URL with parameters
|
"", // URL with parameters
|
||||||
new { controller = "Contact", action = "Index" }, // Parameter defaults
|
new { controller = "Contact", action = "Index" }, // Parameter defaults
|
||||||
@ -28,7 +28,7 @@ namespace Teknik.Areas.Contact
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Contact.Action", // Route name
|
"Contact.Action", // Route name
|
||||||
new List<string>() { "dev", "contact" }, // Subdomains
|
new List<string>() { "contact" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"{action}", // URL with parameters
|
"{action}", // URL with parameters
|
||||||
new { controller = "Contact", action = "Index" }, // Parameter defaults
|
new { controller = "Contact", action = "Index" }, // Parameter defaults
|
||||||
|
@ -20,7 +20,7 @@ namespace Teknik.Areas.Help
|
|||||||
Config config = Config.Load();
|
Config config = Config.Load();
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Help.Index", // Route name
|
"Help.Index", // Route name
|
||||||
new List<string>() { "dev", "help" }, // Subdomains
|
new List<string>() { "help" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"", // URL with parameters
|
"", // URL with parameters
|
||||||
new { controller = "Help", action = "Index" }, // Parameter defaults
|
new { controller = "Help", action = "Index" }, // Parameter defaults
|
||||||
@ -28,7 +28,7 @@ namespace Teknik.Areas.Help
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Help.API", // Route name
|
"Help.API", // Route name
|
||||||
new List<string>() { "dev", "help" }, // Subdomains
|
new List<string>() { "help" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"API/{version}/{service}", // URL with parameters
|
"API/{version}/{service}", // URL with parameters
|
||||||
new { controller = "Help", action = "API", version = UrlParameter.Optional, service = UrlParameter.Optional }, // Parameter defaults
|
new { controller = "Help", action = "API", version = UrlParameter.Optional, service = UrlParameter.Optional }, // Parameter defaults
|
||||||
@ -36,7 +36,7 @@ namespace Teknik.Areas.Help
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Help.Blog", // Route name
|
"Help.Blog", // Route name
|
||||||
new List<string>() { "dev", "help" }, // Subdomains
|
new List<string>() { "help" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Blog", // URL with parameters
|
"Blog", // URL with parameters
|
||||||
new { controller = "Help", action = "Blog" }, // Parameter defaults
|
new { controller = "Help", action = "Blog" }, // Parameter defaults
|
||||||
@ -44,7 +44,7 @@ namespace Teknik.Areas.Help
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Help.Git", // Route name
|
"Help.Git", // Route name
|
||||||
new List<string>() { "dev", "help" }, // Subdomains
|
new List<string>() { "help" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Git", // URL with parameters
|
"Git", // URL with parameters
|
||||||
new { controller = "Help", action = "Git" }, // Parameter defaults
|
new { controller = "Help", action = "Git" }, // Parameter defaults
|
||||||
@ -52,7 +52,7 @@ namespace Teknik.Areas.Help
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Help.IRC", // Route name
|
"Help.IRC", // Route name
|
||||||
new List<string>() { "dev", "help" }, // Subdomains
|
new List<string>() { "help" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"IRC", // URL with parameters
|
"IRC", // URL with parameters
|
||||||
new { controller = "Help", action = "IRC" }, // Parameter defaults
|
new { controller = "Help", action = "IRC" }, // Parameter defaults
|
||||||
@ -60,7 +60,7 @@ namespace Teknik.Areas.Help
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Help.Mail", // Route name
|
"Help.Mail", // Route name
|
||||||
new List<string>() { "dev", "help" }, // Subdomains
|
new List<string>() { "help" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Mail", // URL with parameters
|
"Mail", // URL with parameters
|
||||||
new { controller = "Help", action = "Mail" }, // Parameter defaults
|
new { controller = "Help", action = "Mail" }, // Parameter defaults
|
||||||
@ -68,7 +68,7 @@ namespace Teknik.Areas.Help
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Help.Mumble", // Route name
|
"Help.Mumble", // Route name
|
||||||
new List<string>() { "dev", "help" }, // Subdomains
|
new List<string>() { "help" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Mumble", // URL with parameters
|
"Mumble", // URL with parameters
|
||||||
new { controller = "Help", action = "Mumble" }, // Parameter defaults
|
new { controller = "Help", action = "Mumble" }, // Parameter defaults
|
||||||
@ -76,7 +76,7 @@ namespace Teknik.Areas.Help
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Help.RSS", // Route name
|
"Help.RSS", // Route name
|
||||||
new List<string>() { "dev", "help" }, // Subdomains
|
new List<string>() { "help" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"RSS", // URL with parameters
|
"RSS", // URL with parameters
|
||||||
new { controller = "Help", action = "RSS" }, // Parameter defaults
|
new { controller = "Help", action = "RSS" }, // Parameter defaults
|
||||||
@ -84,7 +84,7 @@ namespace Teknik.Areas.Help
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Help.Upload", // Route name
|
"Help.Upload", // Route name
|
||||||
new List<string>() { "dev", "help" }, // Subdomains
|
new List<string>() { "help" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Upload", // URL with parameters
|
"Upload", // URL with parameters
|
||||||
new { controller = "Help", action = "Upload" }, // Parameter defaults
|
new { controller = "Help", action = "Upload" }, // Parameter defaults
|
||||||
|
@ -21,7 +21,7 @@ namespace Teknik.Areas.Home
|
|||||||
Config config = Config.Load();
|
Config config = Config.Load();
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Home.Index", // Route name
|
"Home.Index", // Route name
|
||||||
new List<string>() { "dev", "www", string.Empty }, // Subdomains
|
new List<string>() { "www", string.Empty }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"", // URL with parameters
|
"", // URL with parameters
|
||||||
new { controller = "Home", action = "Index" }, // Parameter defaults
|
new { controller = "Home", action = "Index" }, // Parameter defaults
|
||||||
|
@ -20,7 +20,7 @@ namespace Teknik.Areas.Paste
|
|||||||
Config config = Config.Load();
|
Config config = Config.Load();
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Paste.Index", // Route name
|
"Paste.Index", // Route name
|
||||||
new List<string>() { "dev", "paste", "p" },
|
new List<string>() { "paste", "p" },
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"", // URL with parameters
|
"", // URL with parameters
|
||||||
new { controller = "Paste", action = "Index" }, // Parameter defaults
|
new { controller = "Paste", action = "Index" }, // Parameter defaults
|
||||||
@ -28,7 +28,7 @@ namespace Teknik.Areas.Paste
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Paste.Simple", // Route name
|
"Paste.Simple", // Route name
|
||||||
new List<string>() { "dev", "paste", "p" },
|
new List<string>() { "paste", "p" },
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Simple/{url}/{password}", // URL with parameters
|
"Simple/{url}/{password}", // URL with parameters
|
||||||
new { controller = "Paste", action = "ViewPaste", type = "Simple", password = UrlParameter.Optional }, // Parameter defaults
|
new { controller = "Paste", action = "ViewPaste", type = "Simple", password = UrlParameter.Optional }, // Parameter defaults
|
||||||
@ -36,7 +36,7 @@ namespace Teknik.Areas.Paste
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Paste.Raw", // Route name
|
"Paste.Raw", // Route name
|
||||||
new List<string>() { "dev", "paste", "p" },
|
new List<string>() { "paste", "p" },
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Raw/{url}/{password}", // URL with parameters
|
"Raw/{url}/{password}", // URL with parameters
|
||||||
new { controller = "Paste", action = "ViewPaste", type = "Raw", password = UrlParameter.Optional }, // Parameter defaults
|
new { controller = "Paste", action = "ViewPaste", type = "Raw", password = UrlParameter.Optional }, // Parameter defaults
|
||||||
@ -44,7 +44,7 @@ namespace Teknik.Areas.Paste
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Paste.Download", // Route name
|
"Paste.Download", // Route name
|
||||||
new List<string>() { "dev", "paste", "p" },
|
new List<string>() { "paste", "p" },
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Download/{url}/{password}", // URL with parameters
|
"Download/{url}/{password}", // URL with parameters
|
||||||
new { controller = "Paste", action = "ViewPaste", type = "Download", password = UrlParameter.Optional }, // Parameter defaults
|
new { controller = "Paste", action = "ViewPaste", type = "Download", password = UrlParameter.Optional }, // Parameter defaults
|
||||||
@ -52,7 +52,7 @@ namespace Teknik.Areas.Paste
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Paste.Action", // Route name
|
"Paste.Action", // Route name
|
||||||
new List<string>() { "dev", "paste", "p" },
|
new List<string>() { "paste", "p" },
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Action/{action}", // URL with parameters
|
"Action/{action}", // URL with parameters
|
||||||
new { controller = "Paste", action = "Index" }, // Parameter defaults
|
new { controller = "Paste", action = "Index" }, // Parameter defaults
|
||||||
@ -60,7 +60,7 @@ namespace Teknik.Areas.Paste
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Paste.View", // Route name
|
"Paste.View", // Route name
|
||||||
new List<string>() { "dev", "paste", "p" },
|
new List<string>() { "paste", "p" },
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"{url}/{password}", // URL with parameters
|
"{url}/{password}", // URL with parameters
|
||||||
new { controller = "Paste", action = "ViewPaste", type = "Full", password = UrlParameter.Optional }, // Parameter defaults
|
new { controller = "Paste", action = "ViewPaste", type = "Full", password = UrlParameter.Optional }, // Parameter defaults
|
||||||
|
@ -20,7 +20,7 @@ namespace Teknik.Areas.Podcast
|
|||||||
Config config = Config.Load();
|
Config config = Config.Load();
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Podcast.Index", // Route name
|
"Podcast.Index", // Route name
|
||||||
new List<string>() { "dev", "podcast" }, // Subdomains
|
new List<string>() { "podcast" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"", // URL with parameters
|
"", // URL with parameters
|
||||||
new { controller = "Podcast", action = "Index" }, // Parameter defaults
|
new { controller = "Podcast", action = "Index" }, // Parameter defaults
|
||||||
@ -28,7 +28,7 @@ namespace Teknik.Areas.Podcast
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Podcast.View", // Route name
|
"Podcast.View", // Route name
|
||||||
new List<string>() { "dev", "podcast" }, // Subdomains
|
new List<string>() { "podcast" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"{episode}", // URL with parameters
|
"{episode}", // URL with parameters
|
||||||
new { controller = "Podcast", action = "View" }, // Parameter defaults
|
new { controller = "Podcast", action = "View" }, // Parameter defaults
|
||||||
@ -36,7 +36,7 @@ namespace Teknik.Areas.Podcast
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Podcast.Download", // Route name
|
"Podcast.Download", // Route name
|
||||||
new List<string>() { "dev", "podcast" }, // Subdomains
|
new List<string>() { "podcast" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"File/{episode}/{fileName}", // URL with parameters
|
"File/{episode}/{fileName}", // URL with parameters
|
||||||
new { controller = "Podcast", action = "Download" }, // Parameter defaults
|
new { controller = "Podcast", action = "Download" }, // Parameter defaults
|
||||||
@ -44,7 +44,7 @@ namespace Teknik.Areas.Podcast
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Podcast.Action", // Route name
|
"Podcast.Action", // Route name
|
||||||
new List<string>() { "dev", "podcast" }, // Subdomains
|
new List<string>() { "podcast" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Action/{controller}/{action}", // URL with parameters
|
"Action/{controller}/{action}", // URL with parameters
|
||||||
new { controller = "Podcast", action = "Index" }, // Parameter defaults
|
new { controller = "Podcast", action = "Index" }, // Parameter defaults
|
||||||
|
@ -19,7 +19,7 @@ namespace Teknik.Areas.Privacy
|
|||||||
Config config = Config.Load();
|
Config config = Config.Load();
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Privacy.Index", // Route name
|
"Privacy.Index", // Route name
|
||||||
new List<string>() { "dev", "privacy" }, // Subdomains
|
new List<string>() { "privacy" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"", // URL with parameters
|
"", // URL with parameters
|
||||||
new { controller = "Privacy", action = "Index" }, // Parameter defaults
|
new { controller = "Privacy", action = "Index" }, // Parameter defaults
|
||||||
|
@ -20,7 +20,7 @@ namespace Teknik.Areas.Profile
|
|||||||
Config config = Config.Load();
|
Config config = Config.Load();
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Profile.Login", // Route name
|
"Profile.Login", // Route name
|
||||||
new List<string>() { "dev", "profile", "www", string.Empty }, // Subdomains
|
new List<string>() { "profile" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Login", // URL with parameters
|
"Login", // URL with parameters
|
||||||
new { controller = "Profile", action = "Login" }, // Parameter defaults
|
new { controller = "Profile", action = "Login" }, // Parameter defaults
|
||||||
@ -28,7 +28,7 @@ namespace Teknik.Areas.Profile
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Profile.Logout", // Route name
|
"Profile.Logout", // Route name
|
||||||
new List<string>() { "dev", "profile", "www", string.Empty }, // Subdomains
|
new List<string>() { "profile" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Logout", // URL with parameters
|
"Logout", // URL with parameters
|
||||||
new { controller = "Profile", action = "Logout" }, // Parameter defaults
|
new { controller = "Profile", action = "Logout" }, // Parameter defaults
|
||||||
@ -36,7 +36,7 @@ namespace Teknik.Areas.Profile
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Profile.Register", // Route name
|
"Profile.Register", // Route name
|
||||||
new List<string>() { "dev", "profile", "www", string.Empty }, // Subdomains
|
new List<string>() { "profile" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Register", // URL with parameters
|
"Register", // URL with parameters
|
||||||
new { controller = "Profile", action = "Register" }, // Parameter defaults
|
new { controller = "Profile", action = "Register" }, // Parameter defaults
|
||||||
@ -44,7 +44,7 @@ namespace Teknik.Areas.Profile
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Profile.Settings", // Route name
|
"Profile.Settings", // Route name
|
||||||
new List<string>() { "dev", "profile" }, // Subdomains
|
new List<string>() { "profile" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Settings", // URL with parameters
|
"Settings", // URL with parameters
|
||||||
new { controller = "Profile", action = "Settings" }, // Parameter defaults
|
new { controller = "Profile", action = "Settings" }, // Parameter defaults
|
||||||
@ -52,7 +52,7 @@ namespace Teknik.Areas.Profile
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Profile.Index", // Route name
|
"Profile.Index", // Route name
|
||||||
new List<string>() { "dev", "profile" }, // Subdomains
|
new List<string>() { "profile" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"{username}", // URL with parameters
|
"{username}", // URL with parameters
|
||||||
new { controller = "Profile", action = "Index", username = UrlParameter.Optional }, // Parameter defaults
|
new { controller = "Profile", action = "Index", username = UrlParameter.Optional }, // Parameter defaults
|
||||||
@ -60,7 +60,7 @@ namespace Teknik.Areas.Profile
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Profile.Action", // Route name
|
"Profile.Action", // Route name
|
||||||
new List<string>() { "dev", "profile" }, // Subdomains
|
new List<string>() { "profile" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Action/{action}", // URL with parameters
|
"Action/{action}", // URL with parameters
|
||||||
new { controller = "Profile", action = "Index" }, // Parameter defaults
|
new { controller = "Profile", action = "Index" }, // Parameter defaults
|
||||||
|
@ -19,7 +19,7 @@ namespace Teknik.Areas.RSS
|
|||||||
Config config = Config.Load();
|
Config config = Config.Load();
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"RSS.Index", // Route name
|
"RSS.Index", // Route name
|
||||||
new List<string>() { "dev", "rss" },
|
new List<string>() { "rss" },
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"", // URL with parameters
|
"", // URL with parameters
|
||||||
new { controller = "RSS", action = "Index" }, // Parameter defaults
|
new { controller = "RSS", action = "Index" }, // Parameter defaults
|
||||||
@ -27,7 +27,7 @@ namespace Teknik.Areas.RSS
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"RSS.Blog", // Route name
|
"RSS.Blog", // Route name
|
||||||
new List<string>() { "dev", "rss" },
|
new List<string>() { "rss" },
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Blog/{username}", // URL with parameters
|
"Blog/{username}", // URL with parameters
|
||||||
new { controller = "RSS", action = "Blog", username = UrlParameter.Optional }, // Parameter defaults
|
new { controller = "RSS", action = "Blog", username = UrlParameter.Optional }, // Parameter defaults
|
||||||
@ -35,7 +35,7 @@ namespace Teknik.Areas.RSS
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"RSS.Podcast", // Route name
|
"RSS.Podcast", // Route name
|
||||||
new List<string>() { "dev", "rss" },
|
new List<string>() { "rss" },
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Podcast", // URL with parameters
|
"Podcast", // URL with parameters
|
||||||
new { controller = "RSS", action = "Podcast" }, // Parameter defaults
|
new { controller = "RSS", action = "Podcast" }, // Parameter defaults
|
||||||
|
@ -31,7 +31,7 @@ namespace Teknik.Areas.Shortener.Controllers
|
|||||||
shortUrl.Views += 1;
|
shortUrl.Views += 1;
|
||||||
db.Entry(shortUrl).State = System.Data.Entity.EntityState.Modified;
|
db.Entry(shortUrl).State = System.Data.Entity.EntityState.Modified;
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
return RedirectToUrl(shortUrl.OriginalUrl);
|
return Redirect(shortUrl.OriginalUrl);
|
||||||
}
|
}
|
||||||
return Redirect(Url.SubRouteUrl("error", "Error.Http404"));
|
return Redirect(Url.SubRouteUrl("error", "Error.Http404"));
|
||||||
}
|
}
|
||||||
@ -56,11 +56,17 @@ namespace Teknik.Areas.Shortener.Controllers
|
|||||||
db.ShortenedUrls.Add(newUrl);
|
db.ShortenedUrls.Add(newUrl);
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
|
|
||||||
return Json(new { result = new { shortUrl = string.Format("http://{0}/{1}", Config.ShortenerConfig.ShortenerHost, newUrl.ShortUrl), originalUrl = url } });
|
string shortUrl = Url.SubRouteUrl(string.Empty, "Shortener.View", new { url = newUrl.ShortUrl });
|
||||||
|
if (Config.DevEnvironment)
|
||||||
|
{
|
||||||
|
shortUrl = Url.SubRouteUrl("shortened", "Shortener.View", new { url = newUrl.ShortUrl });
|
||||||
|
}
|
||||||
|
|
||||||
|
return Json(new { result = new { shortUrl = shortUrl, originalUrl = url } });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Json(new { error = "Must be a valid HTTP or HTTPS Url" });
|
return Json(new { error = "Must be a valid Url" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ namespace Teknik.Areas.Shortener
|
|||||||
Config config = Config.Load();
|
Config config = Config.Load();
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Shortener.Index", // Route name
|
"Shortener.Index", // Route name
|
||||||
new List<string>() { "dev", "shorten", "s" }, // Subdomains
|
new List<string>() { "shorten", "s" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"", // URL with parameters
|
"", // URL with parameters
|
||||||
new { controller = "Shortener", action = "Index" }, // Parameter defaults
|
new { controller = "Shortener", action = "Index" }, // Parameter defaults
|
||||||
@ -28,7 +28,7 @@ namespace Teknik.Areas.Shortener
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Shortener.Action", // Route name
|
"Shortener.Action", // Route name
|
||||||
new List<string>() { "dev", "shorten", "s" }, // Subdomains
|
new List<string>() { "shorten", "s" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Action/{action}", // URL with parameters
|
"Action/{action}", // URL with parameters
|
||||||
new { controller = "Shortener", action = "Index" }, // Parameter defaults
|
new { controller = "Shortener", action = "Index" }, // Parameter defaults
|
||||||
@ -36,7 +36,7 @@ namespace Teknik.Areas.Shortener
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Shortener.View", // Route name
|
"Shortener.View", // Route name
|
||||||
new List<string>() { "dev", "*" }, // Subdomains
|
new List<string>() { string.Empty, "shortened" }, // Subdomains
|
||||||
new List<string>() { config.ShortenerConfig.ShortenerHost }, // domains
|
new List<string>() { config.ShortenerConfig.ShortenerHost }, // domains
|
||||||
"{url}", // URL with parameters
|
"{url}", // URL with parameters
|
||||||
new { controller = "Shortener", action = "RedirectToUrl" }, // Parameter defaults
|
new { controller = "Shortener", action = "RedirectToUrl" }, // Parameter defaults
|
||||||
|
@ -5,11 +5,10 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 text-center">
|
<div class="col-sm-12 text-center">
|
||||||
<h1>Shorten a Url</h1>
|
<h1>Url Shortener</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 text-center">
|
<div class="col-sm-12 text-center">
|
||||||
<form class="form-horizontal" name="shortenerForm" id="shortenerForm" method="post" action="@Url.SubRouteUrl("shorten", "Shortener.Action", new { action = "ShortenUrl" })">
|
<form class="form-horizontal" name="shortenerForm" id="shortenerForm" method="post" action="@Url.SubRouteUrl("shorten", "Shortener.Action", new { action = "ShortenUrl" })">
|
||||||
|
@ -19,7 +19,7 @@ namespace Teknik.Areas.Stream
|
|||||||
Config config = Config.Load();
|
Config config = Config.Load();
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Stream.Index", // Route name
|
"Stream.Index", // Route name
|
||||||
new List<string>() { "dev", "stream" }, // Subdomains
|
new List<string>() { "stream" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"", // URL with parameters
|
"", // URL with parameters
|
||||||
new { controller = "Stream", action = "Index" }, // Parameter defaults
|
new { controller = "Stream", action = "Index" }, // Parameter defaults
|
||||||
|
@ -19,7 +19,7 @@ namespace Teknik.Areas.Transparency
|
|||||||
Config config = Config.Load();
|
Config config = Config.Load();
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Transparency.Index",
|
"Transparency.Index",
|
||||||
new List<string>() { "dev", "transparency" }, // Subdomains
|
new List<string>() { "transparency" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"",
|
"",
|
||||||
new { controller = "Transparency", action = "Index" },
|
new { controller = "Transparency", action = "Index" },
|
||||||
|
@ -20,7 +20,7 @@ namespace Teknik.Areas.Upload
|
|||||||
Config config = Config.Load();
|
Config config = Config.Load();
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Upload.Index",
|
"Upload.Index",
|
||||||
new List<string>() { "dev", "upload", "u" }, // Subdomains
|
new List<string>() { "upload", "u" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"",
|
"",
|
||||||
new { controller = "Upload", action = "Index" },
|
new { controller = "Upload", action = "Index" },
|
||||||
@ -28,7 +28,7 @@ namespace Teknik.Areas.Upload
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Upload.Download",
|
"Upload.Download",
|
||||||
new List<string>() { "dev", "upload", "u" }, // Subdomains
|
new List<string>() { "upload", "u" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"{file}",
|
"{file}",
|
||||||
new { controller = "Upload", action = "Download", file = string.Empty },
|
new { controller = "Upload", action = "Download", file = string.Empty },
|
||||||
@ -36,7 +36,7 @@ namespace Teknik.Areas.Upload
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Upload.Delete",
|
"Upload.Delete",
|
||||||
new List<string>() { "dev", "upload", "u" }, // Subdomains
|
new List<string>() { "upload", "u" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"{file}/{key}",
|
"{file}/{key}",
|
||||||
new { controller = "Upload", action = "Delete", file = string.Empty, key = string.Empty },
|
new { controller = "Upload", action = "Delete", file = string.Empty, key = string.Empty },
|
||||||
@ -44,7 +44,7 @@ namespace Teknik.Areas.Upload
|
|||||||
);
|
);
|
||||||
context.MapSubdomainRoute(
|
context.MapSubdomainRoute(
|
||||||
"Upload.Action",
|
"Upload.Action",
|
||||||
new List<string>() { "dev", "upload", "u" }, // Subdomains
|
new List<string>() { "upload", "u" }, // Subdomains
|
||||||
new List<string>() { config.Host }, // domains
|
new List<string>() { config.Host }, // domains
|
||||||
"Action/{controller}/{action}",
|
"Action/{controller}/{action}",
|
||||||
new { controller = "Upload", action = "Index" },
|
new { controller = "Upload", action = "Index" },
|
||||||
|
@ -174,7 +174,7 @@ namespace Teknik
|
|||||||
public static bool IsValidUrl(this string url)
|
public static bool IsValidUrl(this string url)
|
||||||
{
|
{
|
||||||
Uri uriResult;
|
Uri uriResult;
|
||||||
bool result = Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out uriResult);
|
bool result = Uri.TryCreate(url, UriKind.Absolute, out uriResult);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
result = uriResult.IsWellFormedOriginalString();
|
result = uriResult.IsWellFormedOriginalString();
|
||||||
|
Loading…
Reference in New Issue
Block a user