2024-03-21 18:41:26 +01:00
|
|
|
|
import{_ as q}from"./AdminTabs-7af3858b.js";import{a4 as B,R as A,r as b,e as g,f as _,g as f,h as n,n as F,i as s,t as u,m as i,p as I,j as C,l as M,U as J,Q as K,a as P,b as E,a2 as X,a0 as Y,o as Z,I as $,F as ee,G as se}from"./app-2d89b28f.js";import{_ as te}from"./CopyButton-7a25d704.js";/*! 2FAuth version 5.1.1 - Copyright (c) 2023 Bubka - https://github.com/Bubka/2FAuth */const w=B("api"),U={get(r={}){return w.get("/settings",{...r})},update(r,p){return w.put("/settings/"+r,{value:p})},delete(r,p={}){return w.delete("/settings/"+r,{...p})}},S=B("web"),L={getSystemInfos(r={}){return S.get("system/infos",{...r})},getLastRelease(r={}){return S.get("system/latestRelease",{...r})},sendTestEmail(r={}){return S.post("system/test-email",{...r})},clearCache(r={}){return S.get("system/clear-cache",{...r})},optimize(r={}){return S.get("system/optimize",{...r})}},le={class:"columns is-mobile is-vcentered"},ne={class:"column is-narrow"},ae={class:"column"},oe=n("span",{class:"release-flag"},null,-1),ie={class:"is-size-7",href:"https://github.com/Bubka/2FAuth/releases"},re={key:1,class:"has-text-grey"},de={key:2,class:"has-text-grey"},ue={__name:"VersionChecker",setup(r){const p=A(),k=b(!1),m=b();async function a(){k.value=!0,m.value=void 0,await L.getLastRelease({returnError:!0}).then(c=>{p.latestRelease=c.data.newRelease,m.value=c.data.newRelease===null?null:c.data.newRelease===!1}).catch(()=>{m.value=null}),k.value=!1}return(c,y)=>{const R=g("FontAwesomeIcon");return _(),f("div",le,[n("div",ne,[n("button",{type:"button",class:F([s(k)?"is-loading":"","button is-link is-rounded is-small"]),onClick:a},u(c.$t("admin.check_now")),3)]),n("div",ae,[i(s(J),null,{default:I(({mode:V})=>[s(p).latestRelease?(_(),f("span",{key:0,class:F(["mt-2",V=="dark"?"has-text-warning":"has-text-warning-dark"])},[oe,C(u(c.$t("admin.x_is_available",{version:s(p).latestRelease}))+" ",1),n("a",ie,u(c.$t("admin.view_on_github")),1)],2)):M("",!0),s(m)?(_(),f("span",re,[i(R,{icon:["fas","check"],class:"mr-1 has-text-success"}),C(" "+u(c.$t("commons.you_are_up_to_date")),1)])):s(m)===null?(_(),f("span",de,[i(R,{icon:["fas","times"],class:"mr-1 has-text-danger"}),C(u(c.$t("errors.check_failed_try_later")),1)])):M("",!0)]),_:1})])])}}},ce={class:"options-tabs"},me={class:"title is-4 pt-4 has-text-grey-light"},pe={class:"field"},_e=["innerHTML"],fe=["innerHTML"],be=["innerHTML"],he={class:"columns is-mobile is-vcentered"},ge={class:"column is-narrow"},ye={class:"icon is-small"},ve={class:"title is-4 pt-4 has-text-grey-light"},ke={class:"title is-4 pt-4 has-text-grey-light"},Re={class:"title is-4 pt-5 has-text-grey-light"},Ve={class:"field"},Se=["innerHTML"],Ee=["innerHTML"],$e={class:"field mb-5 is-grouped"},Ce={class:"control"},Le={class:"field"},Fe=["innerHTML"],Te={key:0,class:"about-debug box is-family-monospace is-size-7"},we=["value"],Ue={class:"has-text-grey"},Ie={key:1,class:"about-debug box is-family-monospace is-size-7 has-text-warning-dark"},xe={__name:"AppSetup",setup(r){const p=K("2fauth"),k=P(),m=E(),a=A(),c=X(p.prefix+"returnTo","accounts"),y=b(),R=b(null),V=b(!1),T=b(!1),v=b({restrictList:null,restrictRule:null}),o=b({checkForUpdate:a.checkForUpdate,useEncryption:a.useEncryption,restrictRegistration:a.restrictRegistration,restrictList:a.restrictList,restrictRule:a.restrictRule,disableRegistration:a.disableRegistration,keepSsoRegistrationEnabled:a.keepSsoRegistrationEnabled,enableSso:a.enableSso});function h(l,e){v.value[l]=null,U.update(l,e).then(d=>{a[l]=e,E().success({type:"is-success",text:$("settings.forms.setting_saved")})}).catch(d=>{d.response.status===422?v.value[l]=d.response.data.message:m.error(d)})}function N(l,e){e==""?(v.value[l]=null,U.delete(l,{returnError:!0}).then(d=>{a[l]="",E().success({type:"is-success",text:$("settings.forms.setting_saved")})}).catch(d=>{d.response.status!==404&&m.error(d)})):h(l,e)}function z(){V.value=!0,L.sendTestEmail().finally(()=>{V.value=!1})}function W(){T.value=!0,L.clearCache().then(l=>{E().success({type:"is-success",text:$("admin.cache_cleared")})}).finally(()=>{T.value=!1})}return Y(l=>{l.nam
|