2024-10-12 20:09:07 +02:00
|
|
|
import{u as V,a as x,b as A,c as E,r as w,d as N,o as R,e as l,f as a,g as d,h as t,n as S,i as o,j as r,t as s,w as C,k as B,l as m,m as k,p as _}from"./app-SZK8VCXD.js";import{F as U}from"./Form-HwO5i2bJ.js";import{u as K}from"./bus-B5bab611.js";/*! 2FAuth version 5.3.1 - Copyright (c) 2024 Bubka - https://github.com/Bubka/2FAuth */const Q={class:"container has-text-centered"},T={class:"columns quick-uploader"},D=t("br",null,null,-1),M={class:"column is-full quick-uploader-button"},j={class:"quick-uploader-centerer"},z={class:"column is-full"},G={class:"block light-or-darker"},H={key:0,class:"block has-text-link"},J={class:"block has-text-link"},O={class:"block has-text-link"},Z={__name:"Start",setup(P){const f=V(),u=x(),b=K(),g=A(),h=E(),p=w(null),c=w(null),i=N(new U({qrcode:null,inputFormat:"fileUpload"}));function v(){i.clear(),i.qrcode=p.value.files[0],i.upload("/api/v1/qrcode/decode",{returnError:!0}).then(e=>{e.data.data.slice(0,33).toLowerCase()==="otpauth-migration://offline?data="?(b.migrationUri=e.data.data,f.push({name:"importAccounts"})):(b.decodedUri=e.data.data,f.push({name:"createAccount"}))}).catch(e=>{e.response.status!==422&&g.alert({text:e.response.data.message})})}function $(){f.push({name:"capture"})}return R(()=>{u.preferences.useDirectCapture&&u.preferences.defaultCaptureMode==="upload"&&c.value.click()}),(e,n)=>{const F=l("FieldError"),q=l("RouterLink"),I=l("ButtonBackCloseCancel"),L=l("VueFooter");return a(),d("div",Q,[t("div",T,[t("div",{class:S(["column is-full quick-uploader-header",{"is-invisible":o(h).count!==0}])},[r(s(e.$t("twofaccounts.no_account_here")),1),D,r(" "+s(e.$t("twofaccounts.add_first_account")),1)],2),t("div",M,[t("div",j,[o(u).preferences.useBasicQrcodeReader?(a(),d("label",{key:0,role:"button",tabindex:"0",class:"button is-link is-medium is-rounded is-main",ref_key:"qrcodeInputLabel",ref:c,onKeyup:n[0]||(n[0]=C(y=>o(c).click(),["enter"]))},[t("input",{"aria-hidden":"true",tabindex:"-1",class:"file-input",type:"file",accept:"image/*",onChange:v,ref_key:"qrcodeInput",ref:p},null,544),r(" "+s(e.$t("twofaccounts.forms.upload_qrcode")),1)],544)):(a(),d("button",{key:1,class:"button is-link is-medium is-rounded is-main",onClick:n[1]||(n[1]=y=>$())},s(e.$t("twofaccounts.forms.scan_qrcode")),1))]),o(i).errors.hasAny("qrcode")?(a(),B(F,{key:0,error:o(i).errors.get("qrcode"),field:"qrcode"},null,8,["error"])):m("",!0)]),t("div",z,[t("div",G,s(e.$t("twofaccounts.forms.alternative_methods")),1),o(u).preferences.useBasicQrcodeReader?m("",!0):(a(),d("div",H,[t("label",{role:"button",tabindex:"0",class:"button is-link is-outlined is-rounded",ref_key:"qrcodeInputLabel",ref:c,onKeyup:n[2]||(n[2]=C(y=>o(c).click(),["enter"]))},[t("input",{"aria-hidden":"true",tabindex:"-1",class:"file-input",type:"file",accept:"image/*",onChange:v,ref_key:"qrcodeInput",ref:p},null,544),r(" "+s(e.$t("twofaccounts.forms.upload_qrcode")),1)],544)])),t("div",J,[k(q,{class:"button is-link is-outlined is-rounded",to:{name:"createAccount"}},{default:_(()=>[r(s(e.$t("twofaccounts.forms.use_advanced_form")),1)]),_:1})]),t("div",O,[k(q,{id:"btnImport",class:"button is-link is-outlined is-rounded",to:{name:"importAccounts"}},{default:_(()=>[r(s(e.$t("twofaccounts.import.import")),1)]),_:1})])])]),k(L,{showButtons:!0},{default:_(()=>[o(h).isEmpty?m("",!0):(a(),B(I,{key:0,returnTo:{name:"accounts"},action:"back"}))]),_:1})])}}};export{Z as default};
|