mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-12-11 09:40:43 +01:00
2 lines
12 KiB
JavaScript
Vendored
2 lines
12 KiB
JavaScript
Vendored
import{_ as G}from"./SettingTabs-fbf19fde.js";import{u as E}from"./userService-d2ada2ab.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-72c44b80.js";import{s as Z}from"./systemService-fd2a8274.js";/*! 2FAuth version 5.0.3 - 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({type:"is-success",text:N("settings.forms.setting_saved")}),n==="lang"&&Y()!==e?o.applyLanguage():n==="theme"&&o.applyTheme()})}function V(n,e){se.update(n,e).then(g=>{w().success({type:"is-success",text:N("settings.forms.setting_saved")})})}return X(n=>{n.name.startsWith("settings.")||O.clear()}),(n,e)=>{const g=m("FormSelect"),P=m("FontAwesomeIcon"),h=m("FormToggle"),u=m("FormCheckbox"),T=m("FormWrapper"),M=m("ButtonBackCloseCancel"),q=m("VueFooter");return c(),_("div",null,[l(G,{activeTab:"settings.options"}),r("div",de,[l(T,null,{default:D(()=>[r("form",null,[r("div",me,[r("h4",fe,p(n.$t("settings.general")),1),l(g,{modelValue:t(o).preferences.lang,"onUpdate:modelValue":[e[0]||(e[0]=s=>t(o).preferences.lang=s),e[1]||(e[1]=s=>a("lang",s))],options:t(I),fieldName:"lang",label:"settings.forms.language.label",help:"settings.forms.language.help"},null,8,["modelValue","options"]),r("div",ge,[b(p(n.$t("settings.forms.some_translation_are_missing"))+" ",1),r("a",ce,[b(p(n.$t("settings.forms.help_translate_2fauth"))+" ",1),l(P,{icon:["fas","external-link-alt"]})])]),l(h,{modelValue:t(o).preferences.displayMode,"onUpdate:modelValue":[e[2]||(e[2]=s=>t(o).preferences.displayMode=s),e[3]||(e[3]=s=>a("displayMode",s))],choices:v,fieldName:"displayMode",label:"settings.forms.display_mode.label",help:"settings.forms.display_mode.help"},null,8,["modelValue"]),l(h,{modelValue:t(o).preferences.theme,"onUpdate:modelValue":[e[4]||(e[4]=s=>t(o).preferences.theme=s),e[5]||(e[5]=s=>a("theme",s))],choices:R,fieldName:"theme",label:"settings.forms.theme.label",help:"settings.forms.theme.help"},null,8,["modelValue"]),l(u,{modelValue:t(o).preferences.showAccountsIcons,"onUpdate:modelValue":[e[6]||(e[6]=s=>t(o).preferences.showAccountsIcons=s),e[7]||(e[7]=s=>a("showAccountsIcons",s))],fieldName:"showAccountsIcons",label:"settings.forms.show_accounts_icons.label",help:"settings.forms.show_accounts_icons.help"},null,8,["modelValue"]),l(u,{modelValue:t(o).preferences.getOfficialIcons,"onUpdate:modelValue":[e[8]||(e[8]=s=>t(o).preferences.getOfficialIcons=s),e[9]||(e[9]=s=>a("getOfficialIcons",s))],fieldName:"getOfficialIcons",label:"settings.forms.get_official_icons.label",help:"settings.forms.get_official_icons.help"},null,8,["modelValue"]),l(u,{modelValue:t(o).preferences.formatPassword,"onUpdate:modelValue":[e[10]||(e[10]=s=>t(o).preferences.formatPassword=s),e[11]||(e[11]=s=>a("formatPassword",s))],fieldName:"formatPassword",label:"settings.forms.password_format.label",help:"settings.forms.password_format.help"},null,8,["modelValue"]),l(h,{modelValue:t(o).preferences.formatPasswordBy,"onUpdate:modelValue":[e[12]||(e[12]=s=>t(o).preferences.formatPasswordBy=s),e[13]||(e[13]=s=>a("formatPasswordBy",s))],choices:$,fieldName:"formatPasswordBy",isDisabled:!t(o).preferences.formatPassword},null,8,["modelValue","isDisabled"]),r("h4",_e,p(n.$t("groups.groups")),1),l(g,{modelValue:t(o).preferences.defaultGroup,"onUpdate:modelValue":[e[14]||(e[14]=s=>t(o).preferences.defaultGroup=s),e[15]||(e[15]=s=>a("defaultGroup",s))],options:t(C),fieldName:"defaultGroup",label:"settings.forms.default_group.label",help:"settings.forms.default_group.help"},null,8,["modelValue","options"]),l(u,{modelValue:t(o).preferences.rememberActiveGroup,"onUpdate:modelValue":[e[16]||(e[16]=s=>t(o).preferences.rememberActiveGroup=s),e[17]||(e[17]=s=>a("rememberActiveGroup",s))],fieldName:"rememberActiveGroup",label:"settings.forms.remember_active_group.label",help:"settings.forms.remember_active_group.help"},null,8,["modelValue"]),r("h4",be,p(n.$t("settings.security")),1),l(g,{modelValue:t(o).preferences.kickUserAfter,"onUpdate:modelValue":[e[18]||(e[18]=s=>t(o).preferences.kickUserAfter=s),e[19]||(e[19]=s=>a("kickUserAfter",s))],options:F,fieldName:"kickUserAfter",label:"settings.forms.auto_lock.label",help:"settings.forms.auto_lock.help"},null,8,["modelValue"]),l(h,{modelValue:t(o).preferences.getOtpOnRequest,"onUpdate:modelValue":[e[20]||(e[20]=s=>t(o).preferences.getOtpOnRequest=s),e[21]||(e[21]=s=>a("getOtpOnRequest",s))],choices:B,fieldName:"getOtpOnRequest",label:"settings.forms.otp_generation.label",help:"settings.forms.otp_generation.help"},null,8,["modelValue"]),l(u,{modelValue:t(o).preferences.closeOtpOnCopy,"onUpdate:modelValue":[e[22]||(e[22]=s=>t(o).preferences.closeOtpOnCopy=s),e[23]||(e[23]=s=>a("closeOtpOnCopy",s))],fieldName:"closeOtpOnCopy",label:"settings.forms.close_otp_on_copy.label",help:"settings.forms.close_otp_on_copy.help",isDisabled:!t(o).preferences.getOtpOnRequest,isIndented:!0},null,8,["modelValue","isDisabled"]),l(u,{modelValue:t(o).preferences.copyOtpOnDisplay,"onUpdate:modelValue":[e[24]||(e[24]=s=>t(o).preferences.copyOtpOnDisplay=s),e[25]||(e[25]=s=>a("copyOtpOnDisplay",s))],fieldName:"copyOtpOnDisplay",label:"settings.forms.copy_otp_on_display.label",help:"settings.forms.copy_otp_on_display.help",isDisabled:!t(o).preferences.getOtpOnRequest,isIndented:!0},null,8,["modelValue","isDisabled"]),l(u,{modelValue:t(o).preferences.showOtpAsDot,"onUpdate:modelValue":[e[26]||(e[26]=s=>t(o).preferences.showOtpAsDot=s),e[27]||(e[27]=s=>a("showOtpAsDot",s))],fieldName:"showOtpAsDot",label:"settings.forms.show_otp_as_dot.label",help:"settings.forms.show_otp_as_dot.help"},null,8,["modelValue"]),l(u,{modelValue:t(o).preferences.revealDottedOTP,"onUpdate:modelValue":[e[28]||(e[28]=s=>t(o).preferences.revealDottedOTP=s),e[29]||(e[29]=s=>a("revealDottedOTP",s))],fieldName:"revealDottedOTP",label:"settings.forms.reveal_dotted_otp.label",help:"settings.forms.reveal_dotted_otp.help",isDisabled:!t(o).preferences.showOtpAsDot,isIndented:!0},null,8,["modelValue","isDisabled"]),r("h4",ve,p(n.$t("settings.data_input")),1),l(u,{modelValue:t(o).preferences.useBasicQrcodeReader,"onUpdate:modelValue":[e[30]||(e[30]=s=>t(o).preferences.useBasicQrcodeReader=s),e[31]||(e[31]=s=>a("useBasicQrcodeReader",s))],fieldName:"useBasicQrcodeReader",label:"settings.forms.use_basic_qrcode_reader.label",help:"settings.forms.use_basic_qrcode_reader.help"},null,8,["modelValue"]),l(u,{modelValue:t(o).preferences.useDirectCapture,"onUpdate:modelValue":[e[32]||(e[32]=s=>t(o).preferences.useDirectCapture=s),e[33]||(e[33]=s=>a("useDirectCapture",s))],fieldName:"useDirectCapture",label:"settings.forms.useDirectCapture.label",help:"settings.forms.useDirectCapture.help"},null,8,["modelValue"]),l(g,{modelValue:t(o).preferences.defaultCaptureMode,"onUpdate:modelValue":[e[34]||(e[34]=s=>t(o).preferences.defaultCaptureMode=s),e[35]||(e[35]=s=>a("defaultCaptureMode",s))],options:S,fieldName:"defaultCaptureMode",label:"settings.forms.defaultCaptureMode.label",help:"settings.forms.defaultCaptureMode.help"},null,8,["modelValue"])]),t(o).isAdmin?(c(),_("div",Ve,[r("h4",he,p(n.$t("settings.administration")),1),r("div",ye,[r("p",Oe,p(n.$t("settings.administration_legend")),1),r("p",null,p(n.$t("settings.only_an_admin_can_edit_them")),1)]),l(u,{modelValue:t(i).checkForUpdate,"onUpdate:modelValue":[e[36]||(e[36]=s=>t(i).checkForUpdate=s),e[37]||(e[37]=s=>V("checkForUpdate",s))],fieldName:"checkForUpdate",label:"commons.check_for_update",help:"commons.check_for_update_help"},null,8,["modelValue"]),l(pe),l(u,{modelValue:t(i).useEncryption,"onUpdate:modelValue":[e[38]||(e[38]=s=>t(i).useEncryption=s),e[39]||(e[39]=s=>V("useEncryption",s))],fieldName:"useEncryption",label:"settings.forms.use_encryption.label",help:"settings.forms.use_encryption.help"},null,8,["modelValue"]),l(u,{modelValue:t(i).disableRegistration,"onUpdate:modelValue":[e[40]||(e[40]=s=>t(i).disableRegistration=s),e[41]||(e[41]=s=>V("disableRegistration",s))],fieldName:"disableRegistration",label:"settings.forms.disable_registration.label",help:"settings.forms.disable_registration.help"},null,8,["modelValue"]),l(u,{modelValue:t(i).enableSso,"onUpdate:modelValue":[e[42]||(e[42]=s=>t(i).enableSso=s),e[43]||(e[43]=s=>V("enableSso",s))],fieldName:"enableSso",label:"settings.forms.enable_sso.label",help:"settings.forms.enable_sso.help"},null,8,["modelValue"])])):x("",!0)])]),_:1})]),l(q,{showButtons:!0},{default:D(()=>[l(M,{returnTo:{name:t(U)},action:"close"},null,8,["returnTo"])]),_:1})])}}};export{Ce as default};
|