downloadPageFolder.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  6. <title>{{filename}} - {{hostname}} File Share</title>
  7. <meta name="description" content="Folder shared from {{hostname}}">
  8. <!-- Facebook Meta Tags -->
  9. <meta property="og:url" content="{{requri}}">
  10. <meta property="og:type" content="website">
  11. <meta property="og:title" content="{{filename}}">
  12. <meta property="og:description" content="File shared from {{hostname}}">
  13. <meta property="og:image" content="{{opg_image}}">
  14. <!-- Twitter Meta Tags -->
  15. <meta name="twitter:card" content="summary_large_image">
  16. <meta property="twitter:domain" content="{{host}}">
  17. <meta property="twitter:url" content="{{requri}}">
  18. <meta name="twitter:title" content="{{filename}}">
  19. <meta name="twitter:description" content="File shared from {{hostname}}">
  20. <meta name="twitter:image" content="{{opg_image}}">
  21. <link rel="stylesheet" href="../../script/skeleton/offline.css">
  22. <link rel="stylesheet" href="../../script/skeleton/normalize.css">
  23. <link rel="stylesheet" href="../../script/skeleton/skeleton.css">
  24. <script type="application/javascript" src="../../script/jquery.min.js"></script>
  25. <link rel="icon" type="image/png" href="../../img/public/share/share.png" />
  26. <style>
  27. body{
  28. padding-bottom: 100px;
  29. }
  30. .bar{
  31. height: 12px;
  32. background-color: #1a1a1a;
  33. width: 100%;
  34. }
  35. .footer{
  36. position: fixed;
  37. bottom: 0px;
  38. height: 50px;
  39. width: 100%;
  40. background-color: #1a1a1a;
  41. padding: 20px;
  42. color: white;
  43. }
  44. .fileobject{
  45. cursor: pointer;
  46. }
  47. .fileobject:hover{
  48. background-color: #f5f5f5;
  49. }
  50. .fileobject.active{
  51. background-color: #f5f5f5ee;
  52. }
  53. .noselect{
  54. -webkit-touch-callout: none; /* iOS Safari */
  55. -webkit-user-select: none; /* Safari */
  56. -khtml-user-select: none; /* Konqueror HTML */
  57. -moz-user-select: none; /* Old versions of Firefox */
  58. -ms-user-select: none; /* Internet Explorer/Edge */
  59. user-select: none;
  60. }
  61. #filelistWrapper{
  62. position: relative;
  63. padding: 12px;
  64. border-top: 4px solid #ffe46c;
  65. -webkit-box-shadow: 11px 9px 23px 0px rgba(54,54,54,0.31);
  66. box-shadow: 11px 9px 23px 0px rgba(54,54,54,0.31);
  67. }
  68. td{
  69. word-break: break-all;
  70. }
  71. </style>
  72. </head>
  73. <body>
  74. <div class="bar"></div>
  75. <br>
  76. <div class="container">
  77. <h5>{{hostname}} File Sharing</h5>
  78. <h3>{{filename}}</h3>
  79. <div class="row">
  80. <div class="one-half column">
  81. <table class="u-full-width">
  82. <thead>
  83. <tr>
  84. <th>Property</th>
  85. <th>Value</th>
  86. </tr>
  87. </thead>
  88. <tbody>
  89. <tr>
  90. <td>MIME Type</td>
  91. <td>{{mime}}</td>
  92. </tr>
  93. <tr>
  94. <td>Folder Size</td>
  95. <td>{{size}}</td>
  96. </tr>
  97. <tr>
  98. <td>File Counts</td>
  99. <td>{{filecount}}</td>
  100. </tr>
  101. <tr>
  102. <td>Last Modification Time</td>
  103. <td>{{modtime}}</td>
  104. </tr>
  105. </tbody>
  106. </table>
  107. <a href="{{downloadurl}}"><button class="button-primary">Download All</button></a>
  108. <p style="font-size: 80%;"><b>Depending on folder size, zipping might take a while to complete.</b></p>
  109. <p>Request File ID: {{reqid}}<br>
  110. Request Timestamp: {{reqtime}}</p>
  111. <small>📂 Double click any item in the list to open or download</small>
  112. </div>
  113. <div class="one-half column" id="filelistWrapper" style="overflow-y: auto; padding-right: 0.5em; min-height: 400px;">
  114. <table class="u-full-width">
  115. <thead>
  116. <tr>
  117. <th>Filename</th>
  118. <th>Type</th>
  119. <th>Size</th>
  120. </tr>
  121. </thead>
  122. <tbody id="folderList">
  123. </tbody>
  124. </table>
  125. </div>
  126. </div>
  127. </div>
  128. <div class="footer">
  129. <div class="container">
  130. Cloud File Sharing Interface, Powered by <a style="color: white;" href="http://arozos.com">arozos</a>
  131. </div>
  132. </div>
  133. <script>
  134. var treeFileList = {{treelist}};
  135. var downloadUUID = `{{downloaduuid}}`;
  136. var currentViewingRoot = ".";
  137. var selectedFile = null;
  138. renderFileList(treeFileList["."]);
  139. handleWindowResize();
  140. $(window).on("resize", function(e){
  141. handleWindowResize();
  142. });
  143. function handleWindowResize(){
  144. if (window.innerWidth < 550){
  145. //Assume mobile
  146. $(".footer").css("height", "20px");
  147. }else{
  148. $(".footer").css("height", "50px");
  149. }
  150. }
  151. function renderFileList(filelist){
  152. $("#folderList").html("");
  153. if (currentViewingRoot != "."){
  154. $("#folderList").append(`<tr class="fileobject noselect" ondblclick="event.preventDefault(); parentdir();">
  155. <td style="padding-left: 8px;" colspan="3" > ↩ Back</td>
  156. </tr>`);
  157. }
  158. filelist.forEach(file => {
  159. var filetype = "File";
  160. var displayName = "";
  161. if (file.IsDir == true){
  162. //Folder
  163. filetype = "Folder";
  164. displayName = "📁 " + file.Filename;
  165. }else{
  166. //File
  167. var ext = file.Filename.split(".").pop();
  168. var icon = "📄"
  169. ext = ext.toLowerCase();
  170. if (ext == "mp3" || ext == "wav" || ext == "flac" || ext == "aac" || ext == "ogg" || ext == ""){
  171. icon = "🎵";
  172. }else if (ext == "mp4" || ext == "avi" || ext == "webm" || ext == "mkv" || ext == "mov" || ext == "rvmb"){
  173. icon = "🎞️";
  174. }else if (ext == "png" || ext == "jpeg" || ext == "jpg" || ext == "bmp" || ext == "gif"){
  175. icon = "🖼️";
  176. }
  177. displayName = icon + " " + file.Filename;
  178. }
  179. var filenameLinker = `<a href="../../share/download/${downloadUUID}/${file.RelPath}">${displayName}</a>`;
  180. if (file.IsDir == true){
  181. filenameLinker = `${displayName}`;
  182. }
  183. $("#folderList").append(`<tr class="fileobject noselect" onclick="highlightThis(this);" filename="${file.Filename}" relpath="${file.RelPath}" type="${filetype.toLocaleLowerCase()}" ondblclick="event.preventDefault(); openThis(this);">
  184. <td style="padding-left: 8px;">${filenameLinker}</td>
  185. <td>${filetype}</td>
  186. <td>${file.Filesize}</td>
  187. </tr>`);
  188. });
  189. }
  190. //Went up one level
  191. function parentdir(){
  192. if (currentViewingRoot == "."){
  193. //Root dir. Do nothing
  194. }else{
  195. //Subdirs. travel up
  196. var dirinfo = currentViewingRoot.split("/");
  197. var nextDir = ".";
  198. if (currentViewingRoot.indexOf("/") < 0){
  199. //Parent dir will be root
  200. }else{
  201. dirinfo.pop();
  202. nextDir = dirinfo.join("/");
  203. }
  204. //Load the filelist
  205. if (treeFileList[nextDir] != undefined){
  206. currentViewingRoot = nextDir;
  207. renderFileList(treeFileList[nextDir]);
  208. }else{
  209. //Back to root on error
  210. currentViewingRoot = ".";
  211. renderFileList(treeFileList["."]);
  212. }
  213. }
  214. }
  215. function openThis(object){
  216. var targetFilename = $(object).attr("filename");
  217. var targetType = $(object).attr("type");
  218. var targetRelPath = $(object).attr("relpath");
  219. if (targetType == "folder"){
  220. //Folder. Build a new root file list for this
  221. var targetRenderList = treeFileList[targetRelPath];
  222. if (targetRenderList != undefined){
  223. currentViewingRoot = targetRelPath;
  224. renderFileList(targetRenderList);
  225. }
  226. }else{
  227. //File. Download it
  228. window.open("../../share/download/" + downloadUUID + "/" + targetRelPath)
  229. }
  230. }
  231. resizeDOMElement();
  232. function resizeDOMElement(){
  233. $("#filelistWrapper").css({
  234. height: window.innerHeight - $("#filelistWrapper").offset().top - 100,
  235. })
  236. }
  237. function highlightThis(object){
  238. $(".fileobject.active").removeClass("active");
  239. $(object).addClass("active");
  240. $("#activeFilename").text(" (" + $(object).attr("filename") +")");
  241. //Update the properties values
  242. selectedFile = $(object);
  243. }
  244. $(window).on("resize", function(){
  245. resizeDOMElement();
  246. })
  247. </script>
  248. </body>
  249. </html>