1 line
8.2 KiB
JavaScript
Vendored
1 line
8.2 KiB
JavaScript
Vendored
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1398],{28706: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:"M328 544h152v152c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V544h152c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H544V328c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v152H328c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}},{tag:"path",attrs:{d:"M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"plus-square",theme:"outlined"}},90306: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:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"}},91873:function(e,t,r){"use strict";var n=r(64836),i=r(18698);t.Z=void 0;var o=n(r(42122)),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==i(e)&&"function"!=typeof e)return{default:e};var r=c(t);if(r&&r.has(e))return r.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var a=o?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=e[s]}return n.default=e,r&&r.set(e,n),n}(r(67294)),a=n(r(28706)),l=n(r(92074));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(c=function(e){return e?r:t})(e)}var d=function(e,t){return s.createElement(l.default,(0,o.default)((0,o.default)({},e),{},{ref:t,icon:a.default}))};d.displayName="PlusSquareOutlined";var u=s.forwardRef(d);t.Z=u},35855:function(e,t,r){"use strict";var n=r(64836),i=r(18698);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(r(42122)),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==i(e)&&"function"!=typeof e)return{default:e};var r=c(t);if(r&&r.has(e))return r.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var a=o?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=e[s]}return n.default=e,r&&r.set(e,n),n}(r(67294)),a=n(r(90306)),l=n(r(92074));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(c=function(e){return e?r:t})(e)}var d=function(e,t){return s.createElement(l.default,(0,o.default)((0,o.default)({},e),{},{ref:t,icon:a.default}))};d.displayName="UploadOutlined";var u=s.forwardRef(d);t.default=u},41398:function(e,t,r){"use strict";r.r(t),r.d(t,{BrowserNotifyModal:function(){return k}});var n=r(85893),i=r(85818),o=r(71577),s=r(11382),a=r(71230),l=r(67294),c=r(35855),d=r(91873),u=r(4480),f=r(4511),h=r(44974);async function p(e,t,r){console.log("saveNotificationRegistration");let n={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channel:e,destination:t})};await fetch("".concat("/api/notifications/register","?accessToken=").concat(r),n)}async function w(e){let t=await navigator.serviceWorker.ready,r=await t.pushManager.getSubscription();return r||(r=await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(e){let t="=".repeat((4-e.length%4)%4),r=(e+t).replace(/-/g,"+").replace(/_/g,"/"),n=window.atob(r),i=new Uint8Array(n.length);for(let e=0;e<n.length;++e)i[e]=n.charCodeAt(e);return i}(e)})),JSON.stringify(r)}var v=r(67940),j=r.n(v),y=r(69183),b=r(63516),g=r(34148);let{Title:x}=i.default,m=()=>(0,n.jsx)("div",{children:"Browser notifications are not supported in your browser."}),_=()=>(0,n.jsx)("div",{children:"Browser notifications are not supported for local servers."}),N=()=>(0,n.jsxs)("div",{children:[(0,n.jsx)(x,{level:3,children:"Get notified on iOS"}),"It takes a couple extra steps to make sure you get notified when your favorite streams go live.",(0,n.jsxs)("ol",{children:[(0,n.jsxs)("li",{children:["Tap the ",(0,n.jsx)("strong",{children:"share"})," button ",(0,n.jsx)(c.default,{})," in Safari."]}),(0,n.jsxs)("li",{children:["Scroll down and tap ",(0,n.jsx)("strong",{children:"“Add to Home Screen”"})," ",(0,n.jsx)(d.Z,{}),"."]}),(0,n.jsxs)("li",{children:["Tap ",(0,n.jsx)("strong",{children:"“Add”"}),"."]}),(0,n.jsx)("li",{children:"Give this link a name and tap the new icon on your home screen"}),(0,n.jsx)("li",{children:"Come back to this screen and enable notifications."}),(0,n.jsxs)("li",{children:["Tap ",(0,n.jsx)("strong",{children:"“Allow”"})," when prompted."]})]})]}),M=e=>{let{start:t}=e;return(0,n.jsx)("div",{id:"browser-push-preview-box",className:j().pushPreview,children:(0,n.jsxs)("div",{className:j().inner,children:[(0,n.jsxs)("div",{className:j().title,children:[window.location.toString()," wants to"]}),(0,n.jsxs)("div",{className:j().permissionLine,children:[(0,n.jsx)("svg",{className:j().bell,width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)("path",{d:"M14 12.3333V13H2V12.3333L3.33333 11V7C3.33333 4.93333 4.68667 3.11333 6.66667 2.52667C6.66667 2.46 6.66667 2.4 6.66667 2.33333C6.66667 1.97971 6.80714 1.64057 7.05719 1.39052C7.30724 1.14048 7.64638 1 8 1C8.35362 1 8.69276 1.14048 8.94281 1.39052C9.19286 1.64057 9.33333 1.97971 9.33333 2.33333C9.33333 2.4 9.33333 2.46 9.33333 2.52667C11.3133 3.11333 12.6667 4.93333 12.6667 7V11L14 12.3333ZM9.33333 13.6667C9.33333 14.0203 9.19286 14.3594 8.94281 14.6095C8.69276 14.8595 8.35362 15 8 15C7.64638 15 7.30724 14.8595 7.05719 14.6095C6.80714 14.3594 6.66667 14.0203 6.66667 13.6667",fill:"#676670"})}),(0,n.jsx)("span",{className:j().showNotificationsText,children:"Show notifications"})]}),(0,n.jsxs)("div",{className:j().buttonRow,children:[(0,n.jsx)(o.Z,{type:"primary",onClick:()=>{t()},children:"Allow"}),(0,n.jsx)("button",{type:"button",className:j().disabled,children:"Block"})]})]})})},O=()=>(0,n.jsxs)("div",{children:[(0,n.jsx)(x,{level:2,children:"Notifications are enabled"}),"To disable push notifications from ",window.location.hostname.toString()," access your browser permissions for this site and turn off notifications.",(0,n.jsx)("a",{href:"https://owncast.online/docs/notifications",children:" Learn more."})]}),k=()=>{let[e,t]=(0,l.useState)(null),r=(0,u.sJ)(h.FI),i=(0,u.sJ)(h.g1),[o,c]=(0,l.useState)(!1),d=(0,g.w)()&&"default"!==Notification.permission,{notifications:v}=i,{browser:x}=v,{publicKey:k}=x,C=x.enabled&&((0,g.w)()||(0,b.rZ)());if(d)return(0,n.jsx)(O,{});if((0,b.C9)()&&!(0,b.rZ)())return(0,n.jsx)(N,{});let P=async()=>{if(!(0,g.w)()||"default"===Notification.permission){c(!0);try{let e=await w(k);p("BROWSER_PUSH_NOTIFICATION",e,r),t(null)}catch(e){t("Error registering for live notifications: ".concat(e.message,". Make sure you're not inside a private browser environment or have previously disabled notifications for this stream."))}c(!1)}};return"localhost"===window.location.hostname?(0,n.jsx)(_,{}):C?(0,n.jsx)(f.SV,{fallbackRender:e=>{let{error:t,resetErrorBoundary:r}=e;return(0,n.jsx)(y.A,{componentName:"BrowserNotifyModal",message:t.message,retryFunction:r})},children:(0,n.jsxs)(s.Z,{spinning:o,children:[(0,n.jsxs)(a.Z,{className:j().description,children:["Get notified right in the browser each time this stream goes live.",(0,n.jsx)("a",{href:"https://owncast.online/docs/notifications/#browser-notifications",children:"Learn more"}),"\xa0 about Owncast browser notifications."]}),(0,n.jsx)(a.Z,{children:e}),(0,n.jsx)(M,{start:()=>P()})]})}):(0,n.jsx)(m,{})}},67940:function(e){e.exports={description:"BrowserNotifyModal_description__tMKKq",pushPreview:"BrowserNotifyModal_pushPreview__4Og4q",inner:"BrowserNotifyModal_inner__uhFDw",title:"BrowserNotifyModal_title__dd_Lh",permissionLine:"BrowserNotifyModal_permissionLine__K8nyJ",bell:"BrowserNotifyModal_bell__9mIeI",buttonRow:"BrowserNotifyModal_buttonRow__oxJUg",disabled:"BrowserNotifyModal_disabled__v88lb"}}}]); |