Browse Source

- Removed uneeded 'dev' subdomains from routes.

- Made url shortening require absolute url
master
Teknikode 6 years ago
parent
commit
f848ff9f42
  1. 8
      Teknik/Areas/API/APIAreaRegistration.cs
  2. 2
      Teknik/Areas/About/AboutAreaRegistration.cs
  3. 6
      Teknik/Areas/Blog/BlogAreaRegistration.cs
  4. 4
      Teknik/Areas/Contact/ContactAreaRegistration.cs
  5. 18
      Teknik/Areas/Help/HelpAreaRegistration.cs
  6. 2
      Teknik/Areas/Home/HomeAreaRegistration.cs
  7. 12
      Teknik/Areas/Paste/PasteAreaRegistration.cs
  8. 8
      Teknik/Areas/Podcast/PodcastAreaRegistration.cs
  9. 2
      Teknik/Areas/Privacy/PrivacyAreaRegistration.cs
  10. 12
      Teknik/Areas/Profile/ProfileAreaRegistration.cs
  11. 6
      Teknik/Areas/RSS/RSSAreaRegistration.cs
  12. 12
      Teknik/Areas/Shortener/Controllers/ShortenerController.cs
  13. 6
      Teknik/Areas/Shortener/ShortenerAreaRegistration.cs
  14. 3
      Teknik/Areas/Shortener/Views/Shortener/Index.cshtml
  15. 2
      Teknik/Areas/Stream/StreamAreaRegistration.cs
  16. 2
      Teknik/Areas/Transparency/TransparencyAreaRegistration.cs
  17. 8
      Teknik/Areas/Upload/UploadAreaRegistration.cs
  18. 2
      Teknik/Helpers/UrlExtensions.cs

8
Teknik/Areas/API/APIAreaRegistration.cs

@ -21,7 +21,7 @@ namespace Teknik.Areas.API @@ -21,7 +21,7 @@ namespace Teknik.Areas.API
// Base Routing
context.MapSubdomainRoute(
"API.v1.Index", // Route name
new List<string>() { "dev", "api" },
new List<string>() { "api" },
new List<string>() { config.Host },
"v1", // URL with parameters
new { controller = "APIv1", action = "Index" }, // Parameter defaults
@ -30,7 +30,7 @@ namespace Teknik.Areas.API @@ -30,7 +30,7 @@ namespace Teknik.Areas.API
// Uploads
context.MapSubdomainRoute(
"API.v1.Upload", // Route name
new List<string>() { "dev", "api" },
new List<string>() { "api" },
new List<string>() { config.Host },
"v1/Upload", // URL with parameters
new { controller = "APIv1", action = "Upload" }, // Parameter defaults
@ -38,7 +38,7 @@ namespace Teknik.Areas.API @@ -38,7 +38,7 @@ namespace Teknik.Areas.API
);
context.MapSubdomainRoute(
"API.v1.Paste", // Route name
new List<string>() { "dev", "api" },
new List<string>() { "api" },
new List<string>() { config.Host },
"v1/Paste", // URL with parameters
new { controller = "APIv1", action = "Paste" }, // Parameter defaults
@ -49,7 +49,7 @@ namespace Teknik.Areas.API @@ -49,7 +49,7 @@ namespace Teknik.Areas.API
// Default Routing
context.MapSubdomainRoute(
"API.Index", // Route name
new List<string>() { "dev", "" },
new List<string>() { "api" },
new List<string>() { config.Host },
"", // URL with parameters
new { controller = "API", action = "Index" }, // Parameter defaults

2
Teknik/Areas/About/AboutAreaRegistration.cs

@ -19,7 +19,7 @@ namespace Teknik.Areas.About @@ -19,7 +19,7 @@ namespace Teknik.Areas.About
Config config = Config.Load();
context.MapSubdomainRoute(
"About.Index", // Route name
new List<string>() { "dev", "about" },
new List<string>() { "about" },
new List<string>() { config.Host },
"", // URL with parameters
new { controller = "About", action = "Index" }, // Parameter defaults

6
Teknik/Areas/Blog/BlogAreaRegistration.cs

@ -20,7 +20,7 @@ namespace Teknik.Areas.Blog @@ -20,7 +20,7 @@ namespace Teknik.Areas.Blog
Config config = Config.Load();
context.MapSubdomainRoute(
"Blog.Blog", // Route name
new List<string>() { "dev", "blog" }, // Subdomains
new List<string>() { "blog" }, // Subdomains
new List<string>() { config.Host },
"{username}", // URL with parameters
new { controller = "Blog", action = "Blog", username = string.Empty }, // Parameter defaults
@ -28,7 +28,7 @@ namespace Teknik.Areas.Blog @@ -28,7 +28,7 @@ namespace Teknik.Areas.Blog
);
context.MapSubdomainRoute(
"Blog.Post", // Route name
new List<string>() { "dev", "blog" }, // Subdomains
new List<string>() { "blog" }, // Subdomains
new List<string>() { config.Host },
"{username}/{id}", // URL with parameters
new { controller = "Blog", action = "Post", username = "", id = 0 }, // Parameter defaults
@ -36,7 +36,7 @@ namespace Teknik.Areas.Blog @@ -36,7 +36,7 @@ namespace Teknik.Areas.Blog
);
context.MapSubdomainRoute(
"Blog.Action", // Route name
new List<string>() { "dev", "blog" }, // Subdomains
new List<string>() { "blog" }, // Subdomains
new List<string>() { config.Host },
"Action/{controller}/{action}", // URL with parameters
new { controller = "Blog", action = "Blog" }, // Parameter defaults

4
Teknik/Areas/Contact/ContactAreaRegistration.cs

@ -20,7 +20,7 @@ namespace Teknik.Areas.Contact @@ -20,7 +20,7 @@ namespace Teknik.Areas.Contact
Config config = Config.Load();
context.MapSubdomainRoute(
"Contact.Index", // Route name
new List<string>() { "dev", "contact" }, // Subdomains
new List<string>() { "contact" }, // Subdomains
new List<string>() { config.Host }, // domains
"", // URL with parameters
new { controller = "Contact", action = "Index" }, // Parameter defaults
@ -28,7 +28,7 @@ namespace Teknik.Areas.Contact @@ -28,7 +28,7 @@ namespace Teknik.Areas.Contact
);
context.MapSubdomainRoute(
"Contact.Action", // Route name
new List<string>() { "dev", "contact" }, // Subdomains
new List<string>() { "contact" }, // Subdomains
new List<string>() { config.Host }, // domains
"{action}", // URL with parameters
new { controller = "Contact", action = "Index" }, // Parameter defaults

18
Teknik/Areas/Help/HelpAreaRegistration.cs

@ -20,7 +20,7 @@ namespace Teknik.Areas.Help @@ -20,7 +20,7 @@ namespace Teknik.Areas.Help
Config config = Config.Load();
context.MapSubdomainRoute(
"Help.Index", // Route name
new List<string>() { "dev", "help" }, // Subdomains
new List<string>() { "help" }, // Subdomains
new List<string>() { config.Host }, // domains
"", // URL with parameters
new { controller = "Help", action = "Index" }, // Parameter defaults
@ -28,7 +28,7 @@ namespace Teknik.Areas.Help @@ -28,7 +28,7 @@ namespace Teknik.Areas.Help
);
context.MapSubdomainRoute(
"Help.API", // Route name
new List<string>() { "dev", "help" }, // Subdomains
new List<string>() { "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
@ -36,7 +36,7 @@ namespace Teknik.Areas.Help @@ -36,7 +36,7 @@ namespace Teknik.Areas.Help
);
context.MapSubdomainRoute(
"Help.Blog", // Route name
new List<string>() { "dev", "help" }, // Subdomains
new List<string>() { "help" }, // Subdomains
new List<string>() { config.Host }, // domains
"Blog", // URL with parameters
new { controller = "Help", action = "Blog" }, // Parameter defaults
@ -44,7 +44,7 @@ namespace Teknik.Areas.Help @@ -44,7 +44,7 @@ namespace Teknik.Areas.Help
);
context.MapSubdomainRoute(
"Help.Git", // Route name
new List<string>() { "dev", "help" }, // Subdomains
new List<string>() { "help" }, // Subdomains
new List<string>() { config.Host }, // domains
"Git", // URL with parameters
new { controller = "Help", action = "Git" }, // Parameter defaults
@ -52,7 +52,7 @@ namespace Teknik.Areas.Help @@ -52,7 +52,7 @@ namespace Teknik.Areas.Help
);
context.MapSubdomainRoute(
"Help.IRC", // Route name
new List<string>() { "dev", "help" }, // Subdomains
new List<string>() { "help" }, // Subdomains
new List<string>() { config.Host }, // domains
"IRC", // URL with parameters
new { controller = "Help", action = "IRC" }, // Parameter defaults
@ -60,7 +60,7 @@ namespace Teknik.Areas.Help @@ -60,7 +60,7 @@ namespace Teknik.Areas.Help
);
context.MapSubdomainRoute(
"Help.Mail", // Route name
new List<string>() { "dev", "help" }, // Subdomains
new List<string>() { "help" }, // Subdomains
new List<string>() { config.Host }, // domains
"Mail", // URL with parameters
new { controller = "Help", action = "Mail" }, // Parameter defaults
@ -68,7 +68,7 @@ namespace Teknik.Areas.Help @@ -68,7 +68,7 @@ namespace Teknik.Areas.Help
);
context.MapSubdomainRoute(
"Help.Mumble", // Route name
new List<string>() { "dev", "help" }, // Subdomains
new List<string>() { "help" }, // Subdomains
new List<string>() { config.Host }, // domains
"Mumble", // URL with parameters
new { controller = "Help", action = "Mumble" }, // Parameter defaults
@ -76,7 +76,7 @@ namespace Teknik.Areas.Help @@ -76,7 +76,7 @@ namespace Teknik.Areas.Help
);
context.MapSubdomainRoute(
"Help.RSS", // Route name
new List<string>() { "dev", "help" }, // Subdomains
new List<string>() { "help" }, // Subdomains
new List<string>() { config.Host }, // domains
"RSS", // URL with parameters
new { controller = "Help", action = "RSS" }, // Parameter defaults
@ -84,7 +84,7 @@ namespace Teknik.Areas.Help @@ -84,7 +84,7 @@ namespace Teknik.Areas.Help
);
context.MapSubdomainRoute(
"Help.Upload", // Route name
new List<string>() { "dev", "help" }, // Subdomains
new List<string>() { "help" }, // Subdomains
new List<string>() { config.Host }, // domains
"Upload", // URL with parameters
new { controller = "Help", action = "Upload" }, // Parameter defaults

2
Teknik/Areas/Home/HomeAreaRegistration.cs

@ -21,7 +21,7 @@ namespace Teknik.Areas.Home @@ -21,7 +21,7 @@ namespace Teknik.Areas.Home
Config config = Config.Load();
context.MapSubdomainRoute(
"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
"", // URL with parameters
new { controller = "Home", action = "Index" }, // Parameter defaults

12
Teknik/Areas/Paste/PasteAreaRegistration.cs

@ -20,7 +20,7 @@ namespace Teknik.Areas.Paste @@ -20,7 +20,7 @@ namespace Teknik.Areas.Paste
Config config = Config.Load();
context.MapSubdomainRoute(
"Paste.Index", // Route name
new List<string>() { "dev", "paste", "p" },
new List<string>() { "paste", "p" },
new List<string>() { config.Host }, // domains
"", // URL with parameters
new { controller = "Paste", action = "Index" }, // Parameter defaults
@ -28,7 +28,7 @@ namespace Teknik.Areas.Paste @@ -28,7 +28,7 @@ namespace Teknik.Areas.Paste
);
context.MapSubdomainRoute(
"Paste.Simple", // Route name
new List<string>() { "dev", "paste", "p" },
new List<string>() { "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
@ -36,7 +36,7 @@ namespace Teknik.Areas.Paste @@ -36,7 +36,7 @@ namespace Teknik.Areas.Paste
);
context.MapSubdomainRoute(
"Paste.Raw", // Route name
new List<string>() { "dev", "paste", "p" },
new List<string>() { "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
@ -44,7 +44,7 @@ namespace Teknik.Areas.Paste @@ -44,7 +44,7 @@ namespace Teknik.Areas.Paste
);
context.MapSubdomainRoute(
"Paste.Download", // Route name
new List<string>() { "dev", "paste", "p" },
new List<string>() { "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
@ -52,7 +52,7 @@ namespace Teknik.Areas.Paste @@ -52,7 +52,7 @@ namespace Teknik.Areas.Paste
);
context.MapSubdomainRoute(
"Paste.Action", // Route name
new List<string>() { "dev", "paste", "p" },
new List<string>() { "paste", "p" },
new List<string>() { config.Host }, // domains
"Action/{action}", // URL with parameters
new { controller = "Paste", action = "Index" }, // Parameter defaults
@ -60,7 +60,7 @@ namespace Teknik.Areas.Paste @@ -60,7 +60,7 @@ namespace Teknik.Areas.Paste
);
context.MapSubdomainRoute(
"Paste.View", // Route name
new List<string>() { "dev", "paste", "p" },
new List<string>() { "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

8
Teknik/Areas/Podcast/PodcastAreaRegistration.cs

@ -20,7 +20,7 @@ namespace Teknik.Areas.Podcast @@ -20,7 +20,7 @@ namespace Teknik.Areas.Podcast
Config config = Config.Load();
context.MapSubdomainRoute(
"Podcast.Index", // Route name
new List<string>() { "dev", "podcast" }, // Subdomains
new List<string>() { "podcast" }, // Subdomains
new List<string>() { config.Host }, // domains
"", // URL with parameters
new { controller = "Podcast", action = "Index" }, // Parameter defaults
@ -28,7 +28,7 @@ namespace Teknik.Areas.Podcast @@ -28,7 +28,7 @@ namespace Teknik.Areas.Podcast
);
context.MapSubdomainRoute(
"Podcast.View", // Route name
new List<string>() { "dev", "podcast" }, // Subdomains
new List<string>() { "podcast" }, // Subdomains
new List<string>() { config.Host }, // domains
"{episode}", // URL with parameters
new { controller = "Podcast", action = "View" }, // Parameter defaults
@ -36,7 +36,7 @@ namespace Teknik.Areas.Podcast @@ -36,7 +36,7 @@ namespace Teknik.Areas.Podcast
);
context.MapSubdomainRoute(
"Podcast.Download", // Route name
new List<string>() { "dev", "podcast" }, // Subdomains
new List<string>() { "podcast" }, // Subdomains
new List<string>() { config.Host }, // domains
"File/{episode}/{fileName}", // URL with parameters
new { controller = "Podcast", action = "Download" }, // Parameter defaults
@ -44,7 +44,7 @@ namespace Teknik.Areas.Podcast @@ -44,7 +44,7 @@ namespace Teknik.Areas.Podcast
);
context.MapSubdomainRoute(
"Podcast.Action", // Route name
new List<string>() { "dev", "podcast" }, // Subdomains
new List<string>() { "podcast" }, // Subdomains
new List<string>() { config.Host }, // domains
"Action/{controller}/{action}", // URL with parameters
new { controller = "Podcast", action = "Index" }, // Parameter defaults

2
Teknik/Areas/Privacy/PrivacyAreaRegistration.cs

@ -19,7 +19,7 @@ namespace Teknik.Areas.Privacy @@ -19,7 +19,7 @@ namespace Teknik.Areas.Privacy
Config config = Config.Load();
context.MapSubdomainRoute(
"Privacy.Index", // Route name
new List<string>() { "dev", "privacy" }, // Subdomains
new List<string>() { "privacy" }, // Subdomains
new List<string>() { config.Host }, // domains
"", // URL with parameters
new { controller = "Privacy", action = "Index" }, // Parameter defaults

12
Teknik/Areas/Profile/ProfileAreaRegistration.cs

@ -20,7 +20,7 @@ namespace Teknik.Areas.Profile @@ -20,7 +20,7 @@ namespace Teknik.Areas.Profile
Config config = Config.Load();
context.MapSubdomainRoute(
"Profile.Login", // Route name
new List<string>() { "dev", "profile", "www", string.Empty }, // Subdomains
new List<string>() { "profile" }, // Subdomains
new List<string>() { config.Host }, // domains
"Login", // URL with parameters
new { controller = "Profile", action = "Login" }, // Parameter defaults
@ -28,7 +28,7 @@ namespace Teknik.Areas.Profile @@ -28,7 +28,7 @@ namespace Teknik.Areas.Profile
);
context.MapSubdomainRoute(
"Profile.Logout", // Route name
new List<string>() { "dev", "profile", "www", string.Empty }, // Subdomains
new List<string>() { "profile" }, // Subdomains
new List<string>() { config.Host }, // domains
"Logout", // URL with parameters
new { controller = "Profile", action = "Logout" }, // Parameter defaults
@ -36,7 +36,7 @@ namespace Teknik.Areas.Profile @@ -36,7 +36,7 @@ namespace Teknik.Areas.Profile
);
context.MapSubdomainRoute(
"Profile.Register", // Route name
new List<string>() { "dev", "profile", "www", string.Empty }, // Subdomains
new List<string>() { "profile" }, // Subdomains
new List<string>() { config.Host }, // domains
"Register", // URL with parameters
new { controller = "Profile", action = "Register" }, // Parameter defaults
@ -44,7 +44,7 @@ namespace Teknik.Areas.Profile @@ -44,7 +44,7 @@ namespace Teknik.Areas.Profile
);
context.MapSubdomainRoute(
"Profile.Settings", // Route name
new List<string>() { "dev", "profile" }, // Subdomains
new List<string>() { "profile" }, // Subdomains
new List<string>() { config.Host }, // domains
"Settings", // URL with parameters
new { controller = "Profile", action = "Settings" }, // Parameter defaults
@ -52,7 +52,7 @@ namespace Teknik.Areas.Profile @@ -52,7 +52,7 @@ namespace Teknik.Areas.Profile
);
context.MapSubdomainRoute(
"Profile.Index", // Route name
new List<string>() { "dev", "profile" }, // Subdomains
new List<string>() { "profile" }, // Subdomains
new List<string>() { config.Host }, // domains
"{username}", // URL with parameters
new { controller = "Profile", action = "Index", username = UrlParameter.Optional }, // Parameter defaults
@ -60,7 +60,7 @@ namespace Teknik.Areas.Profile @@ -60,7 +60,7 @@ namespace Teknik.Areas.Profile
);
context.MapSubdomainRoute(
"Profile.Action", // Route name
new List<string>() { "dev", "profile" }, // Subdomains
new List<string>() { "profile" }, // Subdomains
new List<string>() { config.Host }, // domains
"Action/{action}", // URL with parameters
new { controller = "Profile", action = "Index" }, // Parameter defaults

6
Teknik/Areas/RSS/RSSAreaRegistration.cs

@ -19,7 +19,7 @@ namespace Teknik.Areas.RSS @@ -19,7 +19,7 @@ namespace Teknik.Areas.RSS
Config config = Config.Load();
context.MapSubdomainRoute(
"RSS.Index", // Route name
new List<string>() { "dev", "rss" },
new List<string>() { "rss" },
new List<string>() { config.Host }, // domains
"", // URL with parameters
new { controller = "RSS", action = "Index" }, // Parameter defaults
@ -27,7 +27,7 @@ namespace Teknik.Areas.RSS @@ -27,7 +27,7 @@ namespace Teknik.Areas.RSS
);
context.MapSubdomainRoute(
"RSS.Blog", // Route name
new List<string>() { "dev", "rss" },
new List<string>() { "rss" },
new List<string>() { config.Host }, // domains
"Blog/{username}", // URL with parameters
new { controller = "RSS", action = "Blog", username = UrlParameter.Optional }, // Parameter defaults
@ -35,7 +35,7 @@ namespace Teknik.Areas.RSS @@ -35,7 +35,7 @@ namespace Teknik.Areas.RSS
);
context.MapSubdomainRoute(
"RSS.Podcast", // Route name
new List<string>() { "dev", "rss" },
new List<string>() { "rss" },
new List<string>() { config.Host }, // domains
"Podcast", // URL with parameters
new { controller = "RSS", action = "Podcast" }, // Parameter defaults

12
Teknik/Areas/Shortener/Controllers/ShortenerController.cs

@ -31,7 +31,7 @@ namespace Teknik.Areas.Shortener.Controllers @@ -31,7 +31,7 @@ namespace Teknik.Areas.Shortener.Controllers
shortUrl.Views += 1;
db.Entry(shortUrl).State = System.Data.Entity.EntityState.Modified;
db.SaveChanges();
return RedirectToUrl(shortUrl.OriginalUrl);
return Redirect(shortUrl.OriginalUrl);
}
return Redirect(Url.SubRouteUrl("error", "Error.Http404"));
}
@ -56,11 +56,17 @@ namespace Teknik.Areas.Shortener.Controllers @@ -56,11 +56,17 @@ namespace Teknik.Areas.Shortener.Controllers
db.ShortenedUrls.Add(newUrl);
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
{
return Json(new { error = "Must be a valid HTTP or HTTPS Url" });
return Json(new { error = "Must be a valid Url" });
}
}
}

6
Teknik/Areas/Shortener/ShortenerAreaRegistration.cs

@ -20,7 +20,7 @@ namespace Teknik.Areas.Shortener @@ -20,7 +20,7 @@ namespace Teknik.Areas.Shortener
Config config = Config.Load();
context.MapSubdomainRoute(
"Shortener.Index", // Route name
new List<string>() { "dev", "shorten", "s" }, // Subdomains
new List<string>() { "shorten", "s" }, // Subdomains
new List<string>() { config.Host }, // domains
"", // URL with parameters
new { controller = "Shortener", action = "Index" }, // Parameter defaults
@ -28,7 +28,7 @@ namespace Teknik.Areas.Shortener @@ -28,7 +28,7 @@ namespace Teknik.Areas.Shortener
);
context.MapSubdomainRoute(
"Shortener.Action", // Route name
new List<string>() { "dev", "shorten", "s" }, // Subdomains
new List<string>() { "shorten", "s" }, // Subdomains
new List<string>() { config.Host }, // domains
"Action/{action}", // URL with parameters
new { controller = "Shortener", action = "Index" }, // Parameter defaults
@ -36,7 +36,7 @@ namespace Teknik.Areas.Shortener @@ -36,7 +36,7 @@ namespace Teknik.Areas.Shortener
);
context.MapSubdomainRoute(
"Shortener.View", // Route name
new List<string>() { "dev", "*" }, // Subdomains
new List<string>() { string.Empty, "shortened" }, // Subdomains
new List<string>() { config.ShortenerConfig.ShortenerHost }, // domains
"{url}", // URL with parameters
new { controller = "Shortener", action = "RedirectToUrl" }, // Parameter defaults

3
Teknik/Areas/Shortener/Views/Shortener/Index.cshtml

@ -5,11 +5,10 @@ @@ -5,11 +5,10 @@
<div class="container">
<div class="row">
<div class="col-sm-12 text-center">
<h1>Shorten a Url</h1>
<h1>Url Shortener</h1>
</div>
</div>
<br />
<br />
<div class="row">
<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" })">

2
Teknik/Areas/Stream/StreamAreaRegistration.cs

@ -19,7 +19,7 @@ namespace Teknik.Areas.Stream @@ -19,7 +19,7 @@ namespace Teknik.Areas.Stream
Config config = Config.Load();
context.MapSubdomainRoute(
"Stream.Index", // Route name
new List<string>() { "dev", "stream" }, // Subdomains
new List<string>() { "stream" }, // Subdomains
new List<string>() { config.Host }, // domains
"", // URL with parameters
new { controller = "Stream", action = "Index" }, // Parameter defaults

2
Teknik/Areas/Transparency/TransparencyAreaRegistration.cs

@ -19,7 +19,7 @@ namespace Teknik.Areas.Transparency @@ -19,7 +19,7 @@ namespace Teknik.Areas.Transparency
Config config = Config.Load();
context.MapSubdomainRoute(
"Transparency.Index",
new List<string>() { "dev", "transparency" }, // Subdomains
new List<string>() { "transparency" }, // Subdomains
new List<string>() { config.Host }, // domains
"",
new { controller = "Transparency", action = "Index" },

8
Teknik/Areas/Upload/UploadAreaRegistration.cs

@ -20,7 +20,7 @@ namespace Teknik.Areas.Upload @@ -20,7 +20,7 @@ namespace Teknik.Areas.Upload
Config config = Config.Load();
context.MapSubdomainRoute(
"Upload.Index",
new List<string>() { "dev", "upload", "u" }, // Subdomains
new List<string>() { "upload", "u" }, // Subdomains
new List<string>() { config.Host }, // domains
"",
new { controller = "Upload", action = "Index" },
@ -28,7 +28,7 @@ namespace Teknik.Areas.Upload @@ -28,7 +28,7 @@ namespace Teknik.Areas.Upload
);
context.MapSubdomainRoute(
"Upload.Download",
new List<string>() { "dev", "upload", "u" }, // Subdomains
new List<string>() { "upload", "u" }, // Subdomains
new List<string>() { config.Host }, // domains
"{file}",
new { controller = "Upload", action = "Download", file = string.Empty },
@ -36,7 +36,7 @@ namespace Teknik.Areas.Upload @@ -36,7 +36,7 @@ namespace Teknik.Areas.Upload
);
context.MapSubdomainRoute(
"Upload.Delete",
new List<string>() { "dev", "upload", "u" }, // Subdomains
new List<string>() { "upload", "u" }, // Subdomains
new List<string>() { config.Host }, // domains
"{file}/{key}",
new { controller = "Upload", action = "Delete", file = string.Empty, key = string.Empty },
@ -44,7 +44,7 @@ namespace Teknik.Areas.Upload @@ -44,7 +44,7 @@ namespace Teknik.Areas.Upload
);
context.MapSubdomainRoute(
"Upload.Action",
new List<string>() { "dev", "upload", "u" }, // Subdomains
new List<string>() { "upload", "u" }, // Subdomains
new List<string>() { config.Host }, // domains
"Action/{controller}/{action}",
new { controller = "Upload", action = "Index" },

2
Teknik/Helpers/UrlExtensions.cs

@ -174,7 +174,7 @@ namespace Teknik @@ -174,7 +174,7 @@ namespace Teknik
public static bool IsValidUrl(this string url)
{
Uri uriResult;
bool result = Uri.TryCreate(url, UriKind.RelativeOrAbsolute, out uriResult);
bool result = Uri.TryCreate(url, UriKind.Absolute, out uriResult);
if (result)
{
result = uriResult.IsWellFormedOriginalString();

Loading…
Cancel
Save