1 line
8.7 KiB
JavaScript
Vendored
1 line
8.7 KiB
JavaScript
Vendored
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1234],{57838:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(97685),o=n(67294);function a(){var e=o.useReducer(function(e){return e+1},0);return(0,r.Z)(e,2)[1]}},15746:function(e,t,n){"use strict";var r=n(21584);t.Z=r.Z},25378:function(e,t,n){"use strict";var r=n(67294),o=n(57838),a=n(24308);t.Z=function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=(0,r.useRef)({}),n=(0,o.Z)();return(0,r.useEffect)(function(){var r=a.ZP.subscribe(function(r){t.current=r,e&&n()});return function(){return a.ZP.unsubscribe(r)}},[]),t.current}},97183:function(e,t,n){"use strict";var r=n(2897),o=n(7293),a=r.ZP;a.Header=r.h4,a.Footer=r.$_,a.Content=r.VY,a.Sider=o.Z,t.default=a},71230:function(e,t,n){"use strict";var r=n(92820);t.Z=r.Z},20550:function(e,t,n){"use strict";n.d(t,{Z:function(){return y}});var r=n(4942),o=n(87462),a=n(97685),c=n(97937),i=n(94184),s=n.n(i),l=n(98423),u=n(67294),d=n(53124),f=n(98787),h=n(68349),p=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)0>t.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},m=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)0>t.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n},b=new RegExp("^(".concat(f.Y.join("|"),")(-inverse)?$")),g=new RegExp("^(".concat(f.E.join("|"),")$")),v=u.forwardRef(function(e,t){var n,i=e.prefixCls,f=e.className,p=e.style,v=e.children,y=e.icon,Z=e.color,j=e.onClose,x=e.closeIcon,k=e.closable,w=void 0!==k&&k,E=m(e,["prefixCls","className","style","children","icon","color","onClose","closeIcon","closable"]),C=u.useContext(d.E_),O=C.getPrefixCls,S=C.direction,P=u.useState(!0),T=(0,a.Z)(P,2),_=T[0],N=T[1];u.useEffect(function(){"visible"in E&&N(E.visible)},[E.visible]);var I=function(){return!!Z&&(b.test(Z)||g.test(Z))},A=(0,o.Z)({backgroundColor:Z&&!I()?Z:void 0},p),M=I(),R=O("tag",i),D=s()(R,(n={},(0,r.Z)(n,"".concat(R,"-").concat(Z),M),(0,r.Z)(n,"".concat(R,"-has-color"),Z&&!M),(0,r.Z)(n,"".concat(R,"-hidden"),!_),(0,r.Z)(n,"".concat(R,"-rtl"),"rtl"===S),n),f),W=function(e){e.stopPropagation(),null==j||j(e),!e.defaultPrevented&&("visible"in E||N(!1))},U="onClick"in E||v&&"a"===v.type,G=(0,l.Z)(E,["visible"]),L=y||null,F=L?u.createElement(u.Fragment,null,L,u.createElement("span",null,v)):v,H=u.createElement("span",(0,o.Z)({},G,{ref:t,className:D,style:A}),F,w?x?u.createElement("span",{className:"".concat(R,"-close-icon"),onClick:W},x):u.createElement(c.Z,{className:"".concat(R,"-close-icon"),onClick:W}):null);return U?u.createElement(h.Z,null,H):H});v.CheckableTag=function(e){var t,n=e.prefixCls,a=e.className,c=e.checked,i=e.onChange,l=e.onClick,f=p(e,["prefixCls","className","checked","onChange","onClick"]),h=(0,u.useContext(d.E_).getPrefixCls)("tag",n),m=s()(h,(t={},(0,r.Z)(t,"".concat(h,"-checkable"),!0),(0,r.Z)(t,"".concat(h,"-checkable-checked"),c),t),a);return u.createElement("span",(0,o.Z)({},f,{className:m,onClick:function(e){null==i||i(!c),null==l||l(e)}}))};var y=v},13882:function(e,t,n){"use strict";function r(e,t){if(t.length<e)throw TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}n.d(t,{Z:function(){return r}})},93645:function(e,t,n){"use strict";n.d(t,{u:function(){return o}});var r={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function o(e){return e?r[e]:r.trunc}},59910:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(19013),o=n(13882);function a(e,t){return(0,o.Z)(2,arguments),(0,r.Z)(e).getTime()-(0,r.Z)(t).getTime()}},11699:function(e,t,n){"use strict";n.d(t,{Z:function(){return c}});var r=n(59910),o=n(13882),a=n(93645);function c(e,t,n){(0,o.Z)(2,arguments);var c=(0,r.Z)(e,t)/1e3;return(0,a.u)(null==n?void 0:n.roundingMethod)(c)}},19013:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(71002),o=n(13882);function a(e){(0,o.Z)(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===(0,r.Z)(e)&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):(("string"==typeof e||"[object String]"===t)&&"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))}},67742:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/webhooks",function(){return n(89651)}])},89651:function(e,t,n){"use strict";n.r(t);var r=n(85893),o=n(85818),a=n(94199),c=n(20550),i=n(15746),s=n(32808),l=n(85402),u=n(79531),d=n(71230),f=n(71577),h=n(26713),p=n(54398),m=n(5152),b=n.n(m),g=n(67294),v=n(81453),y=n(53899),Z=n(34261);let{Title:j,Paragraph:x}=o.default,k=b()(()=>Promise.all([n.e(2074),n.e(7949)]).then(n.t.bind(n,77949,23)),{loadableGenerated:{webpack:()=>[77949]},ssr:!1}),w={CHAT:{name:"Chat messages",description:"When a user sends a chat message",color:"purple"},USER_JOINED:{name:"User joined",description:"When a user joins the chat",color:"green"},NAME_CHANGE:{name:"User name changed",description:"When a user changes their name",color:"blue"},"VISIBILITY-UPDATE":{name:"Message visibility changed",description:"When a message visibility changes, likely due to moderation",color:"red"},STREAM_STARTED:{name:"Stream started",description:"When a stream starts",color:"orange"},STREAM_STOPPED:{name:"Stream stopped",description:"When a stream stops",color:"cyan"},STREAM_TITLE_UPDATED:{name:"Stream title updated",description:"When a stream title is changed",color:"yellow"}},E=e=>{let{onOk:t,onCancel:n,open:o}=e,[a,c]=(0,g.useState)([]),[h,p]=(0,g.useState)(""),m=Object.keys(w).map(e=>({value:e,label:w[e].description})),b={disabled:(null==a?void 0:a.length)===0||!(0,y.jv)(h)},v=m.map(e=>(0,r.jsx)(i.Z,{span:8,children:(0,r.jsx)(s.Z,{value:e.value,children:e.label})},e.value));return(0,r.jsxs)(l.default,{title:"Create New Webhook",open:o,onOk:function(){t(h,a),p(""),c(null)},onCancel:n,okButtonProps:b,children:[(0,r.jsx)("div",{children:(0,r.jsx)(u.default,{value:h,placeholder:"https://myserver.com/webhook",onChange:e=>p(e.currentTarget.value.trim()),type:"url",pattern:y.ax})}),(0,r.jsx)("p",{children:"Select the events that will be sent to this webhook."}),(0,r.jsx)(s.Z.Group,{style:{width:"100%"},value:a,onChange:function(e){c(e)},children:(0,r.jsx)(d.Z,{children:v})}),(0,r.jsx)("p",{children:(0,r.jsx)(f.Z,{type:"primary",onClick:function(){c(Object.keys(w))},children:"Select all"})})]})},C=()=>{let[e,t]=(0,g.useState)([]),[n,o]=(0,g.useState)(!1);function i(e){console.error("error",e)}async function s(){try{let e=await (0,v.rQ)(v.XA);t(e)}catch(e){i(e)}}async function l(e){try{await (0,v.rQ)(v.M_,{method:"POST",data:{id:e}}),s()}catch(e){i(e)}}async function u(n,r){try{let o=await (0,v.rQ)(v.iG,{method:"POST",data:{url:n,events:r}});t(e.concat(o))}catch(e){i(e)}}(0,g.useEffect)(()=>{s()},[]);let d=[{title:"",key:"delete",render:(e,t)=>(0,r.jsx)(h.Z,{size:"middle",children:(0,r.jsx)(f.Z,{onClick:()=>l(t.id),icon:(0,r.jsx)(k,{})})})},{title:"URL",dataIndex:"url",key:"url"},{title:"Events",dataIndex:"events",key:"events",render:e=>(0,r.jsx)(r.Fragment,{children:e.map(e=>(function(e){if(!e||!w[e])return null;let t=w[e];return(0,r.jsx)(a.Z,{title:t.description,children:(0,r.jsx)(c.Z,{color:t.color,children:t.name})},e)})(e))})}];return(0,r.jsxs)("div",{children:[(0,r.jsx)(j,{children:"Webhooks"}),(0,r.jsx)(x,{children:"A webhook is a callback made to an external API in response to an event that takes place within Owncast. This can be used to build chat bots or sending automatic notifications that you've started streaming."}),(0,r.jsxs)(x,{children:["Read more about how to use webhooks, with examples, at"," ",(0,r.jsx)("a",{href:"https://owncast.online/docs/integrations/?source=admin",target:"_blank",rel:"noopener noreferrer",children:"our documentation"}),"."]}),(0,r.jsx)(p.Z,{rowKey:e=>e.id,columns:d,dataSource:e,pagination:!1}),(0,r.jsx)("br",{}),(0,r.jsx)(f.Z,{type:"primary",onClick:()=>{o(!0)},children:"Create Webhook"}),(0,r.jsx)(E,{open:n,onOk:(e,t)=>{o(!1),u(e,t)},onCancel:()=>{o(!1)}})]})};C.getLayout=function(e){return(0,r.jsx)(Z.l,{page:e})},t.default=C},11163:function(e,t,n){e.exports=n(96885)}},function(e){e.O(0,[173,5874,7311,2414,4931,5402,6524,1664,5348,9915,1382,4041,3698,3013,4398,4261,9774,2888,179],function(){return e(e.s=67742)}),_N_E=e.O()}]); |