0
0
mirror of https://github.com/nextcloud/server.git synced 2024-12-27 15:38:19 +00:00
nextcloud_server/dist/files_external-settings.js
Christopher Ng 415f082de0 chore: compile assets
Signed-off-by: Christopher Ng <chrng8@gmail.com>
2024-12-12 11:43:36 -08:00

2 lines
25 KiB
JavaScript

(()=>{"use strict";var e,t,n,s={80655:(e,t,n)=>{var s=n(65043),a=n(53334),i=n(56760),o=n(74692),r=n.n(o);function l(e,t){return e.toggleClass("warning-input",t),t}function c(e){const t=e.hasClass("optional");switch(e.attr("type")){case"text":case"password":if(""===e.val()&&!t)return!1}return!0}function d(e){switch(e.attr("type")){case"text":case"password":return l(e,!c(e))}}function u(e,t){const n=function(e){return e.toString().split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;").split('"').join("&quot;").split("'").join("&#039;")};if(e.length)return e.select2({placeholder:(0,a.t)("files_external","Type to select account or group."),allowClear:!0,multiple:!0,toggleSelect:!0,dropdownCssClass:"files-external-select2",ajax:{url:OC.generateUrl("apps/files_external/applicable"),dataType:"json",quietMillis:100,data:(e,n)=>({pattern:e,limit:t,offset:t*(n-1)}),results(e){if("success"===e.status){const n=[];let s=0;$.each(e.groups,(function(e,t){n.push({name:e+"(group)",displayname:t,type:"group"})})),$.each(e.users,(function(e,t){s++,n.push({name:e,displayname:t,type:"user"})}));const a=s>=t||e.groups.length>=t;return{results:n,more:a}}}},initSelection(e,t){const n={users:[]},s=e.val().split(",");for(let e=0;e<s.length;e++)n.users.push(s[e]);$.ajax(OC.generateUrl("displaynames"),{type:"POST",contentType:"application/json",data:JSON.stringify(n),dataType:"json"}).done((function(e){const n=[];"success"===e.status&&($.each(e.users,(function(e,t){!1!==t&&n.push({name:e,displayname:t,type:"user"})})),t(n))}))},id:e=>e.name,formatResult(e){const t=$('<span><div class="avatardiv"></div><span>'+n(e.displayname)+"</span></span>"),s=t.find(".avatardiv").attr("data-type",e.type).attr("data-name",e.name).attr("data-displayname",e.displayname);if("group"===e.type){const e=OC.imagePath("core","actions/group");s.html('<img width="32" height="32" src="'+e+'">')}return t.get(0).outerHTML},formatSelection:e=>"group"===e.type?'<span title="'+n(e.name)+'" class="group">'+n(e.displayname+" "+(0,a.t)("files_external","(Group)"))+"</span>":'<span title="'+n(e.name)+'" class="user">'+n(e.displayname)+"</span>",escapeMarkup:e=>e}).on("select2-loaded",(function(){$.each($(".avatardiv"),(function(e,t){const n=$(t);"user"===n.data("type")&&n.avatar(n.data("name"),32)}))})).on("change",(function(e){l($(e.target).closest(".applicableUsersContainer").find(".select2-choices"),!e.val.length)}))}(0,i.IF)(s.Ay);const p=function(e){this.id=e,this.backendOptions={}};p.Status={IN_PROGRESS:-1,SUCCESS:0,ERROR:1,INDETERMINATE:2},p.Visibility={NONE:0,PERSONAL:1,ADMIN:2,DEFAULT:3},p.prototype={_url:null,id:null,mountPoint:"",backend:null,authMechanism:null,backendOptions:null,mountOptions:null,save(e){let t=OC.generateUrl(this._url),n="POST";_.isNumber(this.id)&&(n="PUT",t=OC.generateUrl(this._url+"/{id}",{id:this.id})),this._save(n,t,e)},async _save(e,t,n){try{const a=(await s.Ay.request({confirmPassword:i.mH.Strict,method:e,url:t,data:this.getData()})).data;this.id=a.id,n.success(a)}catch(e){n.error(e)}},getData(){const e={mountPoint:this.mountPoint,backend:this.backend,authMechanism:this.authMechanism,backendOptions:this.backendOptions,testOnly:!0};return this.id&&(e.id=this.id),this.mountOptions&&(e.mountOptions=this.mountOptions),e},recheck(e){_.isNumber(this.id)?$.ajax({type:"GET",url:OC.generateUrl(this._url+"/{id}",{id:this.id}),data:{testOnly:!0},success:e.success,error:e.error}):_.isFunction(e.error)&&e.error()},async destroy(e){if(_.isNumber(this.id))try{await s.Ay.request({method:"DELETE",url:OC.generateUrl(this._url+"/{id}",{id:this.id}),confirmPassword:i.mH.Strict}),e.success()}catch(t){e.error(t)}else _.isFunction(e.success)&&e.success()},validate(){return""!==this.mountPoint&&!!this.backend&&!this.errors}};const h=function(e){this.id=e,this.applicableUsers=[],this.applicableGroups=[]};h.prototype=_.extend({},p.prototype,{_url:"apps/files_external/globalstorages",applicableUsers:null,applicableGroups:null,priority:null,getData(){const e=p.prototype.getData.apply(this,arguments);return _.extend(e,{applicableUsers:this.applicableUsers,applicableGroups:this.applicableGroups,priority:this.priority})}});const f=function(e){this.id=e};f.prototype=_.extend({},p.prototype,{_url:"apps/files_external/userstorages"});const g=function(e){this.id=e};g.prototype=_.extend({},p.prototype,{_url:"apps/files_external/userglobalstorages"});const m=function(){};m.prototype={$el:null,show(e,t,n){m._last&&m._last.hide();const s=$(OCA.Files_External.Templates.mountOptionsDropDown({mountOptionsEncodingLabel:(0,a.t)("files_external","Compatibility with Mac NFD encoding (slow)"),mountOptionsEncryptLabel:(0,a.t)("files_external","Enable encryption"),mountOptionsPreviewsLabel:(0,a.t)("files_external","Enable previews"),mountOptionsSharingLabel:(0,a.t)("files_external","Enable sharing"),mountOptionsFilesystemCheckLabel:(0,a.t)("files_external","Check for changes"),mountOptionsFilesystemCheckOnce:(0,a.t)("files_external","Never"),mountOptionsFilesystemCheckDA:(0,a.t)("files_external","Once every direct access"),mountOptionsReadOnlyLabel:(0,a.t)("files_external","Read only"),deleteLabel:(0,a.t)("files_external","Disconnect")}));this.$el=s;const i=e[0].parentNode.className;this.setOptions(t,n,i),this.$el.appendTo(e),m._last=this,this.$el.trigger("show")},hide(){this.$el&&(this.$el.trigger("hide"),this.$el.remove(),this.$el=null,m._last=null)},getOptions(){const e={};return this.$el.find("input, select").each((function(){const t=$(this),n=t.attr("name");let s=null;s="checkbox"===t.attr("type")?t.prop("checked"):t.val(),"int"===t.attr("data-type")&&(s=parseInt(s,10)),e[n]=s})),e},setOptions(e,t,n){if("owncloud"===n){const e=t.indexOf("encrypt");e>0&&t.splice(e,1)}const s=this.$el;_.each(e,(function(e,t){const n=s.find("input, select").filterAttr("name",t);"checkbox"===n.attr("type")?(_.isString(e)&&(e="true"===e),n.prop("checked",!!e)):n.val(e)})),s.find(".optionRow").each((function(e,n){const s=$(n),a=s.find("input, select").attr("name");-1!==t.indexOf(a)||s.hasClass("persistent")?s.show():s.hide()}))}};const b=function(e,t){this.initialize(e,t)};b.ParameterFlags={OPTIONAL:1,USER_PROVIDED:2},b.ParameterTypes={TEXT:0,BOOLEAN:1,PASSWORD:2,HIDDEN:3},b.prototype=_.extend({$el:null,_storageConfigClass:null,_isPersonal:!1,_userListLimit:30,_allBackends:null,_allAuthMechanisms:null,_encryptionEnabled:!1,initialize(e,t){this.$el=e,this._isPersonal=!0!==e.data("admin"),this._isPersonal?this._storageConfigClass=OCA.Files_External.Settings.UserStorageConfig:this._storageConfigClass=OCA.Files_External.Settings.GlobalStorageConfig,t&&!_.isUndefined(t.userListLimit)&&(this._userListLimit=t.userListLimit),this._encryptionEnabled=t.encryptionEnabled,this._canCreateLocal=t.canCreateLocal,this._allBackends=this.$el.find(".selectBackend").data("configurations"),this._allAuthMechanisms=this.$el.find("#addMountPoint .authentication").data("mechanisms"),this._initEvents()},whenSelectBackend(e){this.$el.find("tbody tr:not(#addMountPoint):not(.externalStorageLoading)").each((function(t,n){const s=$(n).find(".backend").data("identifier");e($(n),s)})),this.on("selectBackend",e)},whenSelectAuthMechanism(e){const t=this;this.$el.find("tbody tr:not(#addMountPoint):not(.externalStorageLoading)").each((function(n,s){const a=$(s).find(".selectAuthMechanism").val();e($(s),a,t._allAuthMechanisms[a].scheme)})),this.on("selectAuthMechanism",e)},_initEvents(){const e=this,t=_.bind(this._onChange,this);this.$el.on("keyup","td input",t),this.$el.on("paste","td input",t),this.$el.on("change","td input:checkbox",t),this.$el.on("change",".applicable",t),this.$el.on("click",".status>span",(function(){e.recheckStorageConfig($(this).closest("tr"))})),this.$el.on("click","td.mountOptionsToggle .icon-delete",(function(){e.deleteStorageConfig($(this).closest("tr"))})),this.$el.on("click","td.save>.icon-checkmark",(function(){e.saveStorageConfig($(this).closest("tr"))})),this.$el.on("click","td.mountOptionsToggle>.icon-more",(function(){$(this).attr("aria-expanded","true"),e._showMountOptionsDropdown($(this).closest("tr"))})),this.$el.on("change",".selectBackend",_.bind(this._onSelectBackend,this)),this.$el.on("change",".selectAuthMechanism",_.bind(this._onSelectAuthMechanism,this)),this.$el.on("change",".applicableToAllUsers",_.bind(this._onChangeApplicableToAllUsers,this))},_onChange(e){const t=$(e.target);if(t.closest(".dropdown").length)return;d(t);const n=t.closest("tr");this.updateStatus(n,null)},_onSelectBackend(e){const t=$(e.target);let n=t.closest("tr");const s=new this._storageConfigClass;s.mountPoint=n.find(".mountPoint input").val(),s.backend=t.val(),n.find(".mountPoint input").val(""),n.find(".selectBackend").prop("selectedIndex",0);const a=r().Deferred();n=this.newStorage(s,a),n.find(".applicableToAllUsers").prop("checked",!1).trigger("change"),a.resolve(),n.find("td.configuration").children().not("[type=hidden]").first().focus(),this.saveStorageConfig(n)},_onSelectAuthMechanism(e){const t=$(e.target),n=t.closest("tr"),s=t.val(),a=r().Deferred();this.configureAuthMechanism(n,s,a),a.resolve(),this.saveStorageConfig(n)},_onChangeApplicableToAllUsers(e){const t=$(e.target),n=t.closest("tr"),s=t.is(":checked");n.find(".applicableUsersContainer").toggleClass("hidden",s),s||n.find(".applicableUsers").select2("val","",!0),this.saveStorageConfig(n)},configureAuthMechanism(e,t,n){const s=this._allAuthMechanisms[t],a=e.find("td.configuration");a.find(".auth-param").remove(),$.each(s.configuration,_.partial(this.writeParameterInput,a,_,_,["auth-param"]).bind(this)),this.trigger("selectAuthMechanism",e,t,s.scheme,n)},newStorage(e,t,n){let s=e.mountPoint,i=this._allBackends[e.backend];i||(i={name:"Unknown: "+e.backend,invalid:!0});const o=this.$el.find("tr#addMountPoint"),r=o.clone();if(n||r.insertBefore(o),r.data("storageConfig",e),r.show(),r.find("td.mountOptionsToggle, td.save, td.remove").removeClass("hidden"),r.find("td").last().removeAttr("style"),r.removeAttr("id"),r.find("select#selectBackend"),n||u(r.find(".applicableUsers"),this._userListLimit),e.id&&r.data("id",e.id),r.find(".backend").text(i.name),""===s&&(s=this._suggestMountPoint(i.name)),r.find(".mountPoint input").val(s),r.addClass(i.identifier),r.find(".backend").data("identifier",i.identifier),i.invalid||"local"===i.identifier&&!this._canCreateLocal)return r.find("[name=mountPoint]").prop("disabled",!0),r.find(".applicable,.mountOptionsToggle").empty(),r.find(".save").empty(),i.invalid&&this.updateStatus(r,!1,(0,a.t)("files_external","Unknown backend: {backendName}",{backendName:i.name})),r;const l=$('<select class="selectAuthMechanism"></select>'),c=this._isPersonal?p.Visibility.PERSONAL:p.Visibility.ADMIN;$.each(this._allAuthMechanisms,(function(e,t){i.authSchemes[t.scheme]&&t.visibility&c&&l.append($('<option value="'+t.identifier+'" data-scheme="'+t.scheme+'">'+t.name+"</option>"))})),e.authMechanism?l.val(e.authMechanism):e.authMechanism=l.val(),r.find("td.authentication").append(l);const h=r.find("td.configuration");$.each(i.configuration,_.partial(this.writeParameterInput,h).bind(this)),this.trigger("selectBackend",r,i.identifier,t),this.configureAuthMechanism(r,e.authMechanism,t),e.backendOptions&&h.find("input, select").each((function(){const t=$(this),n=e.backendOptions[t.data("parameter")];void 0!==n&&(t.is("input:checkbox")&&t.prop("checked",n),t.val(e.backendOptions[t.data("parameter")]),d(t))}));let f=[];e.applicableUsers&&(f=f.concat(e.applicableUsers)),e.applicableGroups&&(f=f.concat(_.map(e.applicableGroups,(function(e){return e+"(group)"})))),f.length?(r.find(".applicableUsers").val(f).trigger("change"),r.find(".applicableUsersContainer").removeClass("hidden")):r.find(".applicableUsersContainer").addClass("hidden"),r.find(".applicableToAllUsers").prop("checked",!f.length);const g=$('<input type="hidden" class="priority" value="'+i.priority+'" />');return r.append(g),e.mountOptions?r.find("input.mountOptions").val(JSON.stringify(e.mountOptions)):r.find("input.mountOptions").val(JSON.stringify({encrypt:!0,previews:!0,enable_sharing:!1,filesystem_check_changes:1,encoding_compatibility:!1,readonly:!1})),r},loadStorages(){const e=this,t=$.Deferred(),n=$.Deferred();this.$el.find(".externalStorageLoading").removeClass("hidden"),$.when(t,n).always((()=>{e.$el.find(".externalStorageLoading").addClass("hidden")})),this._isPersonal?$.ajax({type:"GET",url:OC.generateUrl("apps/files_external/userglobalstorages"),data:{testOnly:!0},contentType:"application/json",success(n){n=Object.values(n);const s=r().Deferred();let i=$();n.forEach((function(t){let o;const r="system"===t.type&&e._isPersonal;t.mountPoint=t.mountPoint.substr(1),o=r?new g:new e._storageConfigClass,_.extend(o,t);const l=e.newStorage(o,s,!0);l.detach(),e.$el.prepend(l);const c=l.find(".authentication");c.text(c.find("select option:selected").text()),l.find(".mountOptionsToggle, .remove").empty(),l.find("input:not(.user_provided), select:not(.user_provided)").attr("disabled","disabled"),r?l.find(".configuration").find(":not(.user_provided)").remove():l.find(".configuration").text((0,a.t)("files_external","Admin defined")),n.length<20?e.recheckStorageConfig(l):e.updateStatus(l,p.Status.INDETERMINATE,(0,a.t)("files_external","Automatic status checking is disabled due to the large number of configured storages, click to check status")),i=i.add(l)})),u(e.$el.find(".applicableUsers"),this._userListLimit),e.$el.find("tr#addMountPoint").before(i);const o=$("#files_external");0===n.length&&"false"===o.attr("data-can-create")&&(o.hide(),$('a[href="#external-storage"]').parent().hide(),$(".emptycontent").show()),s.resolve(),t.resolve()}}):t.resolve();const s=this._storageConfigClass.prototype._url;$.ajax({type:"GET",url:OC.generateUrl(s),contentType:"application/json",success(t){t=Object.values(t);const s=r().Deferred();let i=$();t.forEach((function(n){n.mountPoint="/"===n.mountPoint?"/":n.mountPoint.substr(1);const o=new e._storageConfigClass;_.extend(o,n);const r=e.newStorage(o,s,!0);t.length<20?e.recheckStorageConfig(r):e.updateStatus(r,p.Status.INDETERMINATE,(0,a.t)("files_external","Automatic status checking is disabled due to the large number of configured storages, click to check status")),i=i.add(r)})),u(i.find(".applicableUsers"),this._userListLimit),e.$el.find("tr#addMountPoint").before(i),s.resolve(),n.resolve()}})},writeParameterInput(e,t,n,s){const a=function(e){return(n.flags&e)===e};if((s=$.isArray(s)?s:[]).push("added"),a(b.ParameterFlags.OPTIONAL)&&s.push("optional"),a(b.ParameterFlags.USER_PROVIDED)){if(!this._isPersonal)return;s.push("user_provided")}let i;const o=n.value;if(n.type===b.ParameterTypes.PASSWORD)i=$('<input type="password" class="'+s.join(" ")+'" data-parameter="'+t+'" placeholder="'+o+'" />');else if(n.type===b.ParameterTypes.BOOLEAN){const e=_.uniqueId("checkbox_");i=$('<div><label><input type="checkbox" id="'+e+'" class="'+s.join(" ")+'" data-parameter="'+t+'" />'+o+"</label></div>")}else i=n.type===b.ParameterTypes.HIDDEN?$('<input type="hidden" class="'+s.join(" ")+'" data-parameter="'+t+'" />'):$('<input type="text" class="'+s.join(" ")+'" data-parameter="'+t+'" placeholder="'+o+'" />');return n.defaultValue&&(n.type===b.ParameterTypes.BOOLEAN?i.find("input").prop("checked",n.defaultValue):i.val(n.defaultValue)),n.tooltip&&i.attr("title",n.tooltip),d(i),e.append(i),i},getStorageConfig(e){let t=e.data("id");t||(t=null);let n=e.data("storageConfig");n||(n=new this._storageConfigClass(t)),n.errors=null,n.mountPoint=e.find(".mountPoint input").val(),n.backend=e.find(".backend").data("identifier"),n.authMechanism=e.find(".selectAuthMechanism").val();const s={},a=e.find(".configuration input"),i=[];if($.each(a,(function(e,t){const n=$(t),a=n.data("parameter");"button"!==n.attr("type")&&(c(n)||n.hasClass("optional")?$(t).is(":checkbox")?$(t).is(":checked")?s[a]=!0:s[a]=!1:s[a]=$(t).val():i.push(a))})),n.backendOptions=s,i.length&&(n.errors={backendOptions:i}),!this._isPersonal){const t=function(e){const t=[],n=[],s=function(e){let t=e.find(".applicableUsers").select2("val");return t&&0!==t.length||(t=[]),t}(e);return $.each(s,(function(e,s){const a=s.indexOf?s.indexOf("(group)"):-1;-1!==a?n.push(s.substr(0,a)):t.push(s)})),e.find(".applicable").data("applicable-groups",n).data("applicable-users",t),{users:t,groups:n}}(e),s=t.users||[],a=t.groups||[];e.find(".applicableToAllUsers").is(":checked")?(n.applicableUsers=[],n.applicableGroups=[]):(n.applicableUsers=s,n.applicableGroups=a,n.applicableUsers.length||n.applicableGroups.length||(n.errors||(n.errors={}),n.errors.requiredApplicable=!0)),n.priority=parseInt(e.find("input.priority").val()||"100",10)}const o=e.find("input.mountOptions").val();return o&&(n.mountOptions=JSON.parse(o)),n},deleteStorageConfig(e){const t=this,n=e.data("id");if(!_.isNumber(n))return void e.remove();const s=new this._storageConfigClass(n);OC.dialogs.confirm((0,a.t)("files_external","Are you sure you want to disconnect this external storage? It will make the storage unavailable in Nextcloud and will lead to a deletion of these files and folders on any sync client that is currently connected but will not delete any files and folders on the external storage itself.",{storage:this.mountPoint}),(0,a.t)("files_external","Delete storage?"),(function(n){n&&(t.updateStatus(e,p.Status.IN_PROGRESS),s.destroy({success(){e.remove()},error(n){const s=n&&n.responseJSON?n.responseJSON.message:void 0;t.updateStatus(e,p.Status.ERROR,s)}}))}))},saveStorageConfig(e,t,n){const s=this,a=this.getStorageConfig(e);if(!a||!a.validate())return!1;this.updateStatus(e,p.Status.IN_PROGRESS),a.save({success(i){void 0!==n&&e.data("save-timer")!==n||(s.updateStatus(e,i.status,i.statusMessage),e.data("id",i.id),_.isFunction(t)&&t(a))},error(t){if(void 0===n||e.data("save-timer")===n){const n=t&&t.responseJSON?t.responseJSON.message:void 0;s.updateStatus(e,p.Status.ERROR,n)}}})},recheckStorageConfig(e){const t=this,n=this.getStorageConfig(e);if(!n.validate())return!1;this.updateStatus(e,p.Status.IN_PROGRESS),n.recheck({success(n){t.updateStatus(e,n.status,n.statusMessage)},error(n){const s=n&&n.responseJSON?n.responseJSON.message:void 0;t.updateStatus(e,p.Status.ERROR,s)}})},updateStatus(e,t,n){const s=e.find(".status span");switch(t){case null:s.hide();break;case p.Status.IN_PROGRESS:s.attr("class","icon-loading-small");break;case p.Status.SUCCESS:s.attr("class","success icon-checkmark-white");break;case p.Status.INDETERMINATE:s.attr("class","indeterminate icon-info-white");break;default:s.attr("class","error icon-error-white")}null!==t&&s.show(),"string"!=typeof n&&(n=(0,a.t)("files_external","Click to recheck the configuration")),s.attr("title",n)},_suggestMountPoint(e){const t=this.$el,n=e.indexOf("/");-1!==n&&(e=e.substring(0,n)),e=e.replace(/\s+/g,"");let s=1,a="",i=!0;for(;i&&s<20&&(i=!1,t.find("tbody td.mountPoint input").each((function(t,n){if($(n).val()===e+a)return i=!0,!1})),i);)a=s,s++;return e+a},_showMountOptionsDropdown(e){const t=this,n=this.getStorageConfig(e),s=e.find(".mountOptionsToggle"),a=new m,i=["previews","filesystem_check_changes","enable_sharing","encoding_compatibility","readonly","delete"];this._encryptionEnabled&&i.push("encrypt"),a.show(s,n.mountOptions||[],i),$("body").on("mouseup.mountOptionsDropdown",(function(e){$(e.target).closest(".popovermenu").length||a.hide()})),a.$el.on("hide",(function(){const n=a.getOptions();$("body").off("mouseup.mountOptionsDropdown"),e.find("input.mountOptions").val(JSON.stringify(n)),e.find("td.mountOptionsToggle>.icon-more").attr("aria-expanded","false"),t.saveStorageConfig(e)}))}},OC.Backbone.Events),window.addEventListener("DOMContentLoaded",(function(){const e=$("#files_external").attr("data-encryption-enabled"),t=$("#files_external").attr("data-can-create-local"),n="true"===e,o=new b($("#externalStorage"),{encryptionEnabled:n,canCreateLocal:"true"===t});o.loadStorages();const r=$("#allowUserMounting");r.bind("change",(function(){OC.msg.startSaving("#userMountingMsg"),this.checked?(OCP.AppConfig.setValue("files_external","allow_user_mounting","yes"),$('input[name="allowUserMountingBackends\\[\\]"]').prop("checked",!0),$("#userMountingBackends").removeClass("hidden"),$('input[name="allowUserMountingBackends\\[\\]"]').eq(0).trigger("change")):(OCP.AppConfig.setValue("files_external","allow_user_mounting","no"),$("#userMountingBackends").addClass("hidden")),OC.msg.finishedSaving("#userMountingMsg",{status:"success",data:{message:(0,a.t)("files_external","Saved")}})})),$('input[name="allowUserMountingBackends\\[\\]"]').bind("change",(function(){OC.msg.startSaving("#userMountingMsg");let e=$('input[name="allowUserMountingBackends\\[\\]"]:checked').map((function(){return $(this).val()})).get();const t=$('input[name="allowUserMountingBackends\\[\\]"][data-deprecate-to]').map((function(){return-1!==$.inArray($(this).data("deprecate-to"),e)?$(this).val():null})).get();e=e.concat(t),OCP.AppConfig.setValue("files_external","user_mounting_backends",e.join()),OC.msg.finishedSaving("#userMountingMsg",{status:"success",data:{message:(0,a.t)("files_external","Saved")}}),0===e.length&&(r.prop("checked",!1),r.trigger("change"))})),$("#global_credentials").on("submit",(async function(e){e.preventDefault();const t=$(this),n=t.find("[type=submit]");n.val((0,a.t)("files_external","Saving …"));const o=t.find("[name=uid]").val(),r=t.find("[name=username]").val(),l=t.find("[name=password]").val();return await s.Ay.request({method:"POST",data:JSON.stringify({uid:o,user:r,password:l}),url:OC.generateUrl("apps/files_external/globalcredentials"),confirmPassword:i.mH.Strict}),n.val((0,a.t)("files_external","Saved")),setTimeout((function(){n.val((0,a.t)("files_external","Save"))}),2500),!1})),OCA.Files_External.Settings.mountConfig=o,OC.MountConfig={saveStorage:_.bind(o.saveStorageConfig,o)}})),OCA.Files_External=OCA.Files_External||{},OCA.Files_External.Settings=OCA.Files_External.Settings||{},OCA.Files_External.Settings.GlobalStorageConfig=h,OCA.Files_External.Settings.UserStorageConfig=f,OCA.Files_External.Settings.MountConfigListView=b}},a={};function i(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={id:e,loaded:!1,exports:{}};return s[e].call(n.exports,n,n.exports,i),n.loaded=!0,n.exports}i.m=s,e=[],i.O=(t,n,s,a)=>{if(!n){var o=1/0;for(d=0;d<e.length;d++){n=e[d][0],s=e[d][1],a=e[d][2];for(var r=!0,l=0;l<n.length;l++)(!1&a||o>=a)&&Object.keys(i.O).every((e=>i.O[e](n[l])))?n.splice(l--,1):(r=!1,a<o&&(o=a));if(r){e.splice(d--,1);var c=s();void 0!==c&&(t=c)}}return t}a=a||0;for(var d=e.length;d>0&&e[d-1][2]>a;d--)e[d]=e[d-1];e[d]=[n,s,a]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((t,n)=>(i.f[n](e,t),t)),[])),i.u=e=>e+"-"+e+".js?v="+{5706:"3153330af47fc26a725a",6127:"40fbb3532bb7846b7035"}[e],i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},n="nextcloud:",i.l=(e,s,a,o)=>{if(t[e])t[e].push(s);else{var r,l;if(void 0!==a)for(var c=document.getElementsByTagName("script"),d=0;d<c.length;d++){var u=c[d];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==n+a){r=u;break}}r||(l=!0,(r=document.createElement("script")).charset="utf-8",r.timeout=120,i.nc&&r.setAttribute("nonce",i.nc),r.setAttribute("data-webpack",n+a),r.src=e),t[e]=[s];var p=(n,s)=>{r.onerror=r.onload=null,clearTimeout(h);var a=t[e];if(delete t[e],r.parentNode&&r.parentNode.removeChild(r),a&&a.forEach((e=>e(s))),n)return n(s)},h=setTimeout(p.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=p.bind(null,r.onerror),r.onload=p.bind(null,r.onload),l&&document.head.appendChild(r)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),i.j=5808,(()=>{var e;i.g.importScripts&&(e=i.g.location+"");var t=i.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var s=n.length-1;s>-1&&(!e||!/^http(s?):/.test(e));)e=n[s--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),(()=>{i.b=document.baseURI||self.location.href;var e={5808:0};i.f.j=(t,n)=>{var s=i.o(e,t)?e[t]:void 0;if(0!==s)if(s)n.push(s[2]);else{var a=new Promise(((n,a)=>s=e[t]=[n,a]));n.push(s[2]=a);var o=i.p+i.u(t),r=new Error;i.l(o,(n=>{if(i.o(e,t)&&(0!==(s=e[t])&&(e[t]=void 0),s)){var a=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;r.message="Loading chunk "+t+" failed.\n("+a+": "+o+")",r.name="ChunkLoadError",r.type=a,r.request=o,s[1](r)}}),"chunk-"+t,t)}},i.O.j=t=>0===e[t];var t=(t,n)=>{var s,a,o=n[0],r=n[1],l=n[2],c=0;if(o.some((t=>0!==e[t]))){for(s in r)i.o(r,s)&&(i.m[s]=r[s]);if(l)var d=l(i)}for(t&&t(n);c<o.length;c++)a=o[c],i.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return i.O(d)},n=self.webpackChunknextcloud=self.webpackChunknextcloud||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),i.nc=void 0;var o=i.O(void 0,[4208],(()=>i(80655)));o=i.O(o)})();
//# sourceMappingURL=files_external-settings.js.map?v=a09fca86eee8f5d4ac93