Files
owncast/static/web/_next/static/chunks/pages/admin/config-federation-a75cf82c23e440d0.js
2022-08-16 02:47:50 +00:00

1 line
9.2 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2532],{18957:function(e,n,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/config-federation",function(){return s(93548)}])},10063:function(e,n,s){"use strict";s.d(n,{Q:function(){return d},Z:function(){return u}});var a=s(85893),t=s(67294),i=s(84485),r=s(20550),l=s(13468),o=s(78464),c=i.Z.Title,d="#5a67d8";function u(e){var n=(0,t.useState)(""),s=n[0],i=n[1],u=e.title,h=e.description,f=e.placeholder,m=e.maxLength,p=e.values,g=e.handleDeleteIndex,v=e.handleCreateString,b=e.submitStatus,x=e.continuousStatusMessage;return(0,a.jsxs)("div",{className:"edit-string-array-container",children:[(0,a.jsx)(c,{level:3,className:"section-title",children:u}),(0,a.jsx)("p",{className:"description",children:h}),(0,a.jsx)("div",{className:"edit-current-strings",children:null===p||void 0===p?void 0:p.map((function(e,n){return(0,a.jsx)(r.Z,{closable:!0,onClose:function(){g(n)},color:d,children:e},"tag-".concat(e,"-").concat(n))}))}),x&&(0,a.jsx)("div",{className:"continuous-status-section",children:(0,a.jsx)(o.Z,{status:x})}),(0,a.jsx)("div",{className:"add-new-string-section",children:(0,a.jsx)(l.ZP,{fieldName:"string-input",value:s,onChange:function(e){var n=e.value;i(n)},onPressEnter:function(){var e=s.trim();v(e),i("")},maxLength:m,placeholder:f,status:b})})]})}u.defaultProps={maxLength:50,description:null,submitStatus:null,continuousStatusMessage:null}},15976:function(e,n,s){"use strict";s.d(n,{Z:function(){return f}});var a=s(47568),t=s(34051),i=s.n(t),r=s(85893),l=s(67294),o=s(94594),c=s(83192),d=s(78464),u=s(25964),h=s(35159);function f(e){var n=(0,l.useState)(null),s=n[0],t=n[1],f=null,m=((0,l.useContext)(h.aC)||{}).setFieldInConfigState,p=e.apiPath,g=e.checked,v=e.reversed,b=void 0!==v&&v,x=e.configPath,w=void 0===x?"":x,j=e.disabled,Z=void 0!==j&&j,k=e.fieldName,y=e.label,N=e.tip,P=e.useSubmit,C=e.onChange,S=function(){t(null),clearTimeout(f),f=null},T=function(){var e=(0,a.Z)(i().mark((function e(n){var s;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!P){e.next=6;break}return t((0,c.kg)(c.Jk)),s=b?!n:n,e.next=5,(0,u.Si)({apiPath:p,data:{value:s},onSuccess:function(){m({fieldName:k,value:s,path:w}),t((0,c.kg)(c.zv))},onError:function(e){t((0,c.kg)(c.Un,"There was an error: ".concat(e)))}});case 5:f=setTimeout(S,u.sI);case 6:C&&C(n);case 7:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),E=null!==s&&s.type===c.Jk;return(0,r.jsxs)("div",{className:"formfield-container toggleswitch-container",children:[y&&(0,r.jsx)("div",{className:"label-side",children:(0,r.jsx)("span",{className:"formfield-label",children:y})}),(0,r.jsxs)("div",{className:"input-side",children:[(0,r.jsxs)("div",{className:"input-group",children:[(0,r.jsx)(o.Z,{className:"switch field-".concat(k),loading:E,onChange:T,defaultChecked:g,checked:g,checkedChildren:"ON",unCheckedChildren:"OFF",disabled:Z}),(0,r.jsx)(d.Z,{status:s})]}),(0,r.jsx)("p",{className:"field-tip",children:N})]})]})}f.defaultProps={apiPath:"",checked:!1,reversed:!1,configPath:"",disabled:!1,label:"",tip:"",useSubmit:!1,onChange:null}},93548:function(e,n,s){"use strict";s.r(n),s.d(n,{default:function(){return y}});var a=s(14924),t=s(26042),i=s(69396),r=s(85893),l=s(85402),o=s(71577),c=s(84485),d=s(14670),u=s(25968),h=s(6226),f=s(67294),m=s(45697),p=s.n(m),g=s(13468),v=s(96410),b=s(15976),x=s(10063),w=s(25964),j=s(35159),Z=s(83192);function k(e){var n=e.cancelPressed,s=e.okPressed;return(0,r.jsxs)(l.Z,{width:"70%",title:"Enable Social Features",visible:!0,onCancel:n,footer:(0,r.jsxs)("div",{children:[(0,r.jsx)(o.Z,{onClick:n,children:"Do not enable"}),(0,r.jsx)(o.Z,{type:"primary",onClick:s,children:"Enable Social Features"})]}),children:[(0,r.jsx)(c.Z.Title,{level:3,children:"How do Owncast's social features work?"}),(0,r.jsxs)(c.Z.Paragraph,{children:["Owncast's social features are accomplished by having your server join The"," ",(0,r.jsx)("a",{href:"https://en.wikipedia.org/wiki/Fediverse",rel:"noopener noreferrer",target:"_blank",children:"Fediverse"}),", a decentralized, open, collection of independent servers, like yours."]}),"Please"," ",(0,r.jsx)("a",{href:"https://owncast.online/docs/social",rel:"noopener noreferrer",target:"_blank",children:"read more"})," ","about these features, the details behind them, and how they work.",(0,r.jsx)(c.Z.Paragraph,{}),(0,r.jsx)(c.Z.Title,{level:3,children:"What do you need to know?"}),(0,r.jsxs)("ul",{children:[(0,r.jsx)("li",{children:"These features are brand new. Given the variability of interfacing with the rest of the world, bugs are possible. Please report anything that you think isn't working quite right."}),(0,r.jsx)("li",{children:"You must always host your Owncast server with SSL using a https url."}),(0,r.jsx)("li",{children:"You should not change your server name URL or social username once people begin following you, as your server will be seen as a completely different user on the Fediverse, and the old user will disappear."}),(0,r.jsxs)("li",{children:["Turning on ",(0,r.jsx)("i",{children:"Private mode"})," will allow you to manually approve each follower and limit the visibility of your posts to followers only."]})]}),(0,r.jsx)(c.Z.Title,{level:3,children:"Learn more about The Fediverse"}),(0,r.jsxs)(c.Z.Paragraph,{children:["If these concepts are new you should discover more about what this functionality has to offer. Visit"," ",(0,r.jsx)("a",{href:"https://owncast.online/docs/social",rel:"noopener noreferrer",target:"_blank",children:"our documentation"})," ","to be pointed at some resources that will help get you started on The Fediverse."]})]})}function y(){var e=function(){_(null)},n=function(){try{(0,w.Si)({apiPath:w.pE,data:{value:o.blockedDomains},onSuccess:function(){S({fieldName:"forbiddenUsernames",value:o.forbiddenUsernames}),_(Z.zv),setTimeout(e,w.sI)},onError:function(n){_((0,Z.kg)(Z.Un,n)),setTimeout(e,w.sI)}})}catch(n){console.error(n),_(Z.Un)}},s=c.Z.Title,l=(0,f.useState)(null),o=l[0],m=l[1],p=(0,f.useState)(!1),y=p[0],N=p[1],P=(0,f.useContext)(j.aC)||{},C=P.serverConfig,S=P.setFieldInConfigState,T=(0,f.useState)(null),E=T[0],_=T[1],U=C.federation,F=C.yp,L=C.instanceDetails,D=U.enabled,I=U.isPrivate,R=U.username,O=U.goLiveMessage,M=U.showEngagement,q=U.blockedDomains,V=F.instanceUrl,z=L.nsfw,K=function(e){var n=e.fieldName,s=e.value;m((0,i.Z)((0,t.Z)({},o),(0,a.Z)({},n,s)))};if((0,f.useEffect)((function(){m({enabled:D,isPrivate:I,username:R,goLiveMessage:O,showEngagement:M,blockedDomains:q,nsfw:z,instanceUrl:F.instanceUrl})}),[C,F]),!o)return null;var W=""!==V,X=V.startsWith("https://"),Y=!X&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.Z,{message:"You must set your server URL before you can enable this feature.",type:"warning",showIcon:!0}),(0,r.jsx)("br",{}),(0,r.jsx)(v.ZP,(0,i.Z)((0,t.Z)({fieldName:"instanceUrl"},w.yi),{value:o.instanceUrl,initialValue:F.instanceUrl,type:g.xA,onChange:K,onSubmit:function(){var e=""!==o.instanceUrl,n=o.instanceUrl.startsWith("https://");e&&n||((0,w.Si)({apiPath:w.Kl.apiPath,data:{value:!1}}),m((0,i.Z)((0,t.Z)({},o),{enabled:!1})))},required:!0}))]});return(0,r.jsxs)("div",{children:[(0,r.jsx)(s,{children:"Configure Social Features"}),(0,r.jsx)("p",{children:"Owncast provides the ability for people to follow and engage with your instance. It's a great way to promote alerting, sharing and engagement of your stream."}),(0,r.jsx)("p",{children:"Once enabled you'll alert your followers when you go live as well as gain the ability to compose custom posts to share any information you like."}),(0,r.jsx)("p",{children:(0,r.jsx)("a",{href:"https://owncast.online/docs/social",rel:"noopener noreferrer",target:"_blank",children:"Read more about the specifics of these social features."})}),(0,r.jsxs)(u.Z,{children:[(0,r.jsxs)(h.Z,{span:15,className:"form-module",style:{marginRight:"15px"},children:[Y,(0,r.jsx)(b.Z,(0,i.Z)((0,t.Z)({fieldName:"enabled",onChange:function(e){e?N(!0):m((0,i.Z)((0,t.Z)({},o),{enabled:!1}))}},w.Kl),{checked:o.enabled,disabled:!W||!X})),(0,r.jsx)(b.Z,(0,i.Z)((0,t.Z)({fieldName:"isPrivate"},w.LC),{checked:o.isPrivate,disabled:!D})),(0,r.jsx)(b.Z,(0,i.Z)((0,t.Z)({fieldName:"nsfw",useSubmit:!0},w.B_),{checked:o.nsfw,disabled:!W})),(0,r.jsx)(v.ZP,(0,i.Z)((0,t.Z)({required:!0,fieldName:"username",type:g.Kx},w.Xc),{value:o.username,initialValue:R,onChange:K,disabled:!D})),(0,r.jsx)(v.ZP,(0,i.Z)((0,t.Z)({fieldName:"goLiveMessage"},w.BF),{type:g.Sk,value:o.goLiveMessage,initialValue:O,onChange:K,disabled:!D})),(0,r.jsx)(b.Z,(0,i.Z)((0,t.Z)({fieldName:"showEngagement"},w.FE),{checked:o.showEngagement,disabled:!D}))]}),(0,r.jsx)(h.Z,{span:8,className:"form-module",children:(0,r.jsx)(x.Z,{title:w.dR.label,placeholder:w.dR.placeholder,description:w.dR.tip,values:o.blockedDomains,handleDeleteIndex:function(e){o.blockedDomains.splice(e,1),n()},handleCreateString:function(e){var s;try{s=new URL(e).host}catch(a){s=e}o.blockedDomains.push(s),K({fieldName:"blockedDomains",value:o.blockedDomains}),n()},submitStatus:(0,Z.kg)(E)})})]}),y&&(0,r.jsx)(k,{cancelPressed:function(){N(!1),m((0,i.Z)((0,t.Z)({},o),{enabled:!1}))},okPressed:function(){N(!1),m((0,i.Z)((0,t.Z)({},o),{enabled:!0}))}})]})}k.propTypes={cancelPressed:p().func.isRequired,okPressed:p().func.isRequired}}},function(e){e.O(0,[1829,9774,2888,179],(function(){return n=18957,e(e.s=n);var n}));var n=e.O();_N_E=n}]);