pixelfed/public/js/remote_auth.js

1 line
349 KiB
JavaScript
Raw Normal View History

2024-10-06 06:53:38 +00:00
(self.webpackChunkpixelfed=self.webpackChunkpixelfed||[]).push([[9649],{68633:(t,r,o)=>{"use strict";o.r(r),o.d(r,{default:()=>n});var e=o(45348),a=o(83601);const n={components:{InstagramLoader:e.InstagramLoader,RegisterForm:a.default},data:function(){return{loaded:!1,error:!1,prefill:!1,existing:void 0,maxUsesReached:void 0,tab:"loading",canReload:!1}},mounted:function(){this.validateSession(),window.onbeforeunload=function(){if(!this.canReload)return alert("You are trying to leave."),!1}},methods:{validateSession:function(){var t=this;axios.post("/auth/raw/mastodon/s/check").then((function(r){if(r||r.hasOwnProperty("action"))switch(r.data.action){case"onboard":return void t.getPrefillData();case"redirect_existing_user":return t.existing=!0,t.canReload=!0,window.onbeforeunload=void 0,void t.redirectExistingUser();case"max_uses_reached":return t.maxUsesReached=!0,t.canReload=!0,void(window.onbeforeunload=void 0);default:return void(t.error=!0)}else swal("Oops!","An unexpected error occured, please try again later","error")})).catch((function(r){t.canReload=!0,window.onbeforeunload=void 0,t.error=!0}))},setCanReload:function(){this.canReload=!0,window.onbeforeunload=void 0},redirectExistingUser:function(){var t=this;this.canReload=!0,setTimeout((function(){t.handleLogin()}),1500)},handleLogin:function(){var t=this;axios.post("/auth/raw/mastodon/s/login").then((function(t){setTimeout((function(){window.location.reload()}),1500)})).catch((function(r){t.canReload=!1,t.error=!0}))},getPrefillData:function(){var t=this;axios.post("/auth/raw/mastodon/s/prefill").then((function(r){t.prefill=r.data})).catch((function(r){t.error=!0})).finally((function(){setTimeout((function(){t.loaded=!0}),1e3)}))}}}},3360:(t,r,o)=>{"use strict";o.r(r),o.d(r,{default:()=>e});const e={props:{config:{type:Object}},data:function(){return{loaded:!1,domains:[]}},mounted:function(){this.fetchDomains()},methods:{fetchDomains:function(){var t=this;axios.post("/auth/raw/mastodon/domains").then((function(r){t.domains=r.data})).finally((function(){setTimeout((function(){t.loaded=!0}),500)}))},handleRedirect:function(t){axios.post("/auth/raw/mastodon/redirect",{domain:t}).then((function(r){r&&r.data.hasOwnProperty("ready")&&(r.data.hasOwnProperty("action")&&"incompatible_domain"===r.data.action?swal("Oops!","This server is not compatible, please choose another or try again later!","error"):r.data.hasOwnProperty("action")&&"blocked_domain"===r.data.action?swal("Server Blocked","This server is blocked by admins and cannot be used, please try another server!","error"):r.data.ready&&(window.location.href="/auth/raw/mastodon/preflight?d="+t+"&dsh="+r.data.dsh))}))},handleOther:function(){var t=this;swal({text:"Enter your mastodon domain (without https://)",content:"input",button:{text:"Next",closeModal:!1}}).then((function(r){if(!r||r.length<2||-1==r.indexOf("."))swal("Oops!","Please enter a valid domain!","error");else{if(!r.startsWith("http"))return t.handleRedirect(r);swal("Oops!","The domain you enter should not start with http(s://)\nUse the domain format, like mastodon.social","error")}}))}}}},61441:(t,r,o)=>{"use strict";o.r(r),o.d(r,{default:()=>n});var e=o(49666),a=o(45348);const n={props:{initialData:{type:Object}},components:{InstagramLoader:a.InstagramLoader},data:function(){return{step:1,validUsername:!1,usernameError:void 0,username:this.initialData.username,email:void 0,emailError:void 0,validEmail:!1,password:void 0,passwordConfirm:void 0,passwordValid:!1,following:[],followingFetched:!1,selectedFollowing:[],form:{importAvatar:!0,bio:this.stripTagsPreserveNewlines(this.initialData.note),display_name:this.initialData.display_name},isSubmitting:!1,submitProgress:0,submitMessage:"Please wait...",isImportingFollowing:!1,accountToId:[],followingIds:[],accessToken:void 0}},mounted:function(){this.checkUsernameAvailability()},watch:{username:(0,e.debounce)((function(t){this.checkUsernameAvailability()}),500),email:(0,e.debounce)((function(t){this.checkEmailAvailability()}),500),passwordConfirm:function(t){this.checkPasswordConfirm(t)},selectedFollowing: