Files
owncast/static/web/_next/static/chunks/8645-17d2aea646d88657.js
2022-12-28 11:31:54 +00:00

1 line
16 KiB
JavaScript

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8645],{80894:function(e,a,s){s.d(a,{Q:function(){return d},Y:function(){return u}});var l=s(85893),n=s(67294),t=s(84485),i=s(20550),r=s(40117),o=s(39664);let{Title:c}=t.Z,d="#5a67d8",u=e=>{let{title:a,description:s,placeholder:t,maxLength:u,values:m,handleDeleteIndex:h,handleCreateString:p,submitStatus:f,continuousStatusMessage:x}=e,[j,g]=(0,n.useState)(""),v=e=>{let{value:a}=e;g(a)},N=()=>{let e=j.trim();p(e),g("")};return(0,l.jsxs)("div",{className:"edit-string-array-container",children:[(0,l.jsx)(c,{level:3,className:"section-title",children:a}),(0,l.jsx)("p",{className:"description",children:s}),(0,l.jsx)("div",{className:"edit-current-strings",children:null==m?void 0:m.map((e,a)=>{let s=()=>{h(a)};return(0,l.jsx)(i.Z,{closable:!0,onClose:s,color:d,children:e},"tag-".concat(e,"-").concat(a))})}),x&&(0,l.jsx)("div",{className:"continuous-status-section",children:(0,l.jsx)(o.E,{status:x})}),(0,l.jsx)("div",{className:"add-new-string-section",children:(0,l.jsx)(r.nv,{fieldName:"string-input",value:j,onChange:v,onPressEnter:N,maxLength:u,placeholder:t,status:f})})]})};u.defaultProps={maxLength:50,description:null,submitStatus:null,continuousStatusMessage:null}},73706:function(e,a,s){s.d(a,{Z:function(){return d}});var l=s(85893),n=s(67294),t=s(94594),i=s(41983),r=s(39664),o=s(90745),c=s(99519);let d=e=>{let{apiPath:a,checked:s,reversed:d=!1,configPath:u="",disabled:m=!1,fieldName:h,label:p,tip:f,useSubmit:x,onChange:j}=e,[g,v]=(0,n.useState)(null),N=null,k=(0,n.useContext)(c.aC),{setFieldInConfigState:y}=k||{},b=()=>{v(null),clearTimeout(N),N=null},w=async e=>{if(x){v((0,i.kg)(i.Jk));let s=d?!e:e;await (0,o.Si)({apiPath:a,data:{value:s},onSuccess:()=>{y({fieldName:h,value:s,path:u}),v((0,i.kg)(i.zv))},onError:e=>{v((0,i.kg)(i.Un,"There was an error: ".concat(e)))}}),N=setTimeout(b,o.sI)}j&&j(e)},C=null!==g&&g.type===i.Jk;return(0,l.jsxs)("div",{className:"formfield-container toggleswitch-container",children:[p&&(0,l.jsx)("div",{className:"label-side",children:(0,l.jsx)("span",{className:"formfield-label",children:p})}),(0,l.jsxs)("div",{className:"input-side",children:[(0,l.jsxs)("div",{className:"input-group",children:[(0,l.jsx)(t.Z,{className:"switch field-".concat(h),loading:C,onChange:w,defaultChecked:s,checked:s,checkedChildren:"ON",unCheckedChildren:"OFF",disabled:m}),(0,l.jsx)(r.E,{status:g})]}),(0,l.jsx)("p",{className:"field-tip",children:f})]})]})};d.defaultProps={apiPath:"",checked:!1,reversed:!1,configPath:"",disabled:!1,label:"",tip:"",useSubmit:!1,onChange:null}},67650:function(e,a,s){s.r(a),s.d(a,{default:function(){return N}});var l=s(85893),n=s(67294),t=s(84485),i=s(10135),r=s(99519),o=s(90745),c=s(73706),d=s(77916),u=s(71577),m=s(50888),h=s(88484),p=s(39664),f=s(41983),x=s(64777),j=s(60956);let g=()=>{var e;let[a,s]=(0,n.useState)(null),[t,i]=(0,n.useState)(!1),[c,g]=(0,n.useState)(0),v=(0,n.useContext)(r.aC),{setFieldInConfigState:N,serverConfig:k}=v||{},y=null==k?void 0:null===(e=k.instanceDetails)||void 0===e?void 0:e.logo,[b,w]=(0,n.useState)(null),C=null,{apiPath:S,tip:Z}=o.ZQ,E=()=>{w(null),clearTimeout(C),C=null},T=e=>(i(!0),new Promise((a,l)=>{if(!j.d.includes(e.type)){let n="File type is not supported: ".concat(e.type);return w((0,f.kg)(f.Un,"There was an error: ".concat(n))),C=setTimeout(E,o.sI),i(!1),l()}(0,j.y)(e,e=>(s(e),a()))})),P=async()=>{a!==y&&(w((0,f.kg)(f.Jk)),await (0,o.Si)({apiPath:S,data:{value:a},onSuccess:()=>{N({fieldName:"logo",value:a,path:""}),w((0,f.kg)(f.zv)),i(!1),g(Math.floor(100*Math.random()))},onError:e=>{w((0,f.kg)(f.Un,"There was an error: ".concat(e))),i(!1)}}),C=setTimeout(E,o.sI))},L="".concat(x.WB,"logo?random=").concat(c);return(0,l.jsxs)("div",{className:"formfield-container logo-upload-container",children:[(0,l.jsx)("div",{className:"label-side",children:(0,l.jsx)("span",{className:"formfield-label",children:"Logo"})}),(0,l.jsxs)("div",{className:"input-side",children:[(0,l.jsxs)("div",{className:"input-group",children:[(0,l.jsx)("img",{src:L,alt:"avatar",className:"logo-preview"}),(0,l.jsx)(d.Z,{name:"logo",listType:"picture",className:"avatar-uploader",showUploadList:!1,accept:j.d.join(","),beforeUpload:T,customRequest:P,disabled:t,children:t?(0,l.jsx)(m.Z,{style:{color:"white"}}):(0,l.jsx)(u.Z,{icon:(0,l.jsx)(h.Z,{})})})]}),(0,l.jsx)(p.E,{status:b}),(0,l.jsx)("p",{className:"field-tip",children:Z})]})]})},{Title:v}=t.Z;function N(){let[e,a]=(0,n.useState)(null),s=(0,n.useContext)(r.aC),{serverConfig:t}=s||{},{instanceDetails:d,yp:u}=t,{instanceUrl:m}=u;if((0,n.useEffect)(()=>{a({...d,...u})},[d,u]),!e)return null;let h=()=>{""===e.instanceUrl&&!0===u.enabled&&(0,o.Si)({apiPath:o.AP,data:{value:!1}})},p=s=>{let{fieldName:l,value:n}=s;a({...e,[l]:n})},f=""!==m;return(0,l.jsxs)("div",{className:"edit-general-settings",children:[(0,l.jsx)(v,{level:3,className:"section-title",children:"Configure Instance Details"}),(0,l.jsx)("br",{}),(0,l.jsx)(i.$7,{fieldName:"name",...o.RE,value:e.name,initialValue:d.name,onChange:p}),(0,l.jsx)(i.$7,{fieldName:"instanceUrl",...o.cj,value:e.instanceUrl,initialValue:u.instanceUrl,type:i.xA,onChange:p,onSubmit:h}),(0,l.jsx)(i.$7,{fieldName:"summary",...o.rs,type:i.Sk,value:e.summary,initialValue:d.summary,onChange:p}),(0,l.jsx)(i.$7,{fieldName:"offlineMessage",...o.rd,type:i.Sk,value:e.offlineMessage,initialValue:d.offlineMessage,onChange:p}),(0,l.jsx)(g,{}),(0,l.jsx)(c.Z,{fieldName:"hideViewerCount",useSubmit:!0,...o._X,checked:e.hideViewerCount,onChange:function(e){p({fieldName:"hideViewerCount",value:e})}}),(0,l.jsx)("br",{}),(0,l.jsxs)("p",{className:"description",children:["Increase your audience by appearing in the"," ",(0,l.jsx)("a",{href:"https://directory.owncast.online",target:"_blank",rel:"noreferrer",children:(0,l.jsx)("strong",{children:"Owncast Directory"})}),". This is an external service run by the Owncast project."," ",(0,l.jsx)("a",{href:"https://owncast.online/docs/directory/?source=admin",target:"_blank",rel:"noopener noreferrer",children:"Learn more"}),"."]}),!u.instanceUrl&&(0,l.jsxs)("p",{className:"description",children:["You must set your ",(0,l.jsx)("strong",{children:"Server URL"})," above to enable the directory."]}),(0,l.jsxs)("div",{className:"config-yp-container",children:[(0,l.jsx)(c.Z,{fieldName:"enabled",useSubmit:!0,...o.P,checked:e.enabled,disabled:!f}),(0,l.jsx)(c.Z,{fieldName:"nsfw",useSubmit:!0,...o.EY,checked:e.nsfw,disabled:!f})]})]})}},99683:function(e,a,s){s.r(a),s.d(a,{default:function(){return h}});var l=s(85893),n=s(67294),t=s(84485),i=s(20550),r=s(99519),o=s(90745),c=s(40117),d=s(41983),u=s(80894);let{Title:m}=t.Z;function h(){let[e,a]=(0,n.useState)(""),[s,t]=(0,n.useState)(null),h=(0,n.useContext)(r.aC),{serverConfig:p,setFieldInConfigState:f}=h||{},{instanceDetails:x}=p,{tags:j=[]}=x,{apiPath:g,maxLength:v,placeholder:N,configPath:k}=o.y_,y=null;(0,n.useEffect)(()=>()=>{clearTimeout(y)},[]);let b=()=>{t(null),clearTimeout(y=null)},w=async e=>{t((0,d.kg)(d.Jk)),await (0,o.Si)({apiPath:g,data:{value:e},onSuccess:()=>{f({fieldName:"tags",value:e,path:k}),t((0,d.kg)(d.zv,"Tags updated.")),a(""),y=setTimeout(b,o.sI)},onError:e=>{t((0,d.kg)(d.Un,e)),y=setTimeout(b,o.sI)}})},C=e=>{let{value:l}=e;s||t(null),a(l)},S=()=>{b();let a=e.trim();if(""===a){t((0,d.kg)(d.dG,"Please enter a tag"));return}if(j.some(e=>e.toLowerCase()===a.toLowerCase())){t((0,d.kg)(d.dG,"This tag is already used!"));return}let s=[...j,a];w(s)},Z=e=>{b();let a=[...j];a.splice(e,1),w(a)};return(0,l.jsxs)("div",{className:"tag-editor-container",children:[(0,l.jsx)(m,{level:3,className:"section-title",children:"Add Tags"}),(0,l.jsx)("p",{className:"description",children:"This is a great way to categorize your Owncast server on the Directory!"}),(0,l.jsx)("div",{className:"edit-current-strings",children:j.map((e,a)=>{let s=()=>{Z(a)};return(0,l.jsx)(i.Z,{closable:!0,onClose:s,color:u.Q,children:e},"tag-".concat(e,"-").concat(a))})}),(0,l.jsx)("div",{className:"add-new-string-section",children:(0,l.jsx)(c.nv,{fieldName:"tag-input",value:e,className:"new-tag-input",onChange:C,onPressEnter:S,maxLength:v,placeholder:N,status:s})})]})}},42441:function(e,a,s){s.r(a),s.d(a,{default:function(){return x}});var l=s(85893),n=s(67294),t=s(84485),i=s(71577),r=s(87685),o=s(58909),c=s(48825),d=s(76538),u=s(99519),m=s(90745),h=s(41983),p=s(39664);let{Title:f}=t.Z;function x(){let[e,a]=(0,n.useState)(""),[s,t]=(0,n.useState)(null),[x,j]=(0,n.useState)(!1),g=(0,n.useContext)(u.aC),{serverConfig:v,setFieldInConfigState:N}=g||{},{instanceDetails:k}=v,{extraPageContent:y}=k,b=null,w=()=>{t(null),j(!1),clearTimeout(b),b=null};async function C(){t((0,h.kg)(h.Jk)),await (0,m.Si)({apiPath:m.AA,data:{value:e},onSuccess:a=>{N({fieldName:"extraPageContent",value:e,path:"instanceDetails"}),t((0,h.kg)(h.zv,a))},onError:e=>{t((0,h.kg)(h.Un,e))}}),b=setTimeout(w,m.sI)}return(0,n.useEffect)(()=>{a(y)},[k]),(0,l.jsxs)("div",{className:"edit-page-content",children:[(0,l.jsx)(f,{level:3,className:"section-title",children:"Custom Page Content"}),(0,l.jsxs)("p",{className:"description",children:["Edit the content of your page by using simple"," ",(0,l.jsx)("a",{href:"https://www.markdownguide.org/basic-syntax/",target:"_blank",rel:"noopener noreferrer",children:"Markdown syntax"}),"."]}),(0,l.jsx)(r.ZP,{value:e,placeholder:"Enter your custom page content here...",theme:o.F,onChange:function(e){a(e),e===y||x?e===y&&x&&j(!1):j(!0)},extensions:[(0,c.markdown)({base:c.markdownLanguage,codeLanguages:d.M})]}),(0,l.jsx)("br",{}),(0,l.jsxs)("div",{className:"page-content-actions",children:[x&&(0,l.jsx)(i.Z,{type:"primary",onClick:C,children:"Save"}),(0,l.jsx)(p.E,{status:s})]})]})}},51353:function(e,a,s){s.r(a),s.d(a,{default:function(){return b}});var l=s(85893),n=s(67294),t=s(84485),i=s(71577),r=s(69677),o=s(52206),c=s(85402),d=s(10010),u=s(39398),m=s(48689),h=s(38939),p=s(90745);let f=e=>{let{iconList:a,selectedOption:s,onSelected:n}=e,t=e=>{n&&n(e)},i=""===s?null:s;return(0,l.jsxs)("div",{className:"social-dropdown-container",children:[(0,l.jsx)("p",{className:"description",children:"If you are looking for a platform name not on this list, please select Other and type in your own name. A logo will not be provided."}),(0,l.jsxs)("div",{className:"formfield-container",children:[(0,l.jsx)("div",{className:"label-side",children:(0,l.jsx)("span",{className:"formfield-label",children:"Social Platform"})}),(0,l.jsx)("div",{className:"input-side",children:(0,l.jsxs)(h.Z,{style:{width:240},className:"social-dropdown",placeholder:"Social platform...",defaultValue:i,value:i,onSelect:t,children:[a.map(e=>{let{platform:a,icon:s,key:n}=e;return(0,l.jsxs)(h.Z.Option,{className:"social-option",value:n,children:[(0,l.jsx)("span",{className:"option-icon",children:(0,l.jsx)("img",{src:s,alt:"",className:"option-icon"})}),(0,l.jsx)("span",{className:"option-label",children:a})]},"platform-".concat(n))}),(0,l.jsx)(h.Z.Option,{className:"social-option",value:p.z_,children:"Other..."},"platform-".concat(p.z_))]})})]})]})};var x=s(64777),j=s(99519),g=s(37174),v=s(40117),N=s(41983),k=s(39664);let{Title:y}=t.Z;function b(){var e,a;let[s,t]=(0,n.useState)([]),[h,b]=(0,n.useState)([]),[w,C]=(0,n.useState)(!1),[S,Z]=(0,n.useState)(!1),[E,T]=(0,n.useState)(!1),[P,L]=(0,n.useState)(-1),[U,z]=(0,n.useState)(p.wC),[_,I]=(0,n.useState)(null),O=(0,n.useContext)(j.aC),{serverConfig:A,setFieldInConfigState:V}=O||{},{instanceDetails:M}=A,{socialHandles:D}=M,R=async()=>{try{let e=await (0,x.rQ)(x.$i,{auth:!1}),a=Object.keys(e).map(a=>({key:a,...e[a]}));t(a)}catch(s){console.log(s)}},F=e=>s.find(a=>a.key===e)||!1,H=""!==U.platform&&!s.find(e=>e.key===U.platform);(0,n.useEffect)(()=>{R()},[]),(0,n.useEffect)(()=>{M.socialHandles&&b(D)},[M]);let J=()=>{I(null),clearTimeout(null)},$=()=>{C(!1),L(-1),Z(!1),T(!1),z({...p.wC})},Q=()=>{$()},Y=(e,a)=>{z({...U,[e]:a})},B=e=>{e===p.z_?(Z(!0),Y("platform","")):(Z(!1),Y("platform",e))},G=e=>{let{value:a}=e.target;Y("platform",a)},K=e=>{let{value:a}=e;Y("url",a)},q=async e=>{await (0,p.Si)({apiPath:p.c9,data:{value:e},onSuccess:()=>{V({fieldName:"socialHandles",value:e,path:"instanceDetails"}),T(!1),Q(),I((0,N.kg)(N.zv)),setTimeout(J,p.sI)},onError:e=>{I((0,N.kg)(N.Un,"There was an error: ".concat(e))),T(!1),setTimeout(J,p.sI)}})},W=()=>{T(!0);let e=h.length?[...h]:[];-1===P?e.push(U):e.splice(P,1,U),q(e)},X=e=>{let a=[...h];a.splice(e,1),q(a)},ee=e=>{if(e<=0||e>=h.length)return;let a=[...h],s=a[e-1];a[e-1]=a[e],a[e]=s,q(a)},ea=e=>{if(e<0||e>=h.length-1)return;let a=[...h],s=a[e+1];a[e+1]=a[e],a[e]=s,q(a)},es={disabled:(e=U.url,"xmpp"===(a=U.platform)?!(0,g.Kf)(e,"xmpp"):"matrix"===a?!(0,g.bu)(e):!(0,g.jv)(e))},el=(0,l.jsxs)("div",{className:"other-field-container formfield-container",children:[(0,l.jsx)("div",{className:"label-side"}),(0,l.jsx)("div",{className:"input-side",children:(0,l.jsx)(r.Z,{placeholder:"Other platform name",defaultValue:U.platform,onChange:G})})]});return(0,l.jsxs)("div",{className:"social-links-edit-container",children:[(0,l.jsx)(y,{level:3,className:"section-title",children:"Your Social Handles"}),(0,l.jsx)("p",{className:"description",children:"Add all your social media handles and links to your other profiles here."}),(0,l.jsx)(k.E,{status:_}),(0,l.jsx)(o.Z,{className:"social-handles-table",pagination:!1,size:"small",rowKey:e=>"".concat(e.platform,"-").concat(e.url),columns:[{title:"Social Link",dataIndex:"",key:"combo",render:(e,a)=>{let{platform:s,url:n}=a,t=F(s);if(!t)return(0,l.jsx)("div",{className:"social-handle-cell",children:(0,l.jsxs)("p",{className:"option-label",children:[(0,l.jsx)("strong",{children:s}),(0,l.jsx)("span",{className:"handle-url",title:n,children:n})]})});let{icon:i,platform:r}=t;return(0,l.jsxs)("div",{className:"social-handle-cell",children:[(0,l.jsx)("span",{className:"option-icon",children:(0,l.jsx)("img",{src:i,alt:"",className:"option-icon"})}),(0,l.jsxs)("p",{className:"option-label",children:[(0,l.jsx)("strong",{children:r}),(0,l.jsx)("span",{className:"handle-url",title:n,children:n})]})]})}},{title:"",dataIndex:"",key:"edit",render:(e,a,s)=>(0,l.jsxs)("div",{className:"actions",children:[(0,l.jsx)(i.Z,{size:"small",onClick:()=>{let e=h[s];L(s),z({...e}),C(!0),F(e.platform)||Z(!0)},children:"Edit"}),(0,l.jsx)(i.Z,{icon:(0,l.jsx)(d.Z,{}),size:"small",hidden:0===s,onClick:()=>ee(s)}),(0,l.jsx)(i.Z,{icon:(0,l.jsx)(u.Z,{}),size:"small",hidden:s===h.length-1,onClick:()=>ea(s)}),(0,l.jsx)(i.Z,{className:"delete-button",icon:(0,l.jsx)(m.Z,{}),size:"small",onClick:()=>X(s)})]})}],dataSource:h}),(0,l.jsx)(c.Z,{title:"Edit Social Handle",open:w,onOk:W,onCancel:Q,confirmLoading:E,okButtonProps:es,children:(0,l.jsxs)("div",{className:"social-handle-modal-content",children:[(0,l.jsx)(f,{iconList:s,selectedOption:H?p.z_:U.platform,onSelected:B}),S&&el,(0,l.jsx)("br",{}),(0,l.jsx)(v.nv,{fieldName:"social-url",label:"URL",placeholder:{mastodon:"https://mastodon.social/@username",twitter:"https://twitter.com/username"}[U.platform]||"Url to page",value:U.url,onChange:K,useTrim:!0,type:"url",pattern:g.ax}),(0,l.jsx)(k.E,{status:_})]})}),(0,l.jsx)("br",{}),(0,l.jsx)(i.Z,{type:"primary",onClick:()=>{$(),C(!0)},children:"Add a new social link"})]})}},98645:function(e,a,s){s.r(a),s.d(a,{default:function(){return o}});var l=s(85893);s(67294);var n=s(67650),t=s(99683),i=s(51353),r=s(42441);function o(){return(0,l.jsxs)("div",{className:"config-public-details-page",children:[(0,l.jsxs)("p",{className:"description",children:["The following are displayed on your site to describe your stream and its content."," ",(0,l.jsx)("a",{href:"https://owncast.online/docs/website/?source=admin",target:"_blank",rel:"noopener noreferrer",children:"Learn more."})]}),(0,l.jsxs)("div",{className:"top-container",children:[(0,l.jsx)("div",{className:"form-module instance-details-container",children:(0,l.jsx)(n.default,{})}),(0,l.jsxs)("div",{className:"form-module social-items-container ",children:[(0,l.jsx)("div",{className:"form-module tags-module",children:(0,l.jsx)(t.default,{})}),(0,l.jsx)("div",{className:"form-module social-handles-container",children:(0,l.jsx)(i.default,{})})]})]}),(0,l.jsx)("div",{className:"form-module page-content-module",children:(0,l.jsx)(r.default,{})})]})}},60956:function(e,a,s){s.d(a,{d:function(){return l},y:function(){return n}});let l=["image/png","image/jpeg","image/gif"];function n(e,a){let s=new FileReader;s.addEventListener("load",()=>a(s.result)),s.readAsDataURL(e)}}}]);