The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Index.cshtml 9.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. @model Teknik.Areas.Upload.ViewModels.UploadViewModel
  2. @using Teknik.Areas.Vault.Models
  3. @{
  4. long maxUploadSize = Config.UploadConfig.MaxUploadSize;
  5. if (User.Identity.IsAuthenticated)
  6. {
  7. maxUploadSize = Config.UploadConfig.MaxUploadSizeBasic;
  8. //if (User.Info.AccountType == AccountType.Premium)
  9. //{
  10. // maxUploadSize = Config.UploadConfig.MaxUploadSizePremium;
  11. //}
  12. }
  13. }
  14. <script>
  15. var encScriptSrc = '@Url.FullURL("~/js/cryptoWorker.min.js")';
  16. var aesScriptSrc = '@Url.FullURL("~/js/crypto.min.js")';
  17. var uploadFileURL = '@Url.SubRouteUrl(Model.CurrentSub, "Upload.Action", new { action = "Upload" })';
  18. var maxUploadSize = @maxUploadSize;
  19. var chunkSize = @Config.UploadConfig.ChunkSize;
  20. var keySize = @Config.UploadConfig.KeySize;
  21. var blockSize = @Config.UploadConfig.BlockSize;
  22. var shortenURL = '@Url.SubRouteUrl("shorten", "Shortener.Action", new { action = "ShortenUrl" })';
  23. var createVaultURL = '@Url.SubRouteUrl("vault", "Vault.NewVaultFromService", new { type = "Upload" })';
  24. </script>
  25. <bundle src="css/upload.min.css" append-version="true" />
  26. <div class="container">
  27. <div class="row text-center">
  28. <div class="col-sm-10 col-sm-offset-1">
  29. <div class="row text-center">
  30. <div class="well well-lg text-center" id="uploadButton" style="cursor: pointer">
  31. <div class="row">
  32. <div class="col-sm-12">
  33. <h1>Drop your files here</h1>
  34. </div>
  35. </div>
  36. <div class="row">
  37. <div class="col-sm-12">
  38. <h2>Or just click here</h2>
  39. </div>
  40. </div>
  41. <div class="row">
  42. <div class="col-sm-12">
  43. <h3>Your Choice</h3>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="col-sm-1">
  50. <button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#uploadSettings"><i class="fa fa-gear"></i></button>
  51. </div>
  52. </div>
  53. <div class="row" id="upload-action-buttons" style="display: none">
  54. <div class="col-sm-12">
  55. <div class="btn-group pull-right" role="group">
  56. <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>
  57. <button type="button" class="btn btn-default btn-sm" id="create-vault"><i class="fa fa-folder"></i>&nbsp;Create Vault</button>
  58. @if (User.Identity.IsAuthenticated && Model.Vaults != null && Model.Vaults.Any())
  59. {
  60. <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>
  61. <ul class="dropdown-menu" id="add-to-vault-menu">
  62. @foreach (Vault item in Model.Vaults)
  63. {
  64. <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>
  65. }
  66. </ul>
  67. }
  68. </div>
  69. </div>
  70. </div>
  71. <div class="container" id="upload-links">
  72. </div>
  73. <br />
  74. <div class="well text-center">
  75. <p>
  76. The maximum file size per upload is <b>@StringHelper.GetBytesReadable(maxUploadSize)</b>
  77. </p>
  78. <p>
  79. Each file is encrypted after upload using an AES-256-CTR cipher. You can encrypt it within your browser for extra security by setting the option <strong>Encrypt in Browser</strong> in the options pane.
  80. </p>
  81. </div>
  82. <div class="text-center">
  83. Useful Tools: <a href="@Url.SubRouteUrl("help", "Help.Tools")">Upload Scripts and Utilities</a>
  84. </div>
  85. </div>
  86. <div class="modal fade" id="uploadSettings" tabindex="-1" role="dialog" aria-labelledby="uploadSettingsLabel" aria-hidden="true">
  87. <div class="modal-dialog">
  88. <div class="modal-content">
  89. <div class="modal-body">
  90. <div class="row">
  91. <div class="col-sm-6">
  92. <div class="row">
  93. <div class="col-sm-12 text-center">
  94. <h4 class="text-center">Encrypt in Browser</h4>
  95. </div>
  96. </div>
  97. <div class="row">
  98. <div class="col-sm-12">
  99. <input type="checkbox" class="center-block" name="encrypt" id="encrypt" @(Model.Encrypt ? "checked" : string.Empty) />
  100. </div>
  101. </div>
  102. </div>
  103. @if (User.Identity.IsAuthenticated)
  104. {
  105. <div class="col-sm-6">
  106. <div class="row">
  107. <div class="col-sm-12 text-center">
  108. <h4 class="text-center">Expiration</h4>
  109. </div>
  110. </div>
  111. <div class="row">
  112. <div class="col-sm-4 hidden" id="length-div">
  113. <input type="number" min="1" step="1" class="form-control" name="expirelength" id="expirelength" value="@Model.ExpirationLength">
  114. </div>
  115. <div class="col-sm-12" id="unit-div">
  116. <select class="form-control" name="expireunit" id="expireunit">
  117. @foreach (ExpirationUnit unit in Enum.GetValues(typeof(ExpirationUnit)))
  118. {
  119. <!option value="@unit" @(Model.ExpirationUnit == unit ? "selected" : string.Empty)>@unit.ToString()</!option>
  120. }
  121. </select>
  122. </div>
  123. </div>
  124. </div>
  125. }
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. </div>
  131. <div id="templates" style="display: none">
  132. <div class="row" id="upload-template">
  133. <div class="col-sm-12">
  134. <div class="panel panel-default">
  135. <div class="panel-heading text-center" id="upload-header">
  136. <div class="row">
  137. <div class="col-sm-10 col-sm-offset-1" id="upload-title"></div>
  138. <div class="col-sm-1">
  139. <button type="button" class="close pull-right" id="upload-close"><i class="fa fa-times-circle"></i></button>
  140. </div>
  141. </div>
  142. </div>
  143. <div class="panel-body" id="upload-details">
  144. <div class="row" id="upload-link-panel">
  145. <input type="hidden" id="upload-url" />
  146. <div class="col-sm-8">
  147. <dl class="dl-horizontal" style="margin-bottom: 0;">
  148. <dt>Url</dt>
  149. <dd><a href="#" id="upload-link" target="_blank" class="alert-link"></a></dd>
  150. <dt>Content-Type</dt>
  151. <dd id="upload-contentType"></dd>
  152. <dt>File Size</dt>
  153. <dd id="upload-contentLength"></dd>
  154. <dt>Expiration</dt>
  155. <dd id="upload-expiration"></dd>
  156. </dl>
  157. </div>
  158. <div class="col-sm-4">
  159. <div class="btn-group pull-right" role="group">
  160. <button type="button" class="btn btn-default btn-sm" id="shortenUrl"><i class="fa fa-link"></i>&nbsp;Shorten</button>
  161. <button type="button" class="btn btn-default btn-sm" id="delete-link"><i class="fa fa-trash"></i>&nbsp;Deletion Link</button>
  162. </div>
  163. </div>
  164. </div>
  165. <div class="row" id="upload-progress-panel">
  166. <div class="col-sm-12">
  167. <div class="row">
  168. <div class="col-sm-12 text-center">
  169. <div class="progress" id="progress">
  170. <div id="progress-bar" class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 0%"></div>
  171. </div>
  172. </div>
  173. </div>
  174. <div class="row">
  175. <div class="col-sm-10 col-sm-offset-1 text-center">
  176. <span id="progress-info"></span>
  177. </div>
  178. </div>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. </div>
  184. </div>
  185. </div>
  186. <bundle src="js/upload.min.js" append-version="true" />