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 3.5KB

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