Files
owncast/static/web/_next/static/chunks/8714.282537005e4fa0d1.js
2023-07-10 01:36:23 +00:00

1 line
3.4 KiB
JavaScript
Vendored

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8714],{68714:function(e,t,o){"use strict";o.r(t),o.d(t,{FollowModal:function(){return h}});var l=o(85893),r=o(51024),n=o(65400),s=o(4863),i=o(89552),a=o(74048),c=o(67294),u=o(13096),d=o.n(u),f=o(53899);let h=e=>{let{handleClose:t,account:o,name:u}=e,[h,w]=(0,c.useState)(null),[_,m]=(0,c.useState)(!1),[p,v]=(0,c.useState)(!1),[g,j]=(0,c.useState)(null),x=e=>{w(e),(0,f.ME)(e)?m(!0):m(!1)},y=async()=>{if(_){v(!0);try{let e=h.replace(/^@+/,""),o=await fetch("/api/remotefollow",{method:"POST",body:JSON.stringify({account:e})}),l=await o.json();if(l.redirectUrl&&(window.open(l.redirectUrl,"_blank"),t()),!l.success){j(l.message),v(!1);return}if(!l.redirectUrl){j("Unable to follow."),v(!1);return}}catch(e){j(e.message)}v(!1)}};return(0,l.jsxs)(a.default,{direction:"vertical",id:"follow-modal",children:[(0,l.jsxs)("div",{className:d().header,children:["By following this stream you'll get notified on the Fediverse when it goes live. Now is a great time to",(0,l.jsx)("a",{href:"https://owncast.online/join-fediverse",target:"_blank",rel:"noreferrer",children:"\xa0learn about the Fediverse\xa0"}),"if it's new to you."]}),(0,l.jsxs)(i.default,{spinning:p,children:[g&&(0,l.jsx)(s.default,{message:"Follow Error",description:g,type:"error",showIcon:!0}),(0,l.jsxs)("div",{className:d().account,children:[(0,l.jsx)("img",{src:"/logo",alt:"logo",className:d().logo}),(0,l.jsxs)("div",{className:d().username,children:[(0,l.jsx)("div",{className:d().name,children:u}),(0,l.jsx)("div",{children:o})]})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("div",{className:d().instructions,children:"Enter your username @server to follow"}),(0,l.jsx)(r.default,{value:h,size:"large",onChange:e=>x(e.target.value),placeholder:"Your fediverse account @account@server",defaultValue:h}),(0,l.jsx)("div",{className:d().footer,children:"You'll be redirected to your Fediverse server and asked to confirm the action."})]}),(0,l.jsxs)(a.default,{className:d().buttons,children:[(0,l.jsx)(n.default,{disabled:!_,type:"primary",onClick:y,children:"Follow"}),(0,l.jsx)(n.default,{onClick:()=>{window.open("https://owncast.online/join-fediverse","_blank")},type:"primary",children:"Join the Fediverse"})]})]})]})}},53899:function(e,t,o){"use strict";o.d(t,{Kf:function(){return n},ME:function(){return i},ax:function(){return l},bu:function(){return s},jv:function(){return r}});let l="https?://.*";function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["http:","https:"];try{let o=new URL(e);if(""===o.protocol||""===o.hostname||!t.includes(o.protocol))return!1}catch(e){return!1}return!0}function n(e,t){e.startsWith("@")&&(e=e.slice(1));let o=e.split(/:|@/),[l,r,n]=o;return l===t&&3===o.length&&!!l&&!!r&&!!n}function s(e){e.startsWith("matrix:")&&(e=e.slice(7)),e.startsWith("@")&&(e=e.slice(1));let t=e.split(":"),[o,l]=t;return 2===t.length&&!!o&&!!l}function i(e){let t=e.replace(/^@+/,"");return/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(t).toLowerCase())}},13096:function(e){e.exports={header:"FollowModal_header__0tBbf",buttons:"FollowModal_buttons__Me7qJ",instructions:"FollowModal_instructions__JCqe7",footer:"FollowModal_footer__IBJi9",account:"FollowModal_account__OZ_ZG",logo:"FollowModal_logo__m4Z2e",username:"FollowModal_username__Voyzl",name:"FollowModal_name__fVdPj"}}}]);