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.

Index.cshtml 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. @model Teknik.Areas.Upload.ViewModels.UploadViewModel
  2. @using Teknik.Areas.Vault.Models
  3. <script>
  4. var encScriptSrc = '@Url.FullURL("~/js/cryptoWorker.min.js")';
  5. var aesScriptSrc = '@Url.FullURL("~/js/crypto.min.js")';
  6. var uploadFileURL = '@Url.SubRouteUrl(Model.CurrentSub, "Upload.Action", new { action = "Upload" })';
  7. var maxUploadSize = @Model.MaxUploadSize;
  8. var chunkSize = @Config.UploadConfig.ChunkSize;
  9. var keySize = @Config.UploadConfig.KeySize;
  10. var blockSize = @Config.UploadConfig.BlockSize;
  11. var shortenURL = '@Url.SubRouteUrl("shorten", "Shortener.Action", new { action = "ShortenUrl" })';
  12. var createVaultURL = '@Url.SubRouteUrl("vault", "Vault.NewVaultFromService", new { type = "Upload" })';
  13. </script>
  14. <bundle src="css/upload.min.css" append-version="true" />
  15. <div class="container">
  16. <div class="row text-center">
  17. <div class="col-sm-10 col-sm-offset-1">
  18. <div class="row text-center">
  19. <div class="text-center upload__drop-container" id="uploadButton" style="cursor: pointer">
  20. <div class="row">
  21. <div class="col-sm-12">
  22. <h3 class="upload__drop-text"><span class="fa fa-cloud-upload fa-5x"></span></h3>
  23. </div>
  24. </div>
  25. <div class="row">
  26. <div class="col-sm-12">
  27. <h2 class="upload__drop-text">DRAG &amp; DROP</h2>
  28. </div>
  29. </div>
  30. <div class="row">
  31. <div class="col-sm-12">
  32. <span class="upload__drop-text">Or select files from your system</span>
  33. </div>
  34. </div>
  35. <br />
  36. <div class="row">
  37. <div class="col-sm-12">
  38. <small class="upload__drop-text text-muted">(Individual file size limit @StringHelper.GetBytesReadable(Model.MaxUploadSize))</small>
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="col-sm-1 hidden-xs upload__help-icon">
  45. <a href="@Url.SubRouteUrl("help", "Help.Upload")" target="_blank"><i class="fa fa-question-circle-o"></i></a>
  46. </div>
  47. </div>
  48. <div class="row form-horizontal">
  49. <div class="col-sm-5 col-sm-offset-1">
  50. <div class="form-group form-group-sm" data-toggle="tooltip" data-placement="top" title="When enabled, each file is encrypted before upload using an AES-256-CTR cipher. A key is generated and required to download the file later.">
  51. <label for="encrypt" class="col-sm-6 col-xs-3 control-label">Encrypt in Browser</label>
  52. <div class="col-sm-6 col-xs-9">
  53. <input type="checkbox" class="center-block" name="encrypt" id="encrypt" @(Model.Encrypt ? "checked" : string.Empty) />
  54. </div>
  55. </div>
  56. </div>
  57. <div class="col-sm-5">
  58. <div class="form-group form-group-sm">
  59. @if (!User.Identity.IsAuthenticated)
  60. {
  61. @:<label class="col-xs-3 control-label" data-toggle="tooltip" data-placement="top" title="Uploads expire after 1 day for unregistered users">Expiration*</label>
  62. }
  63. else
  64. {
  65. @:<label class="col-xs-3 control-label">Expiration</label>
  66. }
  67. <fieldset @if (!User.Identity.IsAuthenticated) { @: disabled
  68. }>
  69. <div class="col-xs-4 hidden" id="length-div">
  70. <input type="number" min="1" step="1" class="form-control" name="expirelength" id="expirelength" value="@Model.ExpirationLength">
  71. </div>
  72. <div class="col-xs-9" id="unit-div">
  73. <select class="form-control" name="expireunit" id="expireunit">
  74. @foreach (ExpirationUnit unit in Enum.GetValues(typeof(ExpirationUnit)))
  75. {
  76. <!option value="@unit" @(Model.ExpirationUnit == unit ? "selected" : string.Empty)>@unit.ToString()</!option>
  77. }
  78. </select>
  79. </div>
  80. </fieldset>
  81. </div>
  82. </div>
  83. </div>
  84. <div class="row upload__action-buttons" id="upload-action-buttons" style="display: none">
  85. <div class="col-sm-12">
  86. <div class="btn-group pull-right" role="group">
  87. <button type="button" class="btn btn-default btn-sm" id="copy-all" data-toggle="popover" data-trigger="manual" data-placement="top" data-content="Copied to Clipboard" data-container="body"><i class="fa fa-clipboard"></i>&nbsp;Copy All Links</button>
  88. <button type="button" class="btn btn-default btn-sm" id="create-vault"><i class="fa fa-folder"></i>&nbsp;Create Vault</button>
  89. @if (User.Identity.IsAuthenticated && Model.Vaults != null && Model.Vaults.Any())
  90. {
  91. <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i>&nbsp;Add to Vault <span class="caret"></span></button>
  92. <ul class="dropdown-menu" id="add-to-vault-menu">
  93. @foreach (Vault item in Model.Vaults)
  94. {
  95. <li><a href="#" class="add-to-vault" data-add-to-vault-url="@Url.SubRouteUrl("vault", "Vault.EditVault", new { url = item.Url, type = "Upload" })">@item.Title</a></li>
  96. }
  97. </ul>
  98. }
  99. </div>
  100. </div>
  101. </div>
  102. <div class="container" id="upload-links">
  103. </div>
  104. <br />
  105. <div class="text-center">
  106. Useful Tools: <a href="@Url.SubRouteUrl("help", "Help.Tools")">Upload Scripts and Utilities</a>
  107. </div>
  108. </div>
  109. <div id="templates" style="display: none">
  110. <div class="row" id="upload-template">
  111. <div class="col-sm-12">
  112. <div class="panel panel-default">
  113. <div class="panel-heading text-center" id="upload-header">
  114. <div class="row">
  115. <div class="col-sm-10 col-sm-offset-1" id="upload-title"></div>
  116. <div class="col-sm-1">
  117. <button type="button" class="close pull-right" id="upload-close"><i class="fa fa-times-circle"></i></button>
  118. </div>
  119. </div>
  120. </div>
  121. <div class="panel-body" id="upload-details">
  122. <div class="row" id="upload-link-panel">
  123. <input type="hidden" id="upload-url" />
  124. <div class="col-sm-8">
  125. <dl class="dl-horizontal" style="margin-bottom: 0;">
  126. <dt>Url</dt>
  127. <dd><a href="#" id="upload-link" target="_blank" class="alert-link"></a></dd>
  128. <dt>Content-Type</dt>
  129. <dd id="upload-contentType"></dd>
  130. <dt>File Size</dt>
  131. <dd id="upload-contentLength"></dd>
  132. <dt>Expiration</dt>
  133. <dd id="upload-expiration"></dd>
  134. </dl>
  135. </div>
  136. <div class="col-sm-4">
  137. <div class="btn-group pull-right" role="group">
  138. <button type="button" class="btn btn-default btn-sm" id="shortenUrl"><i class="fa fa-link"></i>&nbsp;Shorten</button>
  139. <button type="button" class="btn btn-default btn-sm" id="delete-link"><i class="fa fa-trash"></i>&nbsp;Deletion Link</button>
  140. </div>
  141. </div>
  142. </div>
  143. <div class="row" id="upload-progress-panel">
  144. <div class="col-sm-12">
  145. <div class="row">
  146. <div class="col-sm-12 text-center">
  147. <div class="progress" id="progress">
  148. <div id="progress-bar" class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 0%"></div>
  149. </div>
  150. </div>
  151. </div>
  152. <div class="row">
  153. <div class="col-sm-10 col-sm-offset-1 text-center">
  154. <span id="progress-info"></span>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. <bundle src="js/upload.min.js" append-version="true" />