mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-12 10:10:59 +01:00
2 lines
6.3 KiB
JavaScript
Vendored
2 lines
6.3 KiB
JavaScript
Vendored
import{_ as D}from"./AdminTabs-Bc7uXBY-.js";import{a3 as P,R as S,r as f,l as p,m as u,d,e,n as T,f as s,t as n,j as o,k as F,g as k,i as M,U as W,u as j,a as V,a1 as q,a0 as G,o as J,L as K,F as O,E as Q,H as X}from"./app-D4Udf6Mm.js";import{u as w}from"./appSettingsUpdater-B1wtRdsR.js";import{_ as Y}from"./CopyButton-CNDtpSH2.js";/*! 2FAuth version 5.4.1 - Copyright (c) 2024 Bubka - https://github.com/Bubka/2FAuth */const v=P("web"),$={getSystemInfos(i={}){return v.get("system/infos",{...i})},getLastRelease(i={}){return v.get("system/latestRelease",{...i})},sendTestEmail(i={}){return v.post("system/test-email",{...i})},clearCache(i={}){return v.get("system/clear-cache",{...i})},optimize(i={}){return v.get("system/optimize",{...i})}},Z={class:"columns is-mobile is-vcentered"},ee={class:"column is-narrow"},se={class:"column"},te=e("span",{class:"release-flag"},null,-1),ne={class:"is-size-7",href:"https://github.com/Bubka/2FAuth/releases"},ae={key:1,class:"has-text-grey"},oe={key:2,class:"has-text-grey"},le={__name:"VersionChecker",setup(i){const m=S(),b=f(!1),_=f();async function c(){b.value=!0,_.value=void 0,await $.getLastRelease({returnError:!0}).then(r=>{m.latestRelease=r.data.newRelease,_.value=r.data.newRelease===null?null:r.data.newRelease===!1}).catch(()=>{_.value=null}),b.value=!1}return(r,h)=>{const g=p("FontAwesomeIcon");return u(),d("div",Z,[e("div",ee,[e("button",{type:"button",class:T([s(b)?"is-loading":"","button is-link is-rounded is-small"]),onClick:c},n(r.$t("admin.check_now")),3)]),e("div",se,[o(s(W),null,{default:F(({mode:y})=>[s(m).latestRelease?(u(),d("span",{key:0,class:T(["mt-2",y=="dark"?"has-text-warning":"has-text-warning-dark"])},[te,k(n(r.$t("admin.x_is_available",{version:s(m).latestRelease}))+" ",1),e("a",ne,n(r.$t("admin.view_on_github")),1)],2)):M("",!0),s(_)?(u(),d("span",ae,[o(g,{icon:["fas","check"],class:"mr-1 has-text-success"}),k(" "+n(r.$t("commons.you_are_up_to_date")),1)])):s(_)===null?(u(),d("span",oe,[o(g,{icon:["fas","times"],class:"mr-1 has-text-danger"}),k(n(r.$t("errors.check_failed_try_later")),1)])):M("",!0)]),_:1})])])}}},ie={class:"options-tabs"},re={class:"title is-4 pt-4 has-text-grey-light"},ce={class:"field"},ue=["innerHTML"],de=["innerHTML"],me=["innerHTML"],_e={class:"columns is-mobile is-vcentered"},he={class:"column is-narrow"},pe={class:"icon is-small"},fe={class:"field"},be=["innerHTML"],ge=["innerHTML"],ye={class:"title is-4 pt-5 has-text-grey-light"},ve={class:"title is-4 pt-5 has-text-grey-light"},ke={class:"title is-4 pt-5 has-text-grey-light"},$e={class:"field"},Te=["innerHTML"],Ce=["innerHTML"],Le={class:"field mb-5 is-grouped"},we={class:"control"},Fe={class:"field"},Me=["innerHTML"],He={key:0,class:"about-debug box is-family-monospace is-size-7"},Ie=["value"],Ve={class:"has-text-grey"},Se={key:1,class:"about-debug box is-family-monospace is-size-7 has-text-warning-dark"},Ae={__name:"AppSetup",setup(i){const m=K("2fauth"),b=j(),_=V(),c=S(),r=q(m.prefix+"returnTo","accounts"),h=f(),g=f(null),y=f(!1),C=f(!1),E=m.config.subdirectory+"/up",R=location.hostname+m.config.subdirectory+"/up";function U(){y.value=!0,$.sendTestEmail().finally(()=>{y.value=!1})}function B(){C.value=!0,$.clearCache().then(t=>{V().success({type:"is-success",text:X("admin.cache_cleared")})}).finally(()=>{C.value=!1})}return G(t=>{t.name.startsWith("admin.")||_.clear()}),J(async()=>{await c.fetch(),$.getSystemInfos({returnError:!0}).then(t=>{h.value=t.data.common}).catch(()=>{h.value=null})}),(t,l)=>{const L=p("FormCheckbox"),A=p("FontAwesomeIcon"),N=p("FormWrapper"),x=p("ButtonBackCloseCancel"),z=p("VueFooter");return u(),d("div",null,[o(D,{activeTab:"admin.appSetup"}),e("div",ie,[o(N,null,{default:F(()=>{var H;return[e("form",null,[e("h4",re,n(t.$t("settings.general")),1),o(L,{modelValue:s(c).checkForUpdate,"onUpdate:modelValue":[l[0]||(l[0]=a=>s(c).checkForUpdate=a),l[1]||(l[1]=a=>s(w)("checkForUpdate",a))],fieldName:"checkForUpdate",label:"commons.check_for_update",help:"commons.check_for_update_help"},null,8,["modelValue"]),o(le),e("div",ce,[e("label",{class:"label",innerHTML:t.$t("admin.forms.test_email.label")},null,8,ue),e("p",{class:"help",innerHTML:t.$t("admin.forms.test_email.help")},null,8,de),e("p",{class:"help",innerHTML:t.$t("admin.forms.test_email.email_will_be_send_to_x",{email:s(b).email})},null,8,me)]),e("div",_e,[e("div",he,[e("button",{type:"button",class:T([s(y)?"is-loading":"","button is-link is-rounded is-small"]),onClick:U},[e("span",pe,[o(A,{icon:["far","paper-plane"]})]),e("span",null,n(t.$t("commons.send")),1)],2)])]),e("div",fe,[e("label",{class:"label",innerHTML:t.$t("admin.forms.health_endpoint.label")},null,8,be),e("p",{class:"help",innerHTML:t.$t("admin.forms.health_endpoint.help")},null,8,ge)]),e("div",{class:"field mb-5"},[e("a",{target:"_blank",href:E},n(R))]),e("h4",ye,n(t.$t("admin.storage")),1),o(L,{modelValue:s(c).storeIconsInDatabase,"onUpdate:modelValue":[l[2]||(l[2]=a=>s(c).storeIconsInDatabase=a),l[3]||(l[3]=a=>s(w)("storeIconsInDatabase",a))],fieldName:"storeIconsInDatabase",label:"admin.forms.store_icon_to_database.label",help:"admin.forms.store_icon_to_database.help"},null,8,["modelValue"]),e("h4",ve,n(t.$t("settings.security")),1),o(L,{modelValue:s(c).useEncryption,"onUpdate:modelValue":[l[4]||(l[4]=a=>s(c).useEncryption=a),l[5]||(l[5]=a=>s(w)("useEncryption",a))],fieldName:"useEncryption",label:"admin.forms.use_encryption.label",help:"admin.forms.use_encryption.help"},null,8,["modelValue"])]),e("h4",ke,n(t.$t("commons.environment")),1),e("div",$e,[e("label",{class:"label",innerHTML:t.$t("admin.forms.cache_management.label")},null,8,Te),e("p",{class:"help",innerHTML:t.$t("admin.forms.cache_management.help")},null,8,Ce)]),e("div",Le,[e("p",we,[e("button",{type:"button",class:T([s(C)?"is-loading":"","button is-link is-rounded is-small"]),onClick:B},n(t.$t("commons.clear")),3)])]),e("div",Fe,[e("label",{class:"label",innerHTML:t.$t("admin.variables")},null,8,Me)]),s(h)?(u(),d("div",He,[o(Y,{id:"btnCopyEnvVars",token:(H=s(g))==null?void 0:H.innerText},null,8,["token"]),e("ul",{ref_key:"listInfos",ref:g,id:"listInfos"},[(u(!0),d(O,null,Q(s(h),(a,I)=>(u(),d("li",{value:a,key:I},[e("b",null,n(I),1),k(": "),e("span",Ve,n(a),1)],8,Ie))),128))],512)])):s(h)===null?(u(),d("div",Se,n(t.$t("errors.error_during_data_fetching")),1)):M("",!0)]}),_:1})]),o(z,{showButtons:!0},{default:F(()=>[o(x,{returnTo:{name:s(r)},action:"close"},null,8,["returnTo"])]),_:1})])}}};export{Ae as default};
|