mirror of
https://github.com/owncast/owncast.git
synced 2025-01-05 08:07:58 +03:00
1 line
No EOL
17 KiB
JavaScript
Vendored
1 line
No EOL
17 KiB
JavaScript
Vendored
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7230],{25330:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"}}]},name:"check",theme:"outlined"}},72652:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"}},71961:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=_interopRequireDefault(a(79686));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}t.default=n,e.exports=n},5085:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=_interopRequireDefault(a(76720));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}t.default=n,e.exports=n},79686:function(e,t,a){"use strict";var n=a(64836),r=a(18698);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(a(42122)),l=_interopRequireWildcard(a(67294)),c=n(a(25330)),s=n(a(92074));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,a=new WeakMap;return(_getRequireWildcardCache=function(e){return e?a:t})(e)}function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var a=_getRequireWildcardCache(t);if(a&&a.has(e))return a.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if("default"!==l&&Object.prototype.hasOwnProperty.call(e,l)){var c=o?Object.getOwnPropertyDescriptor(e,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=e[l]}return n.default=e,a&&a.set(e,n),n}var CheckOutlined=function(e,t){return l.createElement(s.default,(0,o.default)((0,o.default)({},e),{},{ref:t,icon:c.default}))};CheckOutlined.displayName="CheckOutlined";var i=l.forwardRef(CheckOutlined);t.default=i},76720:function(e,t,a){"use strict";var n=a(64836),r=a(18698);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(a(42122)),l=_interopRequireWildcard(a(67294)),c=n(a(72652)),s=n(a(92074));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,a=new WeakMap;return(_getRequireWildcardCache=function(e){return e?a:t})(e)}function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var a=_getRequireWildcardCache(t);if(a&&a.has(e))return a.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if("default"!==l&&Object.prototype.hasOwnProperty.call(e,l)){var c=o?Object.getOwnPropertyDescriptor(e,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=e[l]}return n.default=e,a&&a.set(e,n),n}var DownOutlined=function(e,t){return l.createElement(s.default,(0,o.default)((0,o.default)({},e),{},{ref:t,icon:c.default}))};DownOutlined.displayName="DownOutlined";var i=l.forwardRef(DownOutlined);t.default=i},83514:function(e,t,a){"use strict";var n=a(75263).default,r=a(64836).default;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(a(10434)),l=r(a(38416)),c=r(a(94184)),s=n(a(67294)),i=a(31929),__rest=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)0>t.indexOf(n[r])&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]]);return a};t.default=function(e){var t=e.prefixCls,a=e.className,n=e.checked,r=e.onChange,d=e.onClick,u=__rest(e,["prefixCls","className","checked","onChange","onClick"]),f=(0,s.useContext(i.ConfigContext).getPrefixCls)("tag",t),p=(0,c.default)(f,(0,l.default)((0,l.default)({},"".concat(f,"-checkable"),!0),"".concat(f,"-checkable-checked"),n),a);return s.createElement("span",(0,o.default)({},u,{className:p,onClick:function(e){null==r||r(!n),null==d||d(e)}}))}},59361:function(e,t,a){"use strict";var n=a(75263).default,r=a(64836).default;t.Z=void 0;var o=r(a(38416)),l=r(a(10434)),c=r(a(27424)),s=r(a(40753)),i=r(a(94184)),d=r(a(18475)),u=n(a(67294)),f=a(31929),p=a(45471),h=r(a(61539));r(a(13594));var C=r(a(83514)),__rest=function(e,t){var a={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(a[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,n=Object.getOwnPropertySymbols(e);r<n.length;r++)0>t.indexOf(n[r])&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(a[n[r]]=e[n[r]]);return a},_=new RegExp("^(".concat(p.PresetColorTypes.join("|"),")(-inverse)?$")),M=new RegExp("^(".concat(p.PresetStatusColorTypes.join("|"),")$")),E=u.forwardRef(function(e,t){var a=e.prefixCls,n=e.className,r=e.style,p=e.children,C=e.icon,E=e.color,y=e.onClose,O=e.closeIcon,m=e.closable,v=void 0!==m&&m,g=__rest(e,["prefixCls","className","style","children","icon","color","onClose","closeIcon","closable"]),b=u.useContext(f.ConfigContext),N=b.getPrefixCls,S=b.direction,j=u.useState(!0),P=(0,c.default)(j,2),x=P[0],R=P[1];u.useEffect(function(){"visible"in g&&R(g.visible)},[g.visible]);var isPresetColor=function(){return!!E&&(_.test(E)||M.test(E))},w=(0,l.default)({backgroundColor:E&&!isPresetColor()?E:void 0},r),A=isPresetColor(),k=N("tag",a),U=(0,i.default)(k,(0,o.default)((0,o.default)((0,o.default)((0,o.default)({},"".concat(k,"-").concat(E),A),"".concat(k,"-has-color"),E&&!A),"".concat(k,"-hidden"),!x),"".concat(k,"-rtl"),"rtl"===S),n),handleCloseClick=function(e){e.stopPropagation(),null==y||y(e),!e.defaultPrevented&&("visible"in g||R(!1))},T="onClick"in g||p&&"a"===p.type,I=(0,d.default)(g,["visible"]),D=C||null,L=D?u.createElement(u.Fragment,null,D,u.createElement("span",null,p)):p,F=u.createElement("span",(0,l.default)({},I,{ref:t,className:U,style:w}),L,v?O?u.createElement("span",{className:"".concat(k,"-close-icon"),onClick:handleCloseClick},O):u.createElement(s.default,{className:"".concat(k,"-close-icon"),onClick:handleCloseClick}):null);return T?u.createElement(h.default,null,F):F});E.CheckableTag=C.default,t.Z=E},98332:function(e,t,a){"use strict";a.r(t),a.d(t,{ChatModerationActionMenu:function(){return ChatModerationActionMenu}});var n=a(85893),r=a(77834),o=a(74048),l=a(11187),c=a(56697),s=a(67294),i=a(5152),d=a.n(i),u=a(95849),f=a(65400),p=a(5789),h=a(68469),C=a(55673),_=a(89552),M=a(2307),E=a(59361),y=a(58091),O=a(4511);let ChatModerationService=class ChatModerationService{static async removeMessage(e,t){let a=new URL("/api/chat/messagevisibility",window.location.toString());a.searchParams.append("accessToken",t);let n=a.toString(),r={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({idArray:[e]})};await fetch(n,r)}static async banUser(e,t){let a=new URL("/api/chat/users/setenabled",window.location.toString());a.searchParams.append("accessToken",t);let n=a.toString(),r={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e})};await fetch(n,r)}};var m=a(54787),v=a.n(m),g=a(19120),b=a(50057);let{Panel:N}=h.default,S=d()(()=>a.e(7949).then(a.t.bind(a,77949,23)),{loadableGenerated:{webpack:()=>[77949]},ssr:!1}),removeMessage=async(e,t)=>{try{ChatModerationService.removeMessage(e,t)}catch(e){console.error(e)}},ValueRow=e=>{let{label:t,value:a}=e;return(0,n.jsxs)(C.Z,{justify:"space-around",align:"middle",children:[(0,n.jsx)(p.Z,{span:12,children:t}),(0,n.jsx)(p.Z,{span:12,children:a})]})},ConnectedClient=e=>{let{client:t}=e,{messageCount:a,connectedAt:r,geo:o}=t,l=(0,y.Z)(new Date(r),"PP pp");return(0,n.jsxs)("div",{children:[(0,n.jsx)(ValueRow,{label:"Messages Sent",value:a.toString()}),"N/A"!==o&&(0,n.jsx)(ValueRow,{label:"Geo",value:o}),(0,n.jsx)(ValueRow,{label:"Connected At",value:l})]})},UserColorBlock=e=>{let{color:t}=e;return(0,n.jsxs)("div",{className:v().colorBlock,style:{backgroundColor:"var(--theme-color-users-".concat(t,")")},children:["Color ",t]})},ChatModerationDetailsModal=e=>{let{userId:t,accessToken:a}=e,[r,o]=(0,s.useState)(null),[l,c]=(0,s.useState)(!0),getDetails=async()=>{try{let e=await (await fetch("/api/moderation/chat/user/".concat(t,"?accessToken=").concat(a))).json();o(e),c(!1)}catch(e){console.error(e)}};if((0,s.useEffect)(()=>{getDetails()},[]),!r)return null;let{user:i,connectedClients:d,messages:u}=r,{displayColor:p,createdAt:C,previousNames:m,scopes:v,isBot:j,authenticated:P}=i,x=d.reduce((e,t)=>e+t.messageCount,0),R=(0,y.Z)(new Date(C),"PP pp"),w=[{title:"Message",dataIndex:"body",key:"body"},{title:"Sent At",dataIndex:"timestamp",key:"timestamp",render:e=>(0,y.Z)(new Date(e),"PP pp")},{title:"Delete",key:"delete",render:(e,t)=>(0,n.jsx)(f.default,{type:"primary",ghost:!0,icon:(0,n.jsx)(S,{}),onClick:()=>removeMessage(t.id,a)})}];return(0,n.jsx)(O.SV,{fallbackRender:e=>{let{error:t,resetErrorBoundary:a}=e;return(0,n.jsx)(b.A,{componentName:"ChatModerationDetailsModal",message:t.message,retryFunction:a})},children:(0,n.jsxs)(_.default,{spinning:l,children:[(0,n.jsx)(UserColorBlock,{color:p}),null==v?void 0:v.map(e=>(0,n.jsx)(E.Z,{children:e},e)),P&&(0,n.jsx)(E.Z,{children:"Authenticated"}),j&&(0,n.jsx)(E.Z,{children:"Bot"}),(0,n.jsx)(ValueRow,{label:"Messages Sent Across Clients",value:x.toString()}),(0,n.jsx)(ValueRow,{label:"User Created",value:R}),(0,n.jsx)(ValueRow,{label:"Known As",value:m.join(",")}),(0,n.jsxs)(h.default,{accordion:!0,children:[(0,n.jsx)(N,{header:"Currently Connected Clients",children:(0,n.jsx)(h.default,{accordion:!0,children:d.map(e=>(0,n.jsx)(N,{header:(0,g.AB)(e.userAgent),children:(0,n.jsx)(ConnectedClient,{client:e})},e.id))})},"connected-clients"),(0,n.jsx)(h.default,{accordion:!0,children:(0,n.jsx)(N,{header:"Recent Chat Messages",children:(0,n.jsx)(M.Z,{size:"small",pagination:null,columns:w,dataSource:u,rowKey:"id"})},"chat-messages")})]})]})})},{confirm:j}=c.default,P=d()(()=>Promise.resolve().then(a.t.bind(a,74337,23)),{loadableGenerated:{webpack:()=>[74337]},ssr:!1}),x=d()(()=>Promise.resolve().then(a.t.bind(a,67039,23)),{loadableGenerated:{webpack:()=>[67039]},ssr:!1}),R=d()(()=>Promise.resolve().then(a.t.bind(a,84645,23)),{loadableGenerated:{webpack:()=>[84645]},ssr:!1}),w=d()(()=>a.e(500).then(a.t.bind(a,40500,23)),{loadableGenerated:{webpack:()=>[40500]},ssr:!1}),ChatModerationActionMenu=e=>{let{messageID:t,userID:a,userDisplayName:c,accessToken:i}=e,[d,f]=(0,s.useState)(!1),handleBanUser=async()=>{try{await ChatModerationService.banUser(a,i)}catch(e){console.error(e),l.default.error(e)}},handleHideMessage=async()=>{try{await ChatModerationService.removeMessage(t,i)}catch(e){console.error(e),l.default.error(e)}},confirmHideMessage=async()=>{j({icon:(0,n.jsx)(x,{}),content:"Are you sure you want to remove this message from ".concat(c,"?"),onOk(){handleHideMessage()}})},confirmBanUser=async()=>{j({icon:(0,n.jsx)(x,{}),content:"Are you sure you want to ban ".concat(c," from chat?"),onOk(){handleBanUser()}})},p=[{icon:(0,n.jsx)(R,{}),label:"Hide Message",key:"hide-message",onClick:confirmHideMessage},{icon:(0,n.jsx)(P,{}),label:"Ban User",key:"ban-user",onClick:confirmBanUser},{label:"More Info...",key:"more-info",onClick:()=>f(!0)}];return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(r.default,{menu:{items:p},trigger:["click"],children:(0,n.jsx)("button",{type:"button","aria-label":"Chat moderation options",onClick:e=>e.preventDefault(),children:(0,n.jsx)(o.default,{children:(0,n.jsx)(w,{})})})}),(0,n.jsx)(u.Modal,{title:c,open:d,handleCancel:()=>{f(!1)},children:(0,n.jsx)(ChatModerationDetailsModal,{userId:a,accessToken:i})})]})}},95849:function(e,t,a){"use strict";a.r(t),a.d(t,{Modal:function(){return Modal}});var n=a(85893),r=a(89552),o=a(56697),l=a(67294),c=a(4511),s=a(50057),i=a(2008),d=a.n(i);let Modal=e=>{let{title:t,url:a,open:i,handleOk:u,handleCancel:f,afterClose:p,height:h,width:C,children:_}=e,[M,E]=(0,l.useState)(!!a),y="100%",O="520px";a&&(y="70vh",O="900px");let m={padding:"0px",minHeight:h,height:null!=h?h:y},v=a&&(0,n.jsx)("iframe",{title:t,src:a,width:"100%",height:"100%",sandbox:"allow-same-origin allow-scripts allow-popups allow-forms",frameBorder:"0",allowFullScreen:!0,style:{display:"block"},onLoad:()=>E(!1)});return(0,n.jsx)(o.default,{title:t,open:i,onOk:u,onCancel:f,afterClose:p,bodyStyle:m,width:null!=C?C:O,zIndex:999,footer:null,centered:!0,destroyOnClose:!0,className:d().modal,children:(0,n.jsx)(c.SV,{fallbackRender:e=>{let{error:t,resetErrorBoundary:a}=e;return(0,n.jsx)(s.A,{componentName:"Modal",message:t.message,retryFunction:a})},children:(0,n.jsxs)("div",{id:"modal-container",style:{height:"100%"},children:[v&&(0,n.jsx)("div",{style:{display:M?"none":"inline"},children:v}),_&&(0,n.jsx)("div",{className:d().content,children:_}),M&&(0,n.jsx)(r.default,{className:d().spinner,spinning:M,size:"large",tip:t})]})})})};Modal.defaultProps={url:void 0,children:void 0,handleOk:void 0,handleCancel:void 0,afterClose:void 0}},19120:function(e,t,a){"use strict";a.d(t,{AB:function(){return formatUAstring},Qr:function(){return isEmptyObject},t5:function(){return formatIPAddress},wS:function(){return parseSecondsToDurationString}});var n=a(42238),r=a.n(n);function formatIPAddress(e){let t=e.split(":");t[t.length-1]="";let a=t.join(":");return"[::1]"===(a=a.slice(0,a.length-1))||"127.0.0.1"===a?"Localhost":a}function isEmptyObject(e){return!e||0===Object.keys(e).length&&e.constructor===Object}function padLeft(e,t,a){return String(t.repeat(a)+e).slice(-a)}function parseSecondsToDurationString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=Number.isFinite(+e)?Math.abs(e):0,a=Math.floor(t/86400),n=a>0?"".concat(a," day").concat(a>1?"s":""," "):"",r=Math.floor(t/3600%24),o=r||a?padLeft("".concat(r,":"),"0",3):"",l=padLeft("".concat(Math.floor(t/60%60),":"),"0",3),c=padLeft("".concat(Math.floor(t%60)),"0",2);return n+o+l+c}function formatUAstring(e){let t=r()(e),{device:a,os:n,browser:o}=t,{major:l,name:c}=o,{version:s,name:i}=n,{model:d,type:u}=a;if("libmpv"===e)return"mpv media player";if(!c||!l||!i)return e;let f=d||u?" (".concat(d||u,")"):"";return"".concat(c," ").concat(l," on ").concat(i," ").concat(s,"\n ").concat(f)}},54787:function(e){e.exports={modalContainer:"ChatModerationDetailsModal_modalContainer__mtTcg",chatHistory:"ChatModerationDetailsModal_chatHistory__Iksxq",colorBlock:"ChatModerationDetailsModal_colorBlock__eRrFu",displayName:"ChatModerationDetailsModal_displayName__vcRZ5"}},2008:function(e){e.exports={spinner:"Modal_spinner__vORWo",content:"Modal_content__mZkaV",modal:"Modal_modal___vOcW"}},27712:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a={MAC_ENTER:3,BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,QUESTION_MARK:63,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,META:91,WIN_KEY_RIGHT:92,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLOCK:144,SEMICOLON:186,DASH:189,EQUALS:187,COMMA:188,PERIOD:190,SLASH:191,APOSTROPHE:192,SINGLE_QUOTE:222,OPEN_SQUARE_BRACKET:219,BACKSLASH:220,CLOSE_SQUARE_BRACKET:221,WIN_KEY:224,MAC_FF_META:224,WIN_IME:229,isTextModifyingKeyEvent:function(e){var t=e.keyCode;if(e.altKey&&!e.ctrlKey||e.metaKey||t>=a.F1&&t<=a.F12)return!1;switch(t){case a.ALT:case a.CAPS_LOCK:case a.CONTEXT_MENU:case a.CTRL:case a.DOWN:case a.END:case a.ESC:case a.HOME:case a.INSERT:case a.LEFT:case a.MAC_FF_META:case a.META:case a.NUMLOCK:case a.NUM_CENTER:case a.PAGE_DOWN:case a.PAGE_UP:case a.PAUSE:case a.PRINT_SCREEN:case a.RIGHT:case a.SHIFT:case a.UP:case a.WIN_KEY:case a.WIN_KEY_RIGHT:return!1;default:return!0}},isCharacterKey:function(e){if(e>=a.ZERO&&e<=a.NINE||e>=a.NUM_ZERO&&e<=a.NUM_MULTIPLY||e>=a.A&&e<=a.Z||-1!==window.navigator.userAgent.indexOf("WebKit")&&0===e)return!0;switch(e){case a.SPACE:case a.QUESTION_MARK:case a.NUM_PLUS:case a.NUM_MINUS:case a.NUM_PERIOD:case a.NUM_DIVISION:case a.SEMICOLON:case a.DASH:case a.EQUALS:case a.COMMA:case a.PERIOD:case a.SLASH:case a.APOSTROPHE:case a.SINGLE_QUOTE:case a.OPEN_SQUARE_BRACKET:case a.BACKSLASH:case a.CLOSE_SQUARE_BRACKET:return!0;default:return!1}}};t.default=a}}]); |