Files
owncast/static/web/_next/static/chunks/pages/admin/config-public-details-61013ad2a35fbe56.js
2022-10-04 18:25:24 +00:00

1 line
14 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4311],{86045:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/config-public-details",function(){return t(42992)}])},80939:function(e,n,t){"use strict";t.d(n,{Q:function(){return u},Y:function(){return d}});var a=t(85893),s=t(67294),i=t(84485),r=t(20550),l=t(24389),o=t(25521),c=i.Z.Title,u="#5a67d8",d=function(e){var n=e.title,t=e.description,i=e.placeholder,d=e.maxLength,f=e.values,h=e.handleDeleteIndex,m=e.handleCreateString,p=e.submitStatus,g=e.continuousStatusMessage,v=(0,s.useState)(""),x=v[0],j=v[1];return(0,a.jsxs)("div",{className:"edit-string-array-container",children:[(0,a.jsx)(c,{level:3,className:"section-title",children:n}),(0,a.jsx)("p",{className:"description",children:t}),(0,a.jsx)("div",{className:"edit-current-strings",children:null===f||void 0===f?void 0:f.map((function(e,n){return(0,a.jsx)(r.Z,{closable:!0,onClose:function(){h(n)},color:u,children:e},"tag-".concat(e,"-").concat(n))}))}),g&&(0,a.jsx)("div",{className:"continuous-status-section",children:(0,a.jsx)(o.E,{status:g})}),(0,a.jsx)("div",{className:"add-new-string-section",children:(0,a.jsx)(l.nv,{fieldName:"string-input",value:x,onChange:function(e){var n=e.value;j(n)},onPressEnter:function(){var e=x.trim();m(e),j("")},maxLength:d,placeholder:i,status:p})})]})};d.defaultProps={maxLength:50,description:null,submitStatus:null,continuousStatusMessage:null}},3664:function(e,n,t){"use strict";t.d(n,{Z:function(){return f}});var a=t(47568),s=t(70655),i=t(85893),r=t(67294),l=t(94594),o=t(83192),c=t(25521),u=t(25964),d=t(35159),f=function(e){var n=e.apiPath,t=e.checked,f=e.reversed,h=void 0!==f&&f,m=e.configPath,p=void 0===m?"":m,g=e.disabled,v=void 0!==g&&g,x=e.fieldName,j=e.label,N=e.tip,C=e.useSubmit,S=e.onChange,y=(0,r.useState)(null),b=y[0],w=y[1],k=null,Z=((0,r.useContext)(d.aC)||{}).setFieldInConfigState,T=function(){w(null),clearTimeout(k),k=null},_=function(){var e=(0,a.Z)((function(e){var t;return(0,s.__generator)(this,(function(a){switch(a.label){case 0:return C?(w((0,o.kg)(o.Jk)),t=h?!e:e,[4,(0,u.Si)({apiPath:n,data:{value:t},onSuccess:function(){Z({fieldName:x,value:t,path:p}),w((0,o.kg)(o.zv))},onError:function(e){w((0,o.kg)(o.Un,"There was an error: ".concat(e)))}})]):[3,2];case 1:a.sent(),k=setTimeout(T,u.sI),a.label=2;case 2:return S&&S(e),[2]}}))}));return function(n){return e.apply(this,arguments)}}(),P=null!==b&&b.type===o.Jk;return(0,i.jsxs)("div",{className:"formfield-container toggleswitch-container",children:[j&&(0,i.jsx)("div",{className:"label-side",children:(0,i.jsx)("span",{className:"formfield-label",children:j})}),(0,i.jsxs)("div",{className:"input-side",children:[(0,i.jsxs)("div",{className:"input-group",children:[(0,i.jsx)(l.Z,{className:"switch field-".concat(x),loading:P,onChange:_,defaultChecked:t,checked:t,checkedChildren:"ON",unCheckedChildren:"OFF",disabled:v}),(0,i.jsx)(c.E,{status:b})]}),(0,i.jsx)("p",{className:"field-tip",children:N})]})]})};f.defaultProps={apiPath:"",checked:!1,reversed:!1,configPath:"",disabled:!1,label:"",tip:"",useSubmit:!1,onChange:null}},42992:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return $}});var a=t(85893),s=t(67294),i=t(84485),r=t(14924),l=t(26042),o=t(69396),c=t(45200),u=t(35159),d=t(25964),f=t(3664),h=t(47568),m=t(70655),p=t(77916),g=t(71577),v=t(50888),x=t(88484),j=t(25521),N=t(83192),C=t(58827),S=["image/png","image/jpeg","image/gif"];var y=function(){var e,n=(0,s.useState)(null),t=n[0],i=n[1],r=(0,s.useState)(!1),l=r[0],o=r[1],c=(0,s.useState)(0),f=c[0],y=c[1],b=(0,s.useContext)(u.aC)||{},w=b.setFieldInConfigState,k=b.serverConfig,Z=null===k||void 0===k||null===(e=k.instanceDetails)||void 0===e?void 0:e.logo,T=(0,s.useState)(null),_=T[0],P=T[1],E=null,L=d.ZQ.apiPath,U=d.ZQ.tip,I=function(){P(null),clearTimeout(E),E=null},D=function(){var e=(0,h.Z)((function(){return(0,m.__generator)(this,(function(e){switch(e.label){case 0:return t===Z?[3,2]:(P((0,N.kg)(N.Jk)),[4,(0,d.Si)({apiPath:L,data:{value:t},onSuccess:function(){w({fieldName:"logo",value:t,path:""}),P((0,N.kg)(N.zv)),o(!1),y(Math.floor(100*Math.random()))},onError:function(e){P((0,N.kg)(N.Un,"There was an error: ".concat(e))),o(!1)}})]);case 1:e.sent(),E=setTimeout(I,d.sI),e.label=2;case 2:return[2]}}))}));return function(){return e.apply(this,arguments)}}(),F="".concat(C.WB,"logo?random=").concat(f);return(0,a.jsxs)("div",{className:"formfield-container logo-upload-container",children:[(0,a.jsx)("div",{className:"label-side",children:(0,a.jsx)("span",{className:"formfield-label",children:"Logo"})}),(0,a.jsxs)("div",{className:"input-side",children:[(0,a.jsxs)("div",{className:"input-group",children:[(0,a.jsx)("img",{src:F,alt:"avatar",className:"logo-preview"}),(0,a.jsx)(p.Z,{name:"logo",listType:"picture",className:"avatar-uploader",showUploadList:!1,accept:S.join(","),beforeUpload:function(e){return o(!0),new Promise((function(n,t){if(!S.includes(e.type)){var a="File type is not supported: ".concat(e.type);return P((0,N.kg)(N.Un,"There was an error: ".concat(a))),E=setTimeout(I,d.sI),o(!1),t()}!function(e,n){var t=new FileReader;t.addEventListener("load",(function(){return n(t.result)})),t.readAsDataURL(e)}(e,(function(e){return i(e),n()}))}))},customRequest:D,disabled:l,children:l?(0,a.jsx)(v.Z,{style:{color:"white"}}):(0,a.jsx)(g.Z,{icon:(0,a.jsx)(x.Z,{})})})]}),(0,a.jsx)(j.E,{status:_}),(0,a.jsx)("p",{className:"field-tip",children:U})]})]})},b=i.Z.Title,w=function(){var e=(0,s.useState)(null),n=e[0],t=e[1],i=((0,s.useContext)(u.aC)||{}).serverConfig,h=i.instanceDetails,m=i.yp,p=m.instanceUrl;if((0,s.useEffect)((function(){t((0,l.Z)({},h,m))}),[h,m]),!n)return null;var g=function(e){var a=e.fieldName,s=e.value;t((0,o.Z)((0,l.Z)({},n),(0,r.Z)({},a,s)))},v=""!==p;return(0,a.jsxs)("div",{className:"edit-general-settings",children:[(0,a.jsx)(b,{level:3,className:"section-title",children:"Configure Instance Details"}),(0,a.jsx)("br",{}),(0,a.jsx)(c.$7,(0,o.Z)((0,l.Z)({fieldName:"name"},d.RE),{value:n.name,initialValue:h.name,onChange:g})),(0,a.jsx)(c.$7,(0,o.Z)((0,l.Z)({fieldName:"instanceUrl"},d.cj),{value:n.instanceUrl,initialValue:m.instanceUrl,type:c.xA,onChange:g,onSubmit:function(){""===n.instanceUrl&&!0===m.enabled&&(0,d.Si)({apiPath:d.AP,data:{value:!1}})}})),(0,a.jsx)(c.$7,(0,o.Z)((0,l.Z)({fieldName:"summary"},d.rs),{type:c.Sk,value:n.summary,initialValue:h.summary,onChange:g})),(0,a.jsx)(c.$7,(0,o.Z)((0,l.Z)({fieldName:"offlineMessage"},d.rd),{type:c.Sk,value:n.offlineMessage,initialValue:h.offlineMessage,onChange:g})),(0,a.jsx)(y,{}),(0,a.jsx)(f.Z,(0,o.Z)((0,l.Z)({fieldName:"hideViewerCount",useSubmit:!0},d._X),{checked:n.hideViewerCount,onChange:function(e){g({fieldName:"hideViewerCount",value:e})}})),(0,a.jsx)("br",{}),(0,a.jsxs)("p",{className:"description",children:["Increase your audience by appearing in the"," ",(0,a.jsx)("a",{href:"https://directory.owncast.online",target:"_blank",rel:"noreferrer",children:(0,a.jsx)("strong",{children:"Owncast Directory"})}),". This is an external service run by the Owncast project."," ",(0,a.jsx)("a",{href:"https://owncast.online/docs/directory/?source=admin",target:"_blank",rel:"noopener noreferrer",children:"Learn more"}),"."]}),!m.instanceUrl&&(0,a.jsxs)("p",{className:"description",children:["You must set your ",(0,a.jsx)("strong",{children:"Server URL"})," above to enable the directory."]}),(0,a.jsxs)("div",{className:"config-yp-container",children:[(0,a.jsx)(f.Z,(0,o.Z)((0,l.Z)({fieldName:"enabled",useSubmit:!0},d.P),{checked:n.enabled,disabled:!v})),(0,a.jsx)(f.Z,(0,o.Z)((0,l.Z)({fieldName:"nsfw",useSubmit:!0},d.EY),{checked:n.nsfw,disabled:!v}))]})]})},k=t(29815),Z=t(20550),T=t(24389),_=t(80939),P=i.Z.Title,E=function(){var e=(0,s.useState)(""),n=e[0],t=e[1],i=(0,s.useState)(null),r=i[0],l=i[1],o=(0,s.useContext)(u.aC)||{},c=o.serverConfig,f=o.setFieldInConfigState,p=c.instanceDetails.tags,g=void 0===p?[]:p,v=d.y_.apiPath,x=d.y_.maxLength,j=d.y_.placeholder,C=d.y_.configPath,S=null;(0,s.useEffect)((function(){return function(){clearTimeout(S)}}),[]);var y=function(){l(null),S=null,clearTimeout(S)},b=function(){var e=(0,h.Z)((function(e){return(0,m.__generator)(this,(function(n){switch(n.label){case 0:return l((0,N.kg)(N.Jk)),[4,(0,d.Si)({apiPath:v,data:{value:e},onSuccess:function(){f({fieldName:"tags",value:e,path:C}),l((0,N.kg)(N.zv,"Tags updated.")),t(""),S=setTimeout(y,d.sI)},onError:function(e){l((0,N.kg)(N.Un,e)),S=setTimeout(y,d.sI)}})];case 1:return n.sent(),[2]}}))}));return function(n){return e.apply(this,arguments)}}();return(0,a.jsxs)("div",{className:"tag-editor-container",children:[(0,a.jsx)(P,{level:3,className:"section-title",children:"Add Tags"}),(0,a.jsx)("p",{className:"description",children:"This is a great way to categorize your Owncast server on the Directory!"}),(0,a.jsx)("div",{className:"edit-current-strings",children:g.map((function(e,n){return(0,a.jsx)(Z.Z,{closable:!0,onClose:function(){!function(e){y();var n=(0,k.Z)(g);n.splice(e,1),b(n)}(n)},color:_.Q,children:e},"tag-".concat(e,"-").concat(n))}))}),(0,a.jsx)("div",{className:"add-new-string-section",children:(0,a.jsx)(T.nv,{fieldName:"tag-input",value:n,className:"new-tag-input",onChange:function(e){var n=e.value;r||l(null),t(n)},onPressEnter:function(){y();var e=n.trim();if(""!==e)if(g.some((function(n){return n.toLowerCase()===e.toLowerCase()})))l((0,N.kg)(N.dG,"This tag is already used!"));else{var t=(0,k.Z)(g).concat([e]);b(t)}else l((0,N.kg)(N.dG,"Please enter a tag"))},maxLength:x,placeholder:j,status:r})})]})},L=t(72877),U=t(5152),I=t.n(U),D=t(9980),F=t.n(D),M=(t(69596),new(F())),z=I()((function(){return t.e(7610).then(t.bind(t,77610))}),{loadableGenerated:{webpack:function(){return[77610]}},ssr:!1}),O=i.Z.Title,V=function(){var e=(0,s.useState)(""),n=e[0],t=e[1],i=(0,s.useState)(null),r=i[0],l=i[1],o=(0,s.useState)(!1),c=o[0],f=o[1],p=(0,s.useContext)(u.aC)||{},v=p.serverConfig,x=p.setFieldInConfigState,C=v.instanceDetails,S=C.extraPageContent,y=null,b=function(){l(null),f(!1),clearTimeout(y),y=null};function w(){return(w=(0,h.Z)((function(){return(0,m.__generator)(this,(function(e){switch(e.label){case 0:return l((0,N.kg)(N.Jk)),[4,(0,d.Si)({apiPath:d.AA,data:{value:n},onSuccess:function(e){x({fieldName:"extraPageContent",value:n,path:"instanceDetails"}),l((0,N.kg)(N.zv,e))},onError:function(e){l((0,N.kg)(N.Un,e))}})];case 1:return e.sent(),y=setTimeout(b,d.sI),[2]}}))}))).apply(this,arguments)}return(0,s.useEffect)((function(){t(S)}),[C]),(0,a.jsxs)("div",{className:"edit-page-content",children:[(0,a.jsx)(O,{level:3,className:"section-title",children:"Custom Page Content"}),(0,a.jsxs)("p",{className:"description",children:["Edit the content of your page by using simple"," ",(0,a.jsx)("a",{href:"https://www.markdownguide.org/basic-syntax/",target:"_blank",rel:"noopener noreferrer",children:"Markdown syntax"}),"."]}),(0,a.jsx)(z,{style:{height:"30em"},value:n,renderHTML:function(e){return M.render(e)},onChange:function(e){var n=e.text;t(n),n===S||c?n===S&&c&&f(!1):f(!0)},config:{htmlClass:"markdown-editor-preview-pane",markdownClass:"markdown-editor-pane"}}),(0,a.jsx)("br",{}),(0,a.jsxs)("div",{className:"page-content-actions",children:[c&&(0,a.jsx)(g.Z,{type:"primary",onClick:function(){return w.apply(this,arguments)},children:"Save"}),(0,a.jsx)(j.E,{status:r})]})]})},A=i.Z.Title,J=function(){var e=(0,s.useState)(""),n=e[0],t=e[1],i=(0,s.useState)(null),r=i[0],l=i[1],o=(0,s.useState)(!1),c=o[0],f=o[1],p=(0,s.useContext)(u.aC)||{},v=p.serverConfig,x=p.setFieldInConfigState,C=v.instanceDetails,S=C.customStyles,y=null,b=function(){l(null),f(!1),clearTimeout(y),y=null};function w(){return(w=(0,h.Z)((function(){return(0,m.__generator)(this,(function(e){switch(e.label){case 0:return l((0,N.kg)(N.Jk)),[4,(0,d.Si)({apiPath:d.d$,data:{value:n},onSuccess:function(e){x({fieldName:"customStyles",value:n,path:"instanceDetails"}),l((0,N.kg)(N.zv,e))},onError:function(e){l((0,N.kg)(N.Un,e))}})];case 1:return e.sent(),y=setTimeout(b,d.sI),[2]}}))}))).apply(this,arguments)}return(0,s.useEffect)((function(){t(S)}),[C]),(0,a.jsxs)("div",{className:"edit-custom-css",children:[(0,a.jsx)(A,{level:3,className:"section-title",children:"Customize your page styling with CSS"}),(0,a.jsxs)("p",{className:"description",children:["Customize the look and feel of your Owncast instance by overriding the CSS styles of various components on the page. Refer to the"," ",(0,a.jsx)("a",{href:"https://owncast.online/docs/website/",rel:"noopener noreferrer",target:"_blank",children:"CSS & Components guide"}),"."]}),(0,a.jsx)("p",{className:"description",children:"Please input plain CSS text, as this will be directly injected onto your page during load."}),(0,a.jsx)(T.nv,{fieldName:"customStyles",type:T.Sk,value:n,maxLength:null,onChange:function(e){var n=e.value;t(n),n===S||c?n===S&&c&&f(!1):f(!0)},placeholder:"/* Enter custom CSS here */"}),(0,a.jsx)("br",{}),(0,a.jsxs)("div",{className:"page-content-actions",children:[c&&(0,a.jsx)(g.Z,{type:"primary",onClick:function(){return w.apply(this,arguments)},children:"Save"}),(0,a.jsx)(j.E,{status:r})]})]})},R=i.Z.Title;function $(){return(0,a.jsxs)("div",{className:"config-public-details-page",children:[(0,a.jsx)(R,{children:"General Settings"}),(0,a.jsxs)("p",{className:"description",children:["The following are displayed on your site to describe your stream and its content."," ",(0,a.jsx)("a",{href:"https://owncast.online/docs/website/?source=admin",target:"_blank",rel:"noopener noreferrer",children:"Learn more."})]}),(0,a.jsxs)("div",{className:"top-container",children:[(0,a.jsx)("div",{className:"form-module instance-details-container",children:(0,a.jsx)(w,{})}),(0,a.jsxs)("div",{className:"form-module social-items-container ",children:[(0,a.jsx)("div",{className:"form-module tags-module",children:(0,a.jsx)(E,{})}),(0,a.jsx)("div",{className:"form-module social-handles-container",children:(0,a.jsx)(L.h,{})})]})]}),(0,a.jsx)("div",{className:"form-module page-content-module",children:(0,a.jsx)(V,{})}),(0,a.jsx)("div",{className:"form-module page-content-module",children:(0,a.jsx)(J,{})})]})}}},function(e){e.O(0,[8939,3903,3698,3626,9654,7910,9839,2877,9774,2888,179],(function(){return n=86045,e(e.s=n);var n}));var n=e.O();_N_E=n}]);