1 line
9.0 KiB
JavaScript
Vendored
1 line
9.0 KiB
JavaScript
Vendored
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4440],{5789:function(e,n,t){"use strict";n.Z=void 0;var s=t(38614).Col;n.Z=s},55673:function(e,n,t){"use strict";n.Z=void 0;var s=t(38614).Row;n.Z=s},13882:function(e,n,t){"use strict";function s(e,n){if(n.length<e)throw TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+n.length+" present")}t.d(n,{Z:function(){return s}})},19013:function(e,n,t){"use strict";t.d(n,{Z:function(){return a}});var s=t(71002),i=t(13882);function a(e){(0,i.Z)(1,arguments);var n=Object.prototype.toString.call(e);return e instanceof Date||"object"===(0,s.Z)(e)&&"[object Date]"===n?new Date(e.getTime()):"number"==typeof e||"[object Number]"===n?new Date(e):(("string"==typeof e||"[object String]"===n)&&"undefined"!=typeof console&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(Error().stack)),new Date(NaN))}},7148:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/config-notify",function(){return t(4391)}])},44716:function(e,n,t){"use strict";t.d(n,{Z:function(){return d}});var s=t(85893),i=t(67294),a=t(40987),l=t(91332),r=t(57520),o=t(24044),c=t(38631);let d=e=>{let{apiPath:n,checked:t,reversed:d=!1,configPath:u="",disabled:h=!1,fieldName:f,label:p,tip:m,useSubmit:g,onChange:x}=e,[b,j]=(0,i.useState)(null),y=null,v=(0,i.useContext)(c.a),{setFieldInConfigState:w}=v||{},k=()=>{j(null),clearTimeout(y),y=null},N=async e=>{if(g){j((0,l.kg)(l.Jk));let t=d?!e:e;await (0,o.Si)({apiPath:n,data:{value:t},onSuccess:()=>{w({fieldName:f,value:t,path:u}),j((0,l.kg)(l.zv))},onError:e=>{j((0,l.kg)(l.Un,"There was an error: ".concat(e)))}}),y=setTimeout(k,o.sI)}x&&x(e)},C=null!==b&&b.type===l.Jk;return(0,s.jsxs)("div",{className:"formfield-container toggleswitch-container",children:[p&&(0,s.jsx)("div",{className:"label-side",children:(0,s.jsx)("span",{className:"formfield-label",children:p})}),(0,s.jsxs)("div",{className:"input-side",children:[(0,s.jsxs)("div",{className:"input-group",children:[(0,s.jsx)(a.Z,{className:"switch field-".concat(f),loading:C,onChange:N,defaultChecked:t,checked:t,checkedChildren:"ON",unCheckedChildren:"OFF",disabled:h}),(0,s.jsx)(r.E,{status:b})]}),(0,s.jsx)("p",{className:"field-tip",children:m})]})]})};d.defaultProps={apiPath:"",checked:!1,reversed:!1,configPath:"",disabled:!1,label:"",tip:"",useSubmit:!1,onChange:null}},4391:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return T}});var s=t(85893),i=t(4863),a=t(65400),l=t(5789),r=t(55673),o=t(53740),c=t(67294),d=t(41664),u=t.n(d),h=t(38631),f=t(67032),p=t(57520),m=t(24044),g=t(44716),x=t(91332);let{Title:b}=o.default,j=()=>{let e=(0,c.useContext)(h.a),{serverConfig:n,setFieldInConfigState:t}=e||{},{notifications:i}=n||{},{discord:l}=i||{},{enabled:r,webhook:o,goLiveMessage:d}=l||{},[u,j]=(0,c.useState)({}),[y,v]=(0,c.useState)(null),[w,k]=(0,c.useState)(!1);(0,c.useEffect)(()=>{j({enabled:r,webhook:o,goLiveMessage:d})},[i,l]);let N=()=>""!==o&&""!==d,C=e=>{let{fieldName:n,value:t}=e;j({...u,[n]:t}),k(N())},S=()=>{v(null),clearTimeout(null)},E=async()=>{await (0,m.Si)({apiPath:"/notifications/discord",data:{value:u},onSuccess:()=>{t({fieldName:"discord",value:u,path:"notifications"}),v((0,x.kg)(x.zv,"Updated.")),setTimeout(S,m.sI)},onError:e=>{v((0,x.kg)(x.Un,e)),setTimeout(S,m.sI)}})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(b,{children:"Discord"}),(0,s.jsx)("p",{className:"description reduced-margins",children:"Let your Discord channel know each time you go live."}),(0,s.jsxs)("p",{className:"description reduced-margins",children:[(0,s.jsx)("a",{href:"https://support.discord.com/hc/en-us/articles/228383668",target:"_blank",rel:"noreferrer",children:"Create a webhook"})," ","under ",(0,s.jsx)("i",{children:"Edit Channel / Integrations"})," on your Discord channel and provide it below."]}),(0,s.jsx)(g.Z,{apiPath:"",fieldName:"discordEnabled",label:"Enable Discord",checked:u.enabled,onChange:e=>{C({fieldName:"enabled",value:e})}}),(0,s.jsx)("div",{style:{display:u.enabled?"block":"none"},children:(0,s.jsx)(f.nv,{...m.oy.webhookUrl,required:!0,value:u.webhook,onChange:C})}),(0,s.jsx)("div",{style:{display:u.enabled?"block":"none"},children:(0,s.jsx)(f.nv,{...m.oy.goLiveMessage,required:!0,value:u.goLiveMessage,onChange:C})}),(0,s.jsx)(a.default,{type:"primary",onClick:E,style:{display:w?"inline-block":"none",position:"relative",marginLeft:"auto",right:"0",marginTop:"20px"},children:"Save"}),(0,s.jsx)(p.E,{status:y})]})},{Title:y}=o.default,v=()=>{let e=(0,c.useContext)(h.a),{serverConfig:n,setFieldInConfigState:t}=e||{},{notifications:i}=n||{},{browser:l}=i||{},{enabled:r,goLiveMessage:o}=l||{},[d,u]=(0,c.useState)({}),[b,j]=(0,c.useState)(null),[v,w]=(0,c.useState)(!1);(0,c.useEffect)(()=>{u({enabled:r,goLiveMessage:o})},[i,l]);let k=()=>!0,N=e=>{let{fieldName:n,value:t}=e;console.log(n,t),u({...d,[n]:t}),w(k())},C=()=>{j(null),clearTimeout(null)},S=async()=>{await (0,m.Si)({apiPath:"/notifications/browser",data:{value:d},onSuccess:()=>{t({fieldName:"browser",value:d,path:"notifications"}),j((0,x.kg)(x.zv,"Updated.")),setTimeout(C,m.sI)},onError:e=>{j((0,x.kg)(x.Un,e)),setTimeout(C,m.sI)}})};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(y,{children:"Browser Alerts"}),(0,s.jsx)("p",{className:"description reduced-margins",children:"Viewers can opt into being notified when you go live with their browser."}),(0,s.jsx)("p",{className:"description reduced-margins",children:"Not all browsers support this."}),(0,s.jsx)(g.Z,{apiPath:"",fieldName:"enabled",label:"Enable browser notifications",onChange:e=>{N({fieldName:"enabled",value:e})},checked:d.enabled}),(0,s.jsx)("div",{style:{display:d.enabled?"block":"none"},children:(0,s.jsx)(f.nv,{...m.mv.goLiveMessage,required:!0,type:f.Sk,value:d.goLiveMessage,onChange:N})}),(0,s.jsx)(a.default,{type:"primary",style:{display:v?"inline-block":"none",position:"relative",marginLeft:"auto",right:"0",marginTop:"20px"},onClick:S,children:"Save"}),(0,s.jsx)(p.E,{status:b})]})},{Title:w}=o.default,k=()=>{let e=(0,c.useContext)(h.a),{serverConfig:n}=e||{},{federation:t}=n||{},{enabled:i}=t||{},[l,r]=(0,c.useState)({});return(0,c.useEffect)(()=>{r({enabled:i})},[i]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(w,{children:"Fediverse Social"}),(0,s.jsx)("p",{className:"description",children:"Enabling the Fediverse social features will not just alert people to when you go live, but also enable other functionality."}),(0,s.jsxs)("p",{children:["Fediverse social features:"," ",(0,s.jsx)("span",{style:{color:t.enabled?"green":"red"},children:l.enabled?"Enabled":"Disabled"})]}),(0,s.jsx)(u(),{passHref:!0,href:"/admin/config-federation/",children:(0,s.jsx)(a.default,{type:"primary",style:{position:"relative",marginLeft:"auto",right:"0",marginTop:"20px"},children:"Configure"})})]})};var N=t(78353),C=t(53899),S=t(34261);let{Title:E}=o.default;function T(){let[e,n]=(0,c.useState)(null),t=(0,c.useContext)(h.a),{serverConfig:o}=t||{},{yp:d}=o,{instanceUrl:f}=d,[p,g]=(0,c.useState)(!1);(0,c.useEffect)(()=>{n({instanceUrl:f})},[d]);let x=""!==f,b=!x&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.default,{message:"You must set your server URL before you can enable this feature.",type:"warning",showIcon:!0}),(0,s.jsx)("br",{}),(0,s.jsx)(N.$7,{fieldName:"instanceUrl",...m.yi,value:(null==e?void 0:e.instanceUrl)||"",initialValue:d.instanceUrl,type:N.xA,onChange:t=>{let{fieldName:s,value:i}=t;g((0,C.jv)(i)),n({...e,[s]:i})},onSubmit:()=>{p&&n({...e,enabled:!1})},required:!0})]});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(E,{children:"Notifications"}),(0,s.jsxs)("p",{className:"description",children:["Let your viewers know when you go live by supporting any of the below notification channels."," ",(0,s.jsx)("a",{href:"https://owncast.online/docs/notifications/?source=admin",target:"_blank",rel:"noopener noreferrer",children:"Learn more about live notifications."})]}),b,(0,s.jsxs)(r.Z,{children:[(0,s.jsx)(l.Z,{span:10,className:"form-module ".concat(x?"":"disabled"),style:{margin:"5px",display:"flex",flexDirection:"column"},children:(0,s.jsx)(v,{})}),(0,s.jsx)(l.Z,{span:10,className:"form-module ".concat(x?"":"disabled"),style:{margin:"5px",display:"flex",flexDirection:"column"},children:(0,s.jsx)(j,{})}),(0,s.jsx)(l.Z,{span:10,className:"form-module ".concat(x?"":"disabled"),style:{margin:"5px",display:"flex",flexDirection:"column"},children:(0,s.jsx)(k,{})}),(0,s.jsxs)(l.Z,{span:10,className:"form-module ".concat(x?"":"disabled"),style:{margin:"5px",display:"flex",flexDirection:"column"},children:[(0,s.jsx)(E,{children:"Custom"}),(0,s.jsx)("p",{className:"description",children:"Build your own notifications by using custom webhooks."}),(0,s.jsx)(u(),{passHref:!0,href:"/admin/webhooks",children:(0,s.jsx)(a.default,{type:"primary",style:{position:"relative",marginLeft:"auto",right:"0",marginTop:"20px"},children:"Create"})})]})]})]})}T.getLayout=function(e){return(0,s.jsx)(S.l,{page:e})}}},function(e){e.O(0,[5596,1130,4104,9403,1024,3942,971,6697,1664,1749,1700,2122,4938,4261,9774,2888,179],function(){return e(e.s=7148)}),_N_E=e.O()}]); |