2FAuth/public/build/assets/Options-1f90b0a9.js

2 lines
12 KiB
JavaScript
Raw Normal View History

2024-02-23 15:31:08 +01:00
import{_ as G}from"./SettingTabs-485a4095.js";import{a2 as E,R as A,r as k,e as m,f as c,g as _,h as r,n as L,i as t,j as b,t as p,l as x,m as l,Q,a as j,T as z,b as w,a3 as W,v as J,o as H,a0 as K,p as D,J as X,I as N,a4 as Y}from"./app-06176200.js";import{s as Z}from"./systemService-c73db55d.js";/*! 2FAuth version 5.0.4 - Copyright (c) 2023 Bubka - https://github.com/Bubka/2FAuth */const ee=E("api"),se={update(y,d){return ee.put("/settings/"+y,{value:d})}},te={class:"columns is-mobile is-vcentered"},oe={class:"column is-narrow"},le={class:"column"},ne={key:0,class:"mt-2 has-text-warning"},ae=r("span",{class:"release-flag"},null,-1),re=r("a",{class:"is-size-7",href:"https://github.com/Bubka/2FAuth/releases"},"View on Github",-1),ie={key:1,class:"has-text-grey"},ue={key:2,class:"has-text-grey"},pe={__name:"VersionChecker",setup(y){const d=A(),o=k(!1),f=k();async function O(){o.value=!0,f.value=void 0,await Z.getLastRelease({returnError:!0}).then(i=>{d.latestRelease=i.data.newRelease,f.value=i.data.newRelease===null?null:i.data.newRelease===!1}).catch(()=>{f.value=null}),o.value=!1}return(i,U)=>{const v=m("FontAwesomeIcon");return c(),_("div",te,[r("div",oe,[r("button",{type:"button",class:L([t(o)?"is-loading":"","button is-link is-rounded is-small"]),onClick:O},"Check now",2)]),r("div",le,[t(d).latestRelease?(c(),_("span",ne,[ae,b(p(t(d).latestRelease)+" is available ",1),re])):x("",!0),t(f)?(c(),_("span",ie,[l(v,{icon:["fas","check"],class:"mr-1 has-text-success"}),b(" "+p(i.$t("commons.you_are_up_to_date")),1)])):t(f)===null?(c(),_("span",ue,[l(v,{icon:["fas","times"],class:"mr-1 has-text-danger"}),b(p(i.$t("errors.check_failed_try_later")),1)])):x("",!0)])])}}},de={class:"options-tabs"},me={class:"block"},fe={class:"title is-4 has-text-grey-light"},ge={class:"field help"},ce={class:"ml-2",href:"https://crowdin.com/project/2fauth"},_e={class:"title is-4 pt-4 has-text-grey-light"},be={class:"title is-4 pt-4 has-text-grey-light"},ve={class:"title is-4 pt-4 has-text-grey-light"},Ve={key:0},he={class:"title is-4 pt-4 has-text-grey-light"},ye={class:"is-size-7-mobile block has-text-grey"},Oe={class:"mb-2"},Ue={__name:"Options",setup(y){const d=Q("2fauth"),o=j(),f=z(),O=w(),i=A(),U=W(d.prefix+"returnTo","accounts"),v=[{text:"settings.forms.grid",value:"grid",icon:"th"},{text:"settings.forms.list",value:"list",icon:"list"}],R=[{text:"settings.forms.light",value:"light",icon:"sun"},{text:"settings.forms.dark",value:"dark",icon:"moon"},{text:"settings.forms.automatic",value:"system",icon:"desktop"}],F=[{text:"12 34 56",value:2,legend:"settings.forms.pair",title:"settings.forms.pair_legend"},{text:"123 456",value:3,legend:"settings.forms.trio",title:"settings.forms.trio_legend"},{text:"1234 5678",value:.5,legend:"settings.forms.half",title:"settings.forms.half_legend"}],$=[{text:"settings.forms.never",value:0},{text:"settings.forms.on_otp_copy",value:-1},{text:"settings.forms.1_minutes",value:1},{text:"settings.forms.5_minutes",value:5},{text:"settings.forms.10_minutes",value:10},{text:"settings.forms.15_minutes",value:15},{text:"settings.forms.30_minutes",value:30},{text:"settings.forms.1_hour",value:60},{text:"settings.forms.1_day",value:1440}],C=k([{text:"groups.no_group",value:0},{text:"groups.active_group",value:-1}]),S=[{text:"settings.forms.livescan",value:"livescan"},{text:"settings.forms.upload",value:"upload"},{text:"settings.forms.advanced_form",value:"advancedForm"}],B=[{text:"settings.forms.otp_generation_on_request",value:!0,legend:"settings.forms.otp_generation_on_request_legend",title:"settings.forms.otp_generation_on_request_title"},{text:"settings.forms.otp_generation_on_home",value:!1,legend:"settings.forms.otp_generation_on_home_legend",title:"settings.forms.otp_generation_on_home_title"}],I=J(()=>{let n=[{text:"languages.browser_preference",value:"browser"}];for(const e of d.langs)n.push({text:"languages."+e,value:e});return n});H(()=>{f.items.forEach(n=>{n.id>0&&C.value.push({text:n.name,value:n.id})}),o.refreshPreferences()});function a(n,e){X.updatePreference(n,e).then(g=>{w().success({type:"is-success",