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