123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <title>{{filename}} - {{hostname}} File Share</title>
- <meta name="description" content="Folder shared from {{hostname}}">
- <!-- Facebook Meta Tags -->
- <meta property="og:url" content="{{requri}}">
- <meta property="og:type" content="website">
- <meta property="og:title" content="{{filename}}">
- <meta property="og:description" content="File shared from {{hostname}}">
- <meta property="og:image" content="{{opg_image}}">
-
- <!-- Twitter Meta Tags -->
- <meta name="twitter:card" content="summary_large_image">
- <meta property="twitter:domain" content="{{host}}">
- <meta property="twitter:url" content="{{requri}}">
- <meta name="twitter:title" content="{{filename}}">
- <meta name="twitter:description" content="File shared from {{hostname}}">
- <meta name="twitter:image" content="{{opg_image}}">
-
- <link rel="stylesheet" href="../../script/skeleton/offline.css">
- <link rel="stylesheet" href="../../script/skeleton/normalize.css">
- <link rel="stylesheet" href="../../script/skeleton/skeleton.css">
- <script type="application/javascript" src="../../script/jquery.min.js"></script>
- <link rel="icon" type="image/png" href="../../img/public/share/share.png" />
- <style>
- body{
- padding-bottom: 100px;
- }
- .bar{
- height: 12px;
- background-color: #1a1a1a;
- width: 100%;
- }
- .footer{
- position: fixed;
- bottom: 0px;
- height: 50px;
- width: 100%;
- background-color: #1a1a1a;
- padding: 20px;
- color: white;
- }
- .fileobject{
- cursor: pointer;
- }
- .fileobject:hover{
- background-color: #f5f5f5;
- }
- .fileobject.active{
- background-color: #f5f5f5ee;
- }
- .noselect{
- -webkit-touch-callout: none; /* iOS Safari */
- -webkit-user-select: none; /* Safari */
- -khtml-user-select: none; /* Konqueror HTML */
- -moz-user-select: none; /* Old versions of Firefox */
- -ms-user-select: none; /* Internet Explorer/Edge */
- user-select: none;
- }
- #filelistWrapper{
- position: relative;
- padding: 12px;
- border-top: 4px solid #ffe46c;
- -webkit-box-shadow: 11px 9px 23px 0px rgba(54,54,54,0.31);
- box-shadow: 11px 9px 23px 0px rgba(54,54,54,0.31);
- }
- td{
- word-break: break-all;
- }
- </style>
- </head>
- <body>
- <div class="bar"></div>
- <br>
- <div class="container">
- <h5>{{hostname}} File Sharing</h5>
- <h3>{{filename}}</h3>
- <div class="row">
- <div class="one-half column">
- <table class="u-full-width">
- <thead>
- <tr>
- <th>Property</th>
- <th>Value</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>MIME Type</td>
- <td>{{mime}}</td>
- </tr>
- <tr>
- <td>Folder Size</td>
- <td>{{size}}</td>
- </tr>
- <tr>
- <td>File Counts</td>
- <td>{{filecount}}</td>
- </tr>
- <tr>
- <td>Last Modification Time</td>
- <td>{{modtime}}</td>
- </tr>
- </tbody>
- </table>
- <a href="{{downloadurl}}"><button class="button-primary">Download All</button></a>
- <button id="sharebtn" onclick="share();">Share</button>
- <p style="font-size: 80%;"><b>Depending on folder size, zipping might take a while to complete.</b></p>
- <p>Request File ID: {{reqid}}<br>
- Request Timestamp: {{reqtime}}</p>
- <small>📂 Double click any item in the list to open or download</small>
-
- </div>
- <div class="one-half column" id="filelistWrapper" style="overflow-y: auto; padding-right: 0.5em; min-height: 400px;">
- <table class="u-full-width">
- <thead>
- <tr>
- <th>Filename</th>
- <th>Type</th>
- <th>Size</th>
- </tr>
- </thead>
- <tbody id="folderList">
-
- </tbody>
- </table>
- </div>
- </div>
-
- </div>
- <div class="footer">
- <div class="container">
- Cloud File Sharing Interface, Powered by <a style="color: white;" href="http://arozos.com">arozos</a>
- </div>
- </div>
- <script>
- var treeFileList = {{treelist}};
- var downloadUUID = `{{downloaduuid}}`;
- var currentViewingRoot = ".";
- var selectedFile = null;
- renderFileList(treeFileList["."]);
- handleWindowResize();
- $(window).on("resize", function(e){
- handleWindowResize();
- });
- if (location.protocol !== 'https:') {
- document.getElementById("sharebtn").remove()
- }
- function share(){
- let shareData = {
- title: "{{filename}}",
- text: '{{filename}} - File Share from {{hostname}}',
- url: window.location.href,
- }
- navigator.share(shareData).then(() =>
- function(){
- //Share succ
- }
- ).catch((e) =>
- function(){
- //Share failed
- }
- )
- }
- function handleWindowResize(){
- if (window.innerWidth < 550){
- //Assume mobile
- $(".footer").css("height", "20px");
- }else{
- $(".footer").css("height", "50px");
- }
- }
-
- function renderFileList(filelist){
- $("#folderList").html("");
- if (currentViewingRoot != "."){
- $("#folderList").append(`<tr class="fileobject noselect" ondblclick="event.preventDefault(); parentdir();">
- <td style="padding-left: 8px;" colspan="3" > ↩ Back</td>
- </tr>`);
-
- }
- filelist.forEach(file => {
- var filetype = "File";
- var displayName = "";
- if (file.IsDir == true){
- //Folder
- filetype = "Folder";
- displayName = "📁 " + file.Filename;
- }else{
- //File
- var ext = file.Filename.split(".").pop();
- var icon = "📄"
- ext = ext.toLowerCase();
- if (ext == "mp3" || ext == "wav" || ext == "flac" || ext == "aac" || ext == "ogg" || ext == ""){
- icon = "🎵";
- }else if (ext == "mp4" || ext == "avi" || ext == "webm" || ext == "mkv" || ext == "mov" || ext == "rvmb"){
- icon = "🎞️";
- }else if (ext == "png" || ext == "jpeg" || ext == "jpg" || ext == "bmp" || ext == "gif"){
- icon = "🖼️";
- }
- displayName = icon + " " + file.Filename;
- }
- var filenameLinker = `<a href="../../share/download/${downloadUUID}/${file.RelPath}">${displayName}</a>`;
- if (file.IsDir == true){
- filenameLinker = `${displayName}`;
- }
- $("#folderList").append(`<tr class="fileobject noselect" onclick="highlightThis(this);" filename="${file.Filename}" relpath="${file.RelPath}" type="${filetype.toLocaleLowerCase()}" ondblclick="event.preventDefault(); openThis(this);">
- <td style="padding-left: 8px;">${filenameLinker}</td>
- <td>${filetype}</td>
- <td>${file.Filesize}</td>
- </tr>`);
- });
- }
- //Went up one level
- function parentdir(){
- if (currentViewingRoot == "."){
- //Root dir. Do nothing
-
- }else{
- //Subdirs. travel up
- var dirinfo = currentViewingRoot.split("/");
- var nextDir = ".";
- if (currentViewingRoot.indexOf("/") < 0){
- //Parent dir will be root
- }else{
- dirinfo.pop();
- nextDir = dirinfo.join("/");
- }
-
- //Load the filelist
- if (treeFileList[nextDir] != undefined){
- currentViewingRoot = nextDir;
- renderFileList(treeFileList[nextDir]);
- }else{
- //Back to root on error
- currentViewingRoot = ".";
- renderFileList(treeFileList["."]);
- }
- }
- }
- function openThis(object){
- var targetFilename = $(object).attr("filename");
- var targetType = $(object).attr("type");
- var targetRelPath = $(object).attr("relpath");
-
- if (targetType == "folder"){
- //Folder. Build a new root file list for this
- var targetRenderList = treeFileList[targetRelPath];
- if (targetRenderList != undefined){
- currentViewingRoot = targetRelPath;
- renderFileList(targetRenderList);
- }
-
- }else{
- //File. Download it
- window.open("../../share/download/" + downloadUUID + "/" + targetRelPath)
- }
- }
- resizeDOMElement();
- function resizeDOMElement(){
- $("#filelistWrapper").css({
- height: window.innerHeight - $("#filelistWrapper").offset().top - 100,
- })
- }
- function highlightThis(object){
- $(".fileobject.active").removeClass("active");
- $(object).addClass("active");
- $("#activeFilename").text(" (" + $(object).attr("filename") +")");
- //Update the properties values
- selectedFile = $(object);
- }
- $(window).on("resize", function(){
- resizeDOMElement();
- })
- </script>
- </body>
- </html>
|