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

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