2FAuth/public/build/assets/Options-dd7b5ac3.js

2 lines
12 KiB
JavaScript
Raw Normal View History

2023-12-21 08:54:46 +01:00
import{_ as G}from"./SettingTabs-52d14fa3.js";import{u as E}from"./userService-5f2b5050.js";import{a1 as L,Q as A,r as k,e as m,f as c,g as _,h as r,n as Q,i as t,j as b,t as p,l as x,m as l,P as j,a as z,S as W,b as w,a2 as H,v as J,o as K,$ as X,p as D,I as N,a3 as Y}from"./app-1b332c21.js";import{s as Z}from"./systemService-aca7a2d9.js";/*! 2FAuth version 5.0.0 - Copyright (c) 2023 Bubka - https://github.com/Bubka/2FAuth */const ee=L("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:Q([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"},Ce={__name:"Options",setup(y){const d=j("2fauth"),o=z(),f=W(),O=w(),i=A(),U=H(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"}],$=[{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"}],F=[{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});K(()=>{f.items.forEach(n=>{n.id>0&&C.value.push({text:n.name,value:n.id})})});function a(n,e){E.updatePreference(n,e).then(g=>{w().success