123 |
- const __vite__fileDeps=["./chunks/AppStore-FMtGLmT8.mjs","./core-common.mjs","./chunks/composables-CBXUeqOy.mjs","./chunks/apps-store-CNQC26NP.mjs","./chunks/index-PaKKd09k.mjs","./chunks/_plugin-vue2_normalizer-VrK6B12S-BQkexw0P.mjs","./chunks/pinia-CcZmjq9w.mjs","./chunks/logger-C7fGMvfA.mjs","./chunks/index-CiG5J8j_.mjs","./chunks/icons-TElqpmA8.mjs","./chunks/AppsConstants-D0cb4_9X.mjs","./chunks/AppManagement-xpdtPrBe.mjs","./chunks/rebuild-navigation-C1f1Ra5A.mjs","./chunks/index-BhGDpaQm.mjs","./chunks/preload-helper-BG02UnR2.mjs","./chunks/AppStoreNavigation-9roGNS4P.mjs","./chunks/AppStoreSidebar-DkMYDRrf.mjs","./chunks/marked.esm-C_q1v7Sb.mjs","./chunks/UserManagement-DBSXtMB2.mjs","./chunks/index-DCgLaXhm.mjs","./chunks/index-DG15V7L3.mjs","./chunks/index-CPb3EwrS.mjs","./chunks/index-tn-fAC9x.mjs","./chunks/json2xml-BD0x8Z3S.mjs","./chunks/userUtils-Di345_lx.mjs","./chunks/UserManagementNavigation-a0iPIKqj.mjs","./chunks/v-tooltip.esm-DFdYkWpQ.mjs","./chunks/_overRest-DjFtaWRq.mjs","./chunks/_setToArray-V03nfpyh.mjs","./chunks/_isIterateeCall-CX-rKv74.mjs","./chunks/isPlainObject-CnMaw-ru.mjs","./chunks/vue-router.esm-CkRP8kF4.mjs","./chunks/vuex.esm-pSkZdmXO.mjs","./chunks/index-CDMqmWCu.mjs"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]);
- /*! third party licenses: dist/vendor.LICENSE.txt */
- import{a_ as k,N as D,aV as p,bZ as l,bR as c,cp as G,b$ as u,cc as _,b_ as w,bS as N,c5 as T}from"./core-common.mjs";import{p as x}from"./chunks/v-tooltip.esm-DFdYkWpQ.mjs";import{n as B}from"./chunks/icons-TElqpmA8.mjs";import{V as F}from"./chunks/vue-router.esm-CkRP8kF4.mjs";import{_ as b}from"./chunks/preload-helper-BG02UnR2.mjs";import{i as j,S as M}from"./chunks/vuex.esm-pSkZdmXO.mjs";import{s as $}from"./chunks/index-DG15V7L3.mjs";import"./chunks/index-PaKKd09k.mjs";import{z as U,j as V}from"./chunks/_plugin-vue2_normalizer-VrK6B12S-BQkexw0P.mjs";import{x as H}from"./chunks/index-CDMqmWCu.mjs";/* empty css */import{l as v}from"./chunks/logger-C7fGMvfA.mjs";import{P as z,c as J}from"./chunks/pinia-CcZmjq9w.mjs";import"./chunks/_overRest-DjFtaWRq.mjs";import"./chunks/_setToArray-V03nfpyh.mjs";import"./chunks/_isIterateeCall-CX-rKv74.mjs";import"./chunks/isPlainObject-CnMaw-ru.mjs";import"./chunks/index-CiG5J8j_.mjs";import"./chunks/index-CPb3EwrS.mjs";import"./chunks/index-tn-fAC9x.mjs";var W=function(e,r,s){var o=(s||{}).moduleName||"route";e.registerModule(o,{namespaced:!0,state:E(r.currentRoute),mutations:{ROUTE_CHANGED:function(m,g){e.state[o]=E(g.to,g.from)}}});var a=!1,i,d=e.watch(function(m){return m[o]},function(m){var g=m.fullPath;g!==i&&(i!=null&&(a=!0,r.push(m)),i=g)},{sync:!0}),f=r.afterEach(function(m,g){if(a){a=!1;return}i=m.fullPath,e.commit(o+"/ROUTE_CHANGED",{to:m,from:g})});return function(){f==null||f(),d==null||d(),e.unregisterModule(o)}};function E(e,r){var s={name:e.name,path:e.path,hash:e.hash,query:e.query,params:e.params,fullPath:e.fullPath,meta:e.meta};return r&&(s.from=E(r)),Object.freeze(s)}const Y=k({__name:"SettingsApp",setup(e){return{__sfc:!0,NcContent:D}}});var Z=function(){var e=this,r=e._self._c,s=e._self._setupProxy;return r(s.NcContent,{attrs:{"app-name":"settings"}},[r("router-view",{attrs:{name:"navigation"}}),r("router-view"),r("router-view",{attrs:{name:"sidebar"}})],1)},K=[],Q=B(Y,Z,K,!1,null,null);const X=Q.exports,ee=()=>b(()=>import("./chunks/AppStore-FMtGLmT8.mjs").then(e=>e.a),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]),import.meta.url),te=()=>b(()=>import("./chunks/AppStoreNavigation-9roGNS4P.mjs"),__vite__mapDeps([15,1,10,3,4,5,6,7,8,9]),import.meta.url),re=()=>b(()=>import("./chunks/AppStoreSidebar-DkMYDRrf.mjs"),__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,11,12,17]),import.meta.url),se=()=>b(()=>import("./chunks/UserManagement-DBSXtMB2.mjs"),__vite__mapDeps([18,1,9,4,5,19,7,8,20,21,22,23,24]),import.meta.url),oe=()=>b(()=>import("./chunks/UserManagementNavigation-a0iPIKqj.mjs"),__vite__mapDeps([25,1,9,4,5,20,8,21,22,24,2,26,27,28,29,30,31,14,32,33,7,6]),import.meta.url),ae=[{name:"users",path:"/:index(index.php/)?settings/users",components:{default:se,navigation:oe},props:!0,children:[{path:":selectedGroup",name:"group"}]},{path:"/:index(index.php/)?settings/apps",name:"apps",redirect:{name:"apps-category",params:{category:"discover"}},components:{default:ee,navigation:te,sidebar:re},children:[{path:":category",name:"apps-category",children:[{path:":id",name:"apps-details"}]}]}];p.use(F);const O=new F({mode:"history",base:l(""),linkActiveClass:"active",routes:ae});var C=(e=>(e[e.UserCount=1]="UserCount",e[e.GroupName=2]="GroupName",e))(C||{});const A=function(e){return e.replace(/\/$/,"")},n={requireAdmin(){return H()},get(e,r){return c.get(A(e),r)},post(e,r){return c.post(A(e),r)},patch(e,r){return c.patch(A(e),r)},put(e,r){return c.put(A(e),r)},delete(e,r){return c.delete(A(e),{params:r})}},h=G("settings").persist(!0).build(),R={group:{id:"",name:"",usercount:0,disabled:0,canAdd:!0,canRemove:!0}},ie={users:[],groups:[],orderBy:C.UserCount,minPasswordLength:0,usersOffset:0,usersLimit:25,disabledUsersOffset:0,disabledUsersLimit:25,userCount:0,showConfig:{showStoragePath:h.getItem("account_settings__showStoragePath")==="true",showUserBackend:h.getItem("account_settings__showUserBackend")==="true",showLastLogin:h.getItem("account_settings__showLastLogin")==="true",showNewUserForm:h.getItem("account_settings__showNewUserForm")==="true",showLanguages:h.getItem("account_settings__showLanguages")==="true"}},ne={appendUsers(e,r){const s=e.users.map(({id:i})=>i),o=Object.values(r).filter(({id:i})=>!s.includes(i)),a=e.users.concat(o);e.usersOffset+=e.usersLimit,e.users=a},updateDisabledUsers(e,r){e.disabledUsersOffset+=e.disabledUsersLimit},setPasswordPolicyMinLength(e,r){e.minPasswordLength=r!==""?r:0},initGroups(e,{groups:r,orderBy:s,userCount:o}){e.groups=r.map(a=>Object.assign({},R.group,a)),e.orderBy=s,e.userCount=o},addGroup(e,{gid:r,displayName:s}){try{if(typeof e.groups.find(a=>a.id===r)<"u")return;const o=Object.assign({},R.group,{id:r,name:s});e.groups.unshift(o)}catch(o){console.error("Can't create group",o)}},renameGroup(e,{gid:r,displayName:s}){const o=e.groups.findIndex(a=>a.id===r);if(o>=0){const a=e.groups[o];a.name=s,e.groups.splice(o,1,a)}},removeGroup(e,r){const s=e.groups.findIndex(o=>o.id===r);s>=0&&e.groups.splice(s,1)},addUserGroup(e,{userid:r,gid:s}){const o=e.groups.find(i=>i.id===s),a=e.users.find(i=>i.id===r);o&&a.enabled&&e.userCount>0&&o.usercount++,a.groups.push(s)},removeUserGroup(e,{userid:r,gid:s}){const o=e.groups.find(d=>d.id===s),a=e.users.find(d=>d.id===r);o&&a.enabled&&e.userCount>0&&o.usercount--;const i=a.groups;i.splice(i.indexOf(s),1)},addUserSubAdmin(e,{userid:r,gid:s}){e.users.find(o=>o.id===r).subadmin.push(s)},removeUserSubAdmin(e,{userid:r,gid:s}){const o=e.users.find(a=>a.id===r).subadmin;o.splice(o.indexOf(s),1)},deleteUser(e,r){const s=e.users.findIndex(o=>o.id===r);this.commit("updateUserCounts",{user:e.users[s],actionType:"remove"}),e.users.splice(s,1)},addUserData(e,r){const s=r.data.ocs.data;e.users.unshift(s),this.commit("updateUserCounts",{user:s,actionType:"create"})},enableDisableUser(e,{userid:r,enabled:s}){const o=e.users.find(a=>a.id===r);o.enabled=s,this.commit("updateUserCounts",{user:o,actionType:s?"enable":"disable"})},updateUserCounts(e,{user:r,actionType:s}){if(e.userCount===0)return;const o=e.groups.find(a=>a.id==="disabled");switch(s){case"enable":case"disable":o.usercount+=r.enabled?-1:1,e.userCount+=r.enabled?1:-1,r.groups.forEach(a=>{const i=e.groups.find(d=>d.id===a);i.disabled+=r.enabled?-1:1});break;case"create":e.userCount++,r.groups.forEach(a=>{e.groups.find(i=>i.id===a).usercount++});break;case"remove":r.enabled?(e.userCount--,r.groups.forEach(a=>{const i=e.groups.find(d=>d.id===a);if(!i){console.warn("User group "+a+" does not exist during user removal");return}i.usercount--})):(o.usercount--,r.groups.forEach(a=>{const i=e.groups.find(d=>d.id===a);i.disabled--}));break;default:v.error("Unknown action type in updateUserCounts: '".concat(s,"'"))}},setUserData(e,{userid:r,key:s,value:o}){if(s==="quota"){const a=$(o,!0);e.users.find(i=>i.id===r)[s][s]=a!==null?a:o}else e.users.find(a=>a.id===r)[s]=o},resetUsers(e){e.users=[],e.usersOffset=0,e.disabledUsersOffset=0},setShowConfig(e,{key:r,value:s}){h.setItem("account_settings__".concat(r),JSON.stringify(s)),e.showConfig[r]=s},setGroupSorting(e,r){const s=e.orderBy;e.orderBy=r,c.post(l("/settings/users/preferences/group.sortBy"),{value:String(r)}).catch(o=>{e.orderBy=s,U(t("settings","Could not set group sorting")),v.error(o)})}},de={getUsers(e){return e.users},getGroups(e){return e.groups},getSubadminGroups(e){return e.groups.filter(r=>r.id!=="admin"&&r.id!=="disabled")},getSortedGroups(e){const r=[...e.groups];return e.orderBy===C.UserCount?r.sort((s,o)=>{const a=s.usercount-s.disabled,i=o.usercount-o.disabled;return a<i?1:i<a?-1:s.name.localeCompare(o.name)}):r.sort((s,o)=>s.name.localeCompare(o.name))},getGroupSorting(e){return e.orderBy},getPasswordPolicyMinLength(e){return e.minPasswordLength},getUsersOffset(e){return e.usersOffset},getUsersLimit(e){return e.usersLimit},getDisabledUsersOffset(e){return e.disabledUsersOffset},getDisabledUsersLimit(e){return e.disabledUsersLimit},getUserCount(e){return e.userCount},getShowConfig(e){return e.showConfig}},ue=c.CancelToken;let I=null;const ce={searchUsers(e,{offset:r,limit:s,search:o}){return o=typeof o=="string"?o:"",n.get(u("cloud/users/details?offset={offset}&limit={limit}&search={search}",{offset:r,limit:s,search:o})).catch(a=>{c.isCancel(a)||e.commit("API_FAILURE",a)})},getUser(e,r){return n.get(u("cloud/users/".concat(r))).catch(s=>{c.isCancel(s)||e.commit("API_FAILURE",s)})},getUsers(e,{offset:r,limit:s,search:o,group:a}){return I&&I.cancel("Operation canceled by another search request."),I=ue.source(),o=typeof o=="string"?o:"",o=o.replace(/in:[^\s]+/g,"").trim(),a=typeof a=="string"?a:"",a!==""?n.get(u("cloud/groups/{group}/users/details?offset={offset}&limit={limit}&search={search}",{group:encodeURIComponent(a),offset:r,limit:s,search:o}),{cancelToken:I.token}).then(i=>{const d=Object.keys(i.data.ocs.data.users).length;return d>0&&e.commit("appendUsers",i.data.ocs.data.users),d}).catch(i=>{c.isCancel(i)||e.commit("API_FAILURE",i)}):n.get(u("cloud/users/details?offset={offset}&limit={limit}&search={search}",{offset:r,limit:s,search:o}),{cancelToken:I.token}).then(i=>{const d=Object.keys(i.data.ocs.data.users).length;return d>0&&e.commit("appendUsers",i.data.ocs.data.users),d}).catch(i=>{c.isCancel(i)||e.commit("API_FAILURE",i)})},async getDisabledUsers(e,{offset:r,limit:s,search:o}){const a=u("cloud/users/disabled?offset={offset}&limit={limit}&search={search}",{offset:r,limit:s,search:o});try{const i=await n.get(a),d=Object.keys(i.data.ocs.data.users).length;return d>0&&(e.commit("appendUsers",i.data.ocs.data.users),e.commit("updateDisabledUsers",i.data.ocs.data.users)),d}catch(i){e.commit("API_FAILURE",i)}},getGroups(e,{offset:r,limit:s,search:o}){o=typeof o=="string"?o:"";const a=s===-1?"":"&limit=".concat(s);return n.get(u("cloud/groups?offset={offset}&search={search}",{offset:r,search:o})+a).then(i=>Object.keys(i.data.ocs.data.groups).length>0?(i.data.ocs.data.groups.forEach(function(d){e.commit("addGroup",{gid:d,displayName:d})}),!0):!1).catch(i=>e.commit("API_FAILURE",i))},getUsersFromList(e,{offset:r,limit:s,search:o}){return o=typeof o=="string"?o:"",n.get(u("cloud/users/details?offset={offset}&limit={limit}&search={search}",{offset:r,limit:s,search:o})).then(a=>Object.keys(a.data.ocs.data.users).length>0?(e.commit("appendUsers",a.data.ocs.data.users),!0):!1).catch(a=>e.commit("API_FAILURE",a))},getUsersFromGroup(e,{groupid:r,offset:s,limit:o}){return n.get(u("cloud/users/{groupId}/details?offset={offset}&limit={limit}",{groupId:encodeURIComponent(r),offset:s,limit:o})).then(a=>e.commit("getUsersFromList",a.data.ocs.data.users)).catch(a=>e.commit("API_FAILURE",a))},getPasswordPolicyMinLength(e){return _().password_policy&&_().password_policy.minLength?(e.commit("setPasswordPolicyMinLength",_().password_policy.minLength),_().password_policy.minLength):!1},addGroup(e,r){return n.requireAdmin().then(s=>n.post(u("cloud/groups"),{groupid:r}).then(o=>(e.commit("addGroup",{gid:r,displayName:r}),{gid:r,displayName:r})).catch(o=>{throw o})).catch(s=>{throw e.commit("API_FAILURE",{gid:r,error:s}),s})},renameGroup(e,{groupid:r,displayName:s}){return n.requireAdmin().then(o=>n.put(u("cloud/groups/{groupId}",{groupId:encodeURIComponent(r)}),{key:"displayname",value:s}).then(a=>(e.commit("renameGroup",{gid:r,displayName:s}),{groupid:r,displayName:s})).catch(a=>{throw a})).catch(o=>{throw e.commit("API_FAILURE",{groupid:r,error:o}),o})},removeGroup(e,r){return n.requireAdmin().then(s=>n.delete(u("cloud/groups/{groupId}",{groupId:encodeURIComponent(r)})).then(o=>e.commit("removeGroup",r)).catch(o=>{throw o})).catch(s=>e.commit("API_FAILURE",{gid:r,error:s}))},addUserGroup(e,{userid:r,gid:s}){return n.requireAdmin().then(o=>n.post(u("cloud/users/{userid}/groups",{userid:r}),{groupid:s}).then(a=>e.commit("addUserGroup",{userid:r,gid:s})).catch(a=>{throw a})).catch(o=>e.commit("API_FAILURE",{userid:r,error:o}))},removeUserGroup(e,{userid:r,gid:s}){return n.requireAdmin().then(o=>n.delete(u("cloud/users/{userid}/groups",{userid:r}),{groupid:s}).then(a=>e.commit("removeUserGroup",{userid:r,gid:s})).catch(a=>{throw a})).catch(o=>{throw e.commit("API_FAILURE",{userid:r,error:o}),o})},addUserSubAdmin(e,{userid:r,gid:s}){return n.requireAdmin().then(o=>n.post(u("cloud/users/{userid}/subadmins",{userid:r}),{groupid:s}).then(a=>e.commit("addUserSubAdmin",{userid:r,gid:s})).catch(a=>{throw a})).catch(o=>e.commit("API_FAILURE",{userid:r,error:o}))},removeUserSubAdmin(e,{userid:r,gid:s}){return n.requireAdmin().then(o=>n.delete(u("cloud/users/{userid}/subadmins",{userid:r}),{groupid:s}).then(a=>e.commit("removeUserSubAdmin",{userid:r,gid:s})).catch(a=>{throw a})).catch(o=>e.commit("API_FAILURE",{userid:r,error:o}))},wipeUserDevices(e,r){return n.requireAdmin().then(s=>n.post(u("cloud/users/{userid}/wipe",{userid:r})).catch(o=>{throw o})).catch(s=>e.commit("API_FAILURE",{userid:r,error:s}))},deleteUser(e,r){return n.requireAdmin().then(s=>n.delete(u("cloud/users/{userid}",{userid:r})).then(o=>e.commit("deleteUser",r)).catch(o=>{throw o})).catch(s=>e.commit("API_FAILURE",{userid:r,error:s}))},addUser({commit:e,dispatch:r},{userid:s,password:o,displayName:a,email:i,groups:d,subadmin:f,quota:m,language:g,manager:S}){return n.requireAdmin().then(L=>n.post(u("cloud/users"),{userid:s,password:o,displayName:a,email:i,groups:d,subadmin:f,quota:m,language:g,manager:S}).then(y=>r("addUserData",s||y.data.ocs.data.id)).catch(y=>{throw y})).catch(L=>{throw e("API_FAILURE",{userid:s,error:L}),L})},addUserData(e,r){return n.requireAdmin().then(s=>n.get(u("cloud/users/{userid}",{userid:r})).then(o=>e.commit("addUserData",o)).catch(o=>{throw o})).catch(s=>e.commit("API_FAILURE",{userid:r,error:s}))},enableDisableUser(e,{userid:r,enabled:s=!0}){const o=s?"enable":"disable";return n.requireAdmin().then(a=>n.put(u("cloud/users/{userid}/{userStatus}",{userid:r,userStatus:o})).then(i=>e.commit("enableDisableUser",{userid:r,enabled:s})).catch(i=>{throw i})).catch(a=>e.commit("API_FAILURE",{userid:r,error:a}))},setUserData(e,{userid:r,key:s,value:o}){const a=["email","displayname","manager"];return["email","language","quota","displayname","password","manager"].indexOf(s)!==-1&&typeof o=="string"&&(a.indexOf(s)===-1&&o.length>0||a.indexOf(s)!==-1)?n.requireAdmin().then(i=>n.put(u("cloud/users/{userid}",{userid:r}),{key:s,value:o}).then(d=>e.commit("setUserData",{userid:r,key:s,value:o})).catch(d=>{throw d})).catch(i=>e.commit("API_FAILURE",{userid:r,error:i})):Promise.reject(new Error("Invalid request data"))},sendWelcomeMail(e,r){return n.requireAdmin().then(s=>n.post(u("cloud/users/{userid}/welcome",{userid:r})).then(o=>!0).catch(o=>{throw o})).catch(s=>e.commit("API_FAILURE",{userid:r,error:s}))}},pe={state:ie,mutations:ne,getters:de,actions:ce},me={apps:[],bundles:w("settings","appstoreBundles",[]),categories:[],updateCount:w("settings","appstoreUpdateCount",0),loading:{},gettingCategoriesPromise:null},le={APPS_API_FAILURE(e,r){U(t("settings","An error occurred during the request. Unable to proceed.")+"<br>"+r.error.response.data.data.message,{isHTML:!0}),console.error(e,r)},initCategories(e,{categories:r,updateCount:s}){e.categories=r,e.updateCount=s},updateCategories(e,r){e.gettingCategoriesPromise=r},setUpdateCount(e,r){e.updateCount=r},addCategory(e,r){e.categories.push(r)},appendCategories(e,r){e.categories=r},setAllApps(e,r){e.apps=r},setError(e,{appId:r,error:s}){Array.isArray(r)||(r=[r]),r.forEach(o=>{const a=e.apps.find(i=>i.id===o);a.error=s})},clearError(e,{appId:r,error:s}){const o=e.apps.find(a=>a.id===r);o.error=null},enableApp(e,{appId:r,groups:s}){const o=e.apps.find(a=>a.id===r);o.active=!0,o.groups=s},setInstallState(e,{appId:r,canInstall:s}){const o=e.apps.find(a=>a.id===r);o&&(o.canInstall=s===!0)},disableApp(e,r){const s=e.apps.find(o=>o.id===r);s.active=!1,s.groups=[],s.removable&&(s.canUnInstall=!0)},uninstallApp(e,r){e.apps.find(s=>s.id===r).active=!1,e.apps.find(s=>s.id===r).groups=[],e.apps.find(s=>s.id===r).needsDownload=!0,e.apps.find(s=>s.id===r).installed=!1,e.apps.find(s=>s.id===r).canUnInstall=!1,e.apps.find(s=>s.id===r).canInstall=!0},updateApp(e,r){const s=e.apps.find(a=>a.id===r),o=s.update;s.update=null,s.version=o,e.updateCount--},resetApps(e){e.apps=[]},reset(e){e.apps=[],e.categories=[],e.updateCount=0},startLoading(e,r){Array.isArray(r)?r.forEach(s=>{p.set(e.loading,s,!0)}):p.set(e.loading,r,!0)},stopLoading(e,r){Array.isArray(r)?r.forEach(s=>{p.set(e.loading,s,!1)}):p.set(e.loading,r,!1)}},ge={loading(e){return function(r){return e.loading[r]}},getCategories(e){return e.categories},getAllApps(e){return e.apps},getAppBundles(e){return e.bundles},getUpdateCount(e){return e.updateCount},getCategoryById:e=>r=>e.categories.find(s=>s.id===r)},he={enableApp(e,{appId:r,groups:s}){let o;return Array.isArray(r)?o=r:o=[r],n.requireAdmin().then(a=>(e.commit("startLoading",o),e.commit("startLoading","install"),n.post(l("settings/apps/enable"),{appIds:o,groups:s}).then(i=>(e.commit("stopLoading",o),e.commit("stopLoading","install"),o.forEach(d=>{e.commit("enableApp",{appId:d,groups:s})}),n.get(l("apps/files/")).then(()=>{i.data.update_required&&(V(t("settings","The app has been enabled but needs to be updated. You will be redirected to the update page in 5 seconds."),{onClick:()=>window.location.reload(),close:!1}),setTimeout(function(){location.reload()},5e3))}).catch(()=>{Array.isArray(r)||(U(t("settings","Error: This app cannot be enabled because it makes the server unstable")),e.commit("setError",{appId:o,error:t("settings","Error: This app cannot be enabled because it makes the server unstable")}),e.dispatch("disableApp",{appId:r}))}))).catch(i=>{e.commit("stopLoading",o),e.commit("stopLoading","install"),e.commit("setError",{appId:o,error:i.response.data.data.message}),e.commit("APPS_API_FAILURE",{appId:r,error:i})}))).catch(a=>e.commit("API_FAILURE",{appId:r,error:a}))},forceEnableApp(e,{appId:r,groups:s}){let o;return Array.isArray(r)?o=r:o=[r],n.requireAdmin().then(()=>(e.commit("startLoading",o),e.commit("startLoading","install"),n.post(l("settings/apps/force"),{appId:r}).then(a=>{e.commit("setInstallState",{appId:r,canInstall:!0})}).catch(a=>{e.commit("stopLoading",o),e.commit("stopLoading","install"),e.commit("setError",{appId:o,error:a.response.data.data.message}),e.commit("APPS_API_FAILURE",{appId:r,error:a})}).finally(()=>{e.commit("stopLoading",o),e.commit("stopLoading","install")}))).catch(a=>e.commit("API_FAILURE",{appId:r,error:a}))},disableApp(e,{appId:r}){let s;return Array.isArray(r)?s=r:s=[r],n.requireAdmin().then(o=>(e.commit("startLoading",s),n.post(l("settings/apps/disable"),{appIds:s}).then(a=>(e.commit("stopLoading",s),s.forEach(i=>{e.commit("disableApp",i)}),!0)).catch(a=>{e.commit("stopLoading",s),e.commit("APPS_API_FAILURE",{appId:r,error:a})}))).catch(o=>e.commit("API_FAILURE",{appId:r,error:o}))},uninstallApp(e,{appId:r}){return n.requireAdmin().then(s=>(e.commit("startLoading",r),n.get(l("settings/apps/uninstall/".concat(r))).then(o=>(e.commit("stopLoading",r),e.commit("uninstallApp",r),!0)).catch(o=>{e.commit("stopLoading",r),e.commit("APPS_API_FAILURE",{appId:r,error:o})}))).catch(s=>e.commit("API_FAILURE",{appId:r,error:s}))},updateApp(e,{appId:r}){return n.requireAdmin().then(s=>(e.commit("startLoading",r),e.commit("startLoading","install"),n.get(l("settings/apps/update/".concat(r))).then(o=>(e.commit("stopLoading","install"),e.commit("stopLoading",r),e.commit("updateApp",r),!0)).catch(o=>{e.commit("stopLoading",r),e.commit("stopLoading","install"),e.commit("APPS_API_FAILURE",{appId:r,error:o})}))).catch(s=>e.commit("API_FAILURE",{appId:r,error:s}))},getAllApps(e){return e.commit("startLoading","list"),n.get(l("settings/apps/list")).then(r=>(e.commit("setAllApps",r.data.apps),e.commit("stopLoading","list"),!0)).catch(r=>e.commit("API_FAILURE",r))},async getCategories(e,{shouldRefetchCategories:r=!1}={}){if(r||!e.state.gettingCategoriesPromise){e.commit("startLoading","categories");try{const s=n.get(l("settings/apps/categories"));e.commit("updateCategories",s);const o=await s;return o.data.length>0?(e.commit("appendCategories",o.data),e.commit("stopLoading","categories"),!0):(e.commit("stopLoading","categories"),!1)}catch(s){e.commit("API_FAILURE",s)}}return e.state.gettingCategoriesPromise}},fe={state:me,mutations:le,getters:ge,actions:he},Ae={serverData:w("settings","usersSettings",{})},Ie={setServerData(e,r){e.serverData=r}},Ue={getServerData(e){return e.serverData}},be={},_e={state:Ae,mutations:Ie,getters:Ue,actions:be},Le={},ye={},Pe={},we={setAppConfig(e,{app:r,key:s,value:o}){return n.requireAdmin().then(a=>n.post(u("apps/provisioning_api/api/v1/config/apps/{app}/{key}",{app:r,key:s}),{value:o}).catch(i=>{throw i})).catch(a=>e.commit("API_FAILURE",{app:r,key:s,value:o,error:a}))}},Ee={state:Le,mutations:ye,getters:Pe,actions:we};p.use(j);const Ce=!1,ve={API_FAILURE(e,r){try{const s=r.error.response.data.ocs.meta.message;U(t("settings","An error occurred during the request. Unable to proceed.")+"<br>"+s,{isHTML:!0})}catch{U(t("settings","An error occurred during the request. Unable to proceed."))}console.error(e,r)}};let P=null;const Re=()=>(P===null&&(P=new M({modules:{users:pe,apps:fe,settings:_e,oc:Ee},strict:Ce,mutations:ve})),P);p.use(x,{defaultHtml:!1});const q=Re();W(q,O),p.prototype.t=N,p.prototype.n=T,p.use(z);const Fe=J(),Ke=new p({router:O,store:q,pinia:Fe,render:e=>e(X),el:"#content"});export{C as G,Ke as default,Re as u};
|