The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UploadAreaRegistration.cs 4.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. using System.Collections.Generic;
  2. using System.Web.Mvc;
  3. using System.Web.Optimization;
  4. using Teknik.Configuration;
  5. using Teknik.Controllers;
  6. using Teknik.Utilities;
  7. namespace Teknik.Areas.Upload
  8. {
  9. public class UploadAreaRegistration : AreaRegistration
  10. {
  11. public override string AreaName
  12. {
  13. get
  14. {
  15. return "Upload";
  16. }
  17. }
  18. public override void RegisterArea(AreaRegistrationContext context)
  19. {
  20. Config config = Config.Load();
  21. context.MapSubdomainRoute(
  22. "Upload.Index",
  23. new List<string>() { "upload", "u" }, // Subdomains
  24. new List<string>() { config.Host }, // domains
  25. "",
  26. new { controller = "Upload", action = "Index" },
  27. new[] { typeof(Controllers.UploadController).Namespace }
  28. );
  29. context.MapSubdomainRoute(
  30. "Upload.Favicon",
  31. new List<string>() { "upload", "u" }, // Subdomains
  32. new List<string>() { config.Host }, // domains
  33. "favicon.ico",
  34. new { controller = "Default", action = "Favicon" },
  35. new[] { typeof(DefaultController).Namespace }
  36. );
  37. context.MapSubdomainRoute(
  38. "Upload.Download",
  39. new List<string>() { "upload", "u" }, // Subdomains
  40. new List<string>() { config.Host }, // domains
  41. "{file}",
  42. new { controller = "Upload", action = "Download", file = string.Empty },
  43. new[] { typeof(Controllers.UploadController).Namespace }
  44. );
  45. context.MapSubdomainRoute(
  46. "Upload.Delete",
  47. new List<string>() { "upload", "u" }, // Subdomains
  48. new List<string>() { config.Host }, // domains
  49. "{file}/{key}",
  50. new { controller = "Upload", action = "Delete", file = string.Empty, key = string.Empty },
  51. new[] { typeof(Controllers.UploadController).Namespace }
  52. );
  53. context.MapSubdomainRoute(
  54. "Upload.Action",
  55. new List<string>() { "upload", "u" }, // Subdomains
  56. new List<string>() { config.Host }, // domains
  57. "Action/{controller}/{action}",
  58. new { controller = "Upload", action = "Index" },
  59. new[] { typeof(Controllers.UploadController).Namespace }
  60. );
  61. // Register Script Bundles
  62. BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/upload", config.CdnHost).Include(
  63. "~/Scripts/Dropzone/dropzone.js",
  64. "~/Areas/Upload/Scripts/Upload.js",
  65. "~/Scripts/bootstrap-switch.js",
  66. "~/Scripts/bootbox/bootbox.min.js"));
  67. BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/download", config.CdnHost).Include(
  68. "~/Scripts/Blob.js",
  69. "~/Scripts/FileSaver.js",
  70. "~/Scripts/bootbox/bootbox.min.js",
  71. "~/Areas/Upload/Scripts/Download.js"));
  72. BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/cryptoWorker", config.CdnHost).Include(
  73. "~/Areas/Upload/Scripts/EncryptionWorker.js"));
  74. BundleTable.Bundles.Add(new CdnScriptBundle("~/bundles/crypto", config.CdnHost).Include(
  75. "~/Scripts/Crypto-js/aes.js",
  76. "~/Scripts/Crypto-js/enc-base64.js",
  77. "~/Scripts/Crypto-js/mode-ctr.js",
  78. "~/Scripts/Crypto-js/lib-typedarrays.js",
  79. "~/Scripts/Crypto-js/pad-nopadding.js"));
  80. // Register Style Bundles
  81. BundleTable.Bundles.Add(new CdnStyleBundle("~/Content/upload", config.CdnHost).Include(
  82. "~/Content/dropzone.css",
  83. "~/Content/bootstrap-switch/bootstrap3/bootstrap-switch.css",
  84. "~/Areas/Upload/Content/Upload.css"));
  85. }
  86. }
  87. }