From ffdfa6d04df5c8ea8c59da9ec6a2122c58f5b39d Mon Sep 17 00:00:00 2001 From: Chee Yee Date: Wed, 24 Jan 2024 07:45:08 -0800 Subject: [PATCH] add new compression formats to web ui --- data/assets/res/angular-filemanager.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/assets/res/angular-filemanager.min.js b/data/assets/res/angular-filemanager.min.js index 2d8063a..2b631c7 100644 --- a/data/assets/res/angular-filemanager.min.js +++ b/data/assets/res/angular-filemanager.min.js @@ -1 +1 @@ -!function(e,n){"use strict";n.module("FileManagerApp",["pascalprecht.translate","ngFileUpload"]),n.element(e.document).on("shown.bs.modal",".modal",function(){e.setTimeout(function(){n.element("[autofocus]",this).focus()}.bind(this),100)}),n.element(e.document).on("click",function(){n.element("#context-menu").hide()}),n.element(e.document).on("contextmenu",'.main-navigation .table-files tr.item-list:has("td"), .item-list',function(r){var i=n.element("#context-menu");r.pageX>=e.innerWidth-i.width()&&(r.pageX-=i.width()),r.pageY>=e.innerHeight-i.height()&&(r.pageY-=i.height()),i.hide().css({left:r.pageX,top:r.pageY}).appendTo("body").show(),r.preventDefault()}),Array.prototype.find||(Array.prototype.find=function(e){if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var n,r=Object(this),i=r.length>>>0,a=arguments[1],t=0;to){for(n.temps=[];s>=o;)d=t[s],!n.isSelected(d)&&n.temps.push(d),s--;return}}!r||a||!r.ctrlKey&&!r.metaKey?n.temps=[e]:n.isSelected(e)?n.temps.splice(i,1):n.temps.push(e)}},n.singleSelection=function(){return 1===n.temps.length&&n.temps[0]},n.totalSelecteds=function(){return{total:n.temps.length}},n.selectionHas=function(e){return n.temps.find(function(n){return n&&n.model.type===e})},n.prepareNewFolder=function(){var e=new o(null,n.fileNavigator.currentPath);return n.temps=[e],e},n.prepareInstallUrl=function(){var e=new o(null,null);return n.temps=[e],e},n.smartClick=function(e){var r=n.config.allowedActions.pickFiles;if(e.isFolder())return n.fileNavigator.folderClick(e);if("function"==typeof n.config.pickCallback&&r){if(!0===n.config.pickCallback(e.model))return}return e.isImage()?n.config.previewImagesInModal?n.openImagePreview(e):n.apiMiddleware.download(e,!0):e.isEditable()?n.openEditItem(e):void 0},n.openImagePreview=function(){var e=n.singleSelection();n.apiMiddleware.apiHandler.inprocess=!0,n.modal("imagepreview",null,!0).find("#imagepreview-target").attr("src",n.getUrl(e)).unbind("load error").on("load error",function(){n.apiMiddleware.apiHandler.inprocess=!1,n.$apply()})},n.openEditItem=function(){var e=n.singleSelection();n.apiMiddleware.getContent(e).then(function(n){e.tempModel.content=e.model.content=n.result}),n.modal("edit")},n.modal=function(r,i,a){var t=e.element("#"+r);return t.modal(i?"hide":"show"),n.apiMiddleware.apiHandler.error="",n.apiMiddleware.apiHandler.asyncSuccess=!1,!a||t},n.modalWithPathSelector=function(e){return r.selectedModalPath=n.fileNavigator.currentPath,n.modal(e)},n.isInThisPath=function(e){return-1!==(n.fileNavigator.currentPath.join("/")+"/").indexOf(e+"/")},n.edit=function(){n.apiMiddleware.edit(n.singleSelection()).then(function(){n.modal("edit",!0)})},n.changePermissions=function(){n.apiMiddleware.changePermissions(n.temps,n.temp).then(function(){n.fileNavigator.refresh(),n.modal("changepermissions",!0)})},n.download=function(){var e=n.singleSelection();return e?n.apiMiddleware.download(e):n.apiMiddleware.downloadMultiple(n.temps)},n.copy=function(){var e=n.singleSelection();if(e){var i=e.tempModel.name.trim();if(n.fileNavigator.fileNameExists(i)&&c(e))return n.apiMiddleware.apiHandler.error=a.instant("error_invalid_filename"),!1;if(!i)return n.apiMiddleware.apiHandler.error=a.instant("error_invalid_filename"),!1}n.apiMiddleware.copy(n.temps,r.selectedModalPath).then(function(){n.fileNavigator.refresh(),n.modal("copy",!0)})},n.compress=function(){var e=n.temp.tempModel.name.trim();return n.fileNavigator.fileNameExists(e)&&c(n.temp)?(n.apiMiddleware.apiHandler.error=a.instant("error_invalid_filename"),!1):e?void n.apiMiddleware.compress(n.temps,e,r.selectedModalPath).then(function(){if(n.fileNavigator.refresh(),!n.config.compressAsync)return n.modal("compress",!0);n.apiMiddleware.apiHandler.asyncSuccess=!0},function(){n.apiMiddleware.apiHandler.asyncSuccess=!1}):(n.apiMiddleware.apiHandler.error=a.instant("error_invalid_filename"),!1)},n.extract=function(){var e=n.temp,i=n.temp.tempModel.name.trim();return n.fileNavigator.fileNameExists(i)&&c(n.temp)?(n.apiMiddleware.apiHandler.error=a.instant("error_invalid_filename"),!1):i?void n.apiMiddleware.extract(e,i,r.selectedModalPath).then(function(){if(n.fileNavigator.refresh(),!n.config.extractAsync)return n.modal("extract",!0);n.apiMiddleware.apiHandler.asyncSuccess=!0},function(){n.apiMiddleware.apiHandler.asyncSuccess=!1}):(n.apiMiddleware.apiHandler.error=a.instant("error_invalid_filename"),!1)},n.remove=function(){n.apiMiddleware.remove(n.temps).then(function(){n.fileNavigator.refresh(),n.modal("remove",!0)})},n.isInstallable=function(){for(var e=0;e=l.total_size&&l.deferredHandler(e.data,s,e.status)},function(e){l.deferredHandler(e.data,s,e.status,"Unknown error uploading files")},function(e){l.status[e.config._file.name].loaded=e.loaded;for(var n=0,r=0;r=l.total_size&&(l.inprocess=!1,l.progress=0,l.status=[])})}return s.promise},o.prototype.getContent=function(r,a){var t=this,o=n.defer(),l={action:"getContent",item:a};return t.inprocess=!0,t.error="",e.post(r,l).then(function(e){t.deferredHandler(e.data,o,e.status)},function(e){t.deferredHandler(e.data,o,e.status,i.instant("error_getting_content"))}).finally(function(){t.inprocess=!1}),o.promise},o.prototype.edit=function(r,a,t){var o=this,l=n.defer(),s={action:"edit",item:a,content:t};return o.inprocess=!0,o.error="",e.post(r,s).then(function(e){o.deferredHandler(e.data,l,e.status)},function(e){o.deferredHandler(e.data,l,e.status,i.instant("error_modifying"))}).finally(function(){o.inprocess=!1}),l.promise},o.prototype.rename=function(r,a,t){var o=this,l=n.defer(),s={action:"rename",item:a,newItemPath:t};return o.inprocess=!0,o.error="",e.post(r,s).then(function(e){o.deferredHandler(e.data,l,e.status)},function(e){o.deferredHandler(e.data,l,e.status,i.instant("error_renaming"))}).finally(function(){o.inprocess=!1}),l.promise},o.prototype.getUrl=function(e,n){return n&&[e,a({action:"download",path:n})].join("?")},o.prototype.download=function(a,t,o,l,s){var d=this,c=this.getUrl(a,t);if(!l||s||!r.saveAs)return!r.saveAs&&r.console.log("Your browser dont support ajax download, downloading by default"),!!r.open(c,"_blank","");var p=n.defer();return d.inprocess=!0,e.get(c).then(function(e){var n=new r.Blob([e.data]);p.resolve(e.data),r.saveAs(n,o)},function(e){d.deferredHandler(e.data,p,e.status,i.instant("error_downloading"))}).finally(function(){d.inprocess=!1}),p.promise},o.prototype.downloadMultiple=function(t,o,l,s,d){var c=this,p=n.defer(),u=[t,a({action:"downloadMultiple",items:o,toFilename:l})].join("?");return s&&!d&&r.saveAs?(c.inprocess=!0,e.get(t).then(function(e){var n=new r.Blob([e.data]);p.resolve(e.data),r.saveAs(n,l)},function(e){c.deferredHandler(e.data,p,e.status,i.instant("error_downloading"))}).finally(function(){c.inprocess=!1}),p.promise):(!r.saveAs&&r.console.log("Your browser dont support ajax download, downloading by default"),!!r.open(u,"_blank",""))},o.prototype.compress=function(r,a,t,o){var l=this,s=n.defer(),d={action:"compress",items:a,destination:o,compressedFilename:t};return l.inprocess=!0,l.error="",e.post(r,d).then(function(e){l.deferredHandler(e.data,s,e.status)},function(e){l.deferredHandler(e.data,s,e.status,i.instant("error_compressing"))}).finally(function(){l.inprocess=!1}),s.promise},o.prototype.extract=function(r,a,t,o){var l=this,s=n.defer(),d={action:"extract",item:a,destination:o,folderName:t};return l.inprocess=!0,l.error="",e.post(r,d).then(function(e){l.deferredHandler(e.data,s,e.status)},function(e){l.deferredHandler(e.data,s,e.status,i.instant("error_extracting"))}).finally(function(){l.inprocess=!1}),s.promise},o.prototype.changePermissions=function(r,a,t,o,l){var s=this,d=n.defer(),c={action:"changePermissions",items:a,perms:t,permsCode:o,recursive:!!l};return s.inprocess=!0,s.error="",e.post(r,c).then(function(e){s.deferredHandler(e.data,d,e.status)},function(e){s.deferredHandler(e.data,d,e.status,i.instant("error_changing_perms"))}).finally(function(){s.inprocess=!1}),d.promise},o.prototype.createFolder=function(r,a){var t=this,o=n.defer(),l={action:"createFolder",newPath:a};return t.inprocess=!0,t.error="",e.post(r,l).then(function(e){t.deferredHandler(e.data,o,e.status)},function(e){t.deferredHandler(e.data,o,e.status,i.instant("error_creating_folder"))}).finally(function(){t.inprocess=!1}),o.promise},o.prototype.installUrl=function(r,a,t){var o=this,l=n.defer(),s={action:"installUrl",url:a,use_alldebrid:t};return o.inprocess=!0,o.error="",e.post(r,s).then(function(e){o.deferredHandler(e.data,l,e.status)},function(e){o.deferredHandler(e.data,l,e.status,i.instant("error_installing_url"))}).finally(function(){o.inprocess=!1}),l.promise},o}])}(),function(e){"use strict";angular.module("FileManagerApp").service("apiMiddleware",["$window","fileManagerConfig","apiHandler",function(e,n,r){var i=function(){this.apiHandler=new r};return i.prototype.getPath=function(e){return"/"+e.join("/")},i.prototype.getFileList=function(e){return(e||[]).map(function(e){return e&&e.model.fullPath()})},i.prototype.getFilePath=function(e){return e&&e.model.fullPath()},i.prototype.list=function(e,r){return this.apiHandler.list(n.listUrl,this.getPath(e),r)},i.prototype.copy=function(e,r){var i=this.getFileList(e),a=1===i.length?e[0].tempModel.name:void 0;return this.apiHandler.copy(n.copyUrl,i,this.getPath(r),a)},i.prototype.move=function(e,r){var i=this.getFileList(e);return this.apiHandler.move(n.moveUrl,i,this.getPath(r))},i.prototype.remove=function(e){var r=this.getFileList(e);return this.apiHandler.remove(n.removeUrl,r)},i.prototype.install=function(e){var r=this.getFileList(e);return this.apiHandler.install(n.installUrl,r)},i.prototype.upload=function(r,i){if(!e.FormData)throw new Error("Unsupported browser version");var a=this.getPath(i);return this.apiHandler.upload(n.uploadUrl,n.uploadResumeSizeUrl,n.resumeChunkSize,a,r)},i.prototype.getContent=function(e){var r=this.getFilePath(e);return this.apiHandler.getContent(n.getContentUrl,r)},i.prototype.edit=function(e){var r=this.getFilePath(e);return this.apiHandler.edit(n.editUrl,r,e.tempModel.content)},i.prototype.rename=function(e){var r=this.getFilePath(e),i=e.tempModel.fullPath();return this.apiHandler.rename(n.renameUrl,r,i)},i.prototype.getUrl=function(e){var r=this.getFilePath(e);return this.apiHandler.getUrl(n.downloadFileUrl,r)},i.prototype.download=function(e,r){var i=this.getFilePath(e),a=e.model.name;if(!e.isFolder())return this.apiHandler.download(n.downloadFileUrl,i,a,n.downloadFilesByAjax,r)},i.prototype.downloadMultiple=function(e,r){var i=this.getFileList(e),a=(new Date).getTime().toString().substr(8,13)+"-"+n.multipleDownloadFileName;return this.apiHandler.downloadMultiple(n.downloadMultipleUrl,i,a,n.downloadFilesByAjax,r)},i.prototype.compress=function(e,r,i){var a=this.getFileList(e);return this.apiHandler.compress(n.compressUrl,a,r,this.getPath(i))},i.prototype.extract=function(e,r,i){var a=this.getFilePath(e);return this.apiHandler.extract(n.extractUrl,a,r,this.getPath(i))},i.prototype.changePermissions=function(e,r){var i=this.getFileList(e),a=r.tempModel.perms.toCode(),t=r.tempModel.perms.toOctal(),o=!!r.tempModel.recursive;return this.apiHandler.changePermissions(n.permissionsUrl,i,a,t,o)},i.prototype.createFolder=function(e){var r=e.tempModel.fullPath();return this.apiHandler.createFolder(n.createFolderUrl,r)},i.prototype.installUrl=function(e){var r=e.tempModel.name,i=e.tempModel.recursive;return this.apiHandler.installUrl(n.installUrlUrl,r,i)},i}])}(),function(e){"use strict";angular.module("FileManagerApp").service("fileNavigator",["apiMiddleware","fileManagerConfig","item",function(e,n,r){var i=function(){this.apiMiddleware=new e,this.requesting=!1,this.fileList=[],this.currentPath=this.getBasePath(),this.history=[],this.error="",this.onRefresh=function(){}};return i.prototype.getBasePath=function(){var e=(n.basePath||"").replace(/^\//,"");return e.trim()?e.split("/"):[]},i.prototype.deferredHandler=function(e,n,r,i){return e&&"object"==typeof e||(this.error="Error %s - Bridge response error, please check the API docs or this ajax response.".replace("%s",r)),404==r&&(this.error="Error 404 - Backend bridge is not working, please check the ajax response."),200==r&&(this.error=null),!this.error&&e.result&&e.result.error&&(this.error=e.result.error),!this.error&&e.error&&(this.error=e.error.message),!this.error&&i&&(this.error=i),this.error?n.reject(e):n.resolve(e)},i.prototype.list=function(){return this.apiMiddleware.list(this.currentPath,this.deferredHandler.bind(this))},i.prototype.refresh=function(){var e=this;e.currentPath.length||(e.currentPath=this.getBasePath());var n=e.currentPath.join("/");return e.requesting=!0,e.fileList=[],e.list().then(function(i){e.fileList=(i.result||[]).map(function(n){return new r(n,e.currentPath)}),e.buildTree(n),e.onRefresh()}).finally(function(){e.requesting=!1})},i.prototype.buildTree=function(e){function n(e,r,i){var a=i?i+"/"+r.model.name:r.model.name;if(e.name&&e.name.trim()&&0!==i.trim().indexOf(e.name)&&(e.nodes=[]),e.name!==i)e.nodes.forEach(function(e){n(e,r,i)});else{for(var t in e.nodes)if(e.nodes[t].name===a)return;e.nodes.push({item:r,name:a,nodes:[]})}e.nodes=e.nodes.sort(function(e,n){return e.name.toLowerCase()1024);var o=n.useBinarySizePrefixes?i[a]:r[a];return Math.max(t,.1).toFixed(1)+" "+o}}])}(),angular.module("FileManagerApp").run(["$templateCache",function(e){e.put("src/templates/current-folder-breadcrumb.html",''),e.put("src/templates/item-context-menu.html",''),e.put("src/templates/main-icons.html",'
\n \n\n
\n
\n
\n\n
\n {{"no_files_in_folder" | translate}}...\n
\n \n
\n {{ fileNavigator.error }}\n
\n
'),e.put("src/templates/main-table-modal.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n {{"name" | translate}}\n \n \n
\n
\n
\n {{"no_folders_in_folder" | translate}}...\n \n \n
\n {{ fileNavigator.error }}\n
\n \n \n {{item.model.name | strLimit : 32}}\n \n \n \n
'),e.put("src/templates/main-table.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n {{"name" | translate}}\n \n \n
\n
\n
\n {{"no_files_in_folder" | translate}}...\n
\n {{ fileNavigator.error }}\n
\n \n \n \n {{item.model.name | strLimit : 64}}\n \n
\n'),e.put("src/templates/main.html",'
\n
\n\n
\n
\n\n \n\n
\n \n
\n
\n
\n\n
\n
\n
\n'),e.put("src/templates/modals.html",'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n