v1.7.10/release:

-abandon Google Drive,
-fix video listeners,
-add backup webhook,
-complete admin dashboard
This commit is contained in:
2021-03-08 16:41:56 -05:00
parent eced010b61
commit fef3263bad
12 changed files with 1094 additions and 446 deletions
-1
View File
@@ -27,7 +27,6 @@ try {
}
const APP_VERSION = "1.7.10";
const APP_VERSION_STRING = APP_VERSION.replace(/\./g, "");
const firebaseConfig = {
apiKey: "AIzaSyCJLuYpzXLDRmu2ttzFuSGmYcpFxqToWFU",
+1 -3
View File
@@ -47,7 +47,6 @@
"https://*.airtelxstream.in/*",
"https://*.vimeo.com/*",
"https://*.dailymotion.com/*",
"https://drive.google.com/*",
"https://api.giphy.com/*",
"https://*.voxeet.com/*"
],
@@ -90,8 +89,7 @@
"https://*.hotstar.com/*",
"https://*.airtelxstream.in/*",
"https://*.vimeo.com/*",
"https://*.dailymotion.com/*",
"https://drive.google.com/*"
"https://*.dailymotion.com/*"
],
"run_at": "document_idle",
"js": ["/static/js/content.js"],
-3
View File
@@ -43,7 +43,6 @@ export const PLAYER_SOURCE = {
AIRTEL: "airtelxstream.",
VIMEO: "vimeo.",
DAILYMOTION: "dailymotion.",
GOOGLEDRIVE: "drive.google.",
LOCAL: "localhost",
};
@@ -72,8 +71,6 @@ export const getPlayerSource = () => {
if (HREF.includes(PLAYER_SOURCE.VIMEO)) return PLAYER_SOURCE.VIMEO;
if (HREF.includes(PLAYER_SOURCE.DAILYMOTION))
return PLAYER_SOURCE.DAILYMOTION;
if (HREF.includes(PLAYER_SOURCE.GOOGLEDRIVE))
return PLAYER_SOURCE.GOOGLEDRIVE;
if (HREF.includes(PLAYER_SOURCE.LOCAL)) return PLAYER_SOURCE.LOCAL;
};
+15 -24
View File
@@ -26,8 +26,6 @@ import Loading from "./Loading";
import Inactive from "./Inactive";
import {
getUserUid,
getPlayerSource,
PLAYER_SOURCE,
getShowWPButton,
getTutorialStatus,
UpdateDailymotionVariables,
@@ -35,7 +33,6 @@ import {
import Tutorial from "./Tutorial";
const APP_VERSION = "1.7.10";
const APP_VERSION_STRING = APP_VERSION.replace(/\./g, "");
const darkTheme = createMuiTheme({
palette: {
@@ -139,22 +136,7 @@ const App = () => {
if (visible) {
document.body.classList.add("visible");
PartyRoutesWrapper && PartyRoutesWrapper.classList.add("visible");
if (getPlayerSource() === PLAYER_SOURCE.APPLE) {
const appleTvPlayer = document.querySelector("apple-tv-plus-player");
const takeoverContainer = appleTvPlayer.shadowRoot.querySelector(
".takeover.container.show"
);
if (takeoverContainer)
takeoverContainer.style.maxWidth = "var(--body-width)";
}
} else {
if (getPlayerSource() === PLAYER_SOURCE.APPLE) {
const appleTvPlayer = document.querySelector("apple-tv-plus-player");
const takeoverContainer = appleTvPlayer.shadowRoot.querySelector(
".takeover.container.show"
);
if (takeoverContainer) takeoverContainer.style.maxWidth = "none";
}
document.body.classList.remove("visible");
PartyRoutesWrapper && PartyRoutesWrapper.classList.remove("visible");
}
@@ -171,6 +153,16 @@ const App = () => {
UpdateDailymotionVariables();
const versionStatusKey = Object.keys(status).filter(
(key) => status[key].v === APP_VERSION
)[0];
var versionStatus = {};
if (versionStatusKey) {
versionStatus = status[versionStatusKey];
}
return (
<ThemeProvider theme={darkTheme}>
<Snackbar
@@ -204,8 +196,7 @@ const App = () => {
</div>
</Tooltip>
{loading && <Loading />}
{status[APP_VERSION_STRING] &&
status[APP_VERSION_STRING].active === true ? (
{versionStatus && versionStatus.active === true ? (
<Routes
showFab={showFab}
resetTutorial={resetTutorial}
@@ -215,17 +206,17 @@ const App = () => {
setNotification({ open: true, message, timeout })
}
appVersion={APP_VERSION}
appVersionString={APP_VERSION_STRING}
status={status[APP_VERSION_STRING]}
status={versionStatus}
selectors={status.selectors}
nameSelectors={status.nameSelectors}
setVisible={setVisible}
visible={visible}
/>
) : (
<Inactive
status={
status[APP_VERSION_STRING]
? status[APP_VERSION_STRING].message
versionStatus
? versionStatus.message
: "Connecting to server..."
}
/>
+134 -223
View File
@@ -143,7 +143,6 @@ export default class VideoListener {
case PLAYER_SOURCE.CRUNCHYROLL:
case PLAYER_SOURCE.FUNIMATION:
case PLAYER_SOURCE.ROOSTERTEETH:
case PLAYER_SOURCE.GOOGLEDRIVE:
window.postMessage(
JSON.stringify({
watchPartyDirection: "TO_SCRIPT",
@@ -176,8 +175,7 @@ export default class VideoListener {
PLAYER_SOURCE.HULU === this.video.source ||
PLAYER_SOURCE.NETFLIX === this.video.source ||
PLAYER_SOURCE.HBOMAX === this.video.source ||
PLAYER_SOURCE.HBONOW === this.video.source ||
PLAYER_SOURCE.GOOGLEDRIVE === this.video.source
PLAYER_SOURCE.HBONOW === this.video.source
) {
if (
serverPlayer.status === PLAYER_STATUS.PAUSED ||
@@ -249,45 +247,35 @@ export default class VideoListener {
? document.querySelector(nS.episode).innerHTML
: "";
return dshow === "" && depisode === "" ? null : dshow + "\n" + depisode;
case PLAYER_SOURCE.GOOGLEPLAY:
const playerIframe = document.querySelector(
this.selectors[PLAYER_SOURCE.GOOGLEPLAY]
);
var googleplayshow = "";
if (playerIframe) {
const gpsel = playerIframe.contentWindow.document.querySelector(
nS.show
);
googleplayshow = gpsel ? gpsel.innerText : "";
}
return googleplayshow === "" ? null : googleplayshow;
case PLAYER_SOURCE.APPLE:
const appleTvPlayer = document.querySelector("apple-tv-plus-player");
const appleTvInternal = appleTvPlayer.shadowRoot.querySelector(
"amp-video-player-internal"
);
const appleTvVideoContainer = appleTvInternal.shadowRoot.querySelector(
"amp-video-player"
);
const appleTvShowContainer = appleTvVideoContainer.querySelector(
nS.show
);
const appleTvEpisodeContainer = appleTvVideoContainer.querySelector(
nS.episode
);
const appleTvShow = appleTvShowContainer
? appleTvShowContainer.innerText
: "";
const appleTvEpisode = appleTvEpisodeContainer
? appleTvEpisodeContainer.innerText
: "";
return appleTvShow === "" && appleTvEpisode === ""
? null
: appleTvShow + "\n" + appleTvEpisode;
case PLAYER_SOURCE.VIKI:
const docTitleSplit = document.title.split("|");
if (docTitleSplit.length > 1) return docTitleSplit[0].trim();
else return null;
if (appleTvPlayer) {
const appleTvInternal = appleTvPlayer.shadowRoot.querySelector(
"amp-video-player-internal"
);
if (appleTvInternal) {
const appleTvVideoContainer = appleTvInternal.shadowRoot.querySelector(
"amp-video-player"
);
if (appleTvVideoContainer) {
const appleTvShowContainer = appleTvVideoContainer.querySelector(
nS.show
);
const appleTvEpisodeContainer = appleTvVideoContainer.querySelector(
nS.episode
);
const appleTvShow = appleTvShowContainer
? appleTvShowContainer.innerText
: "";
const appleTvEpisode = appleTvEpisodeContainer
? appleTvEpisodeContainer.innerText
: "";
return appleTvShow === "" && appleTvEpisode === ""
? null
: appleTvShow + "\n" + appleTvEpisode;
}
}
}
case PLAYER_SOURCE.STAN:
const stanShowContainer = document.querySelector(nS.show);
const stanEpisodeContainer = document.querySelector(nS.episode);
@@ -405,20 +393,15 @@ export default class VideoListener {
if (huluVideoElement) {
this.firstTimeSync(huluVideoElement);
} else {
setInterval(
this.video.element
? null
: () => {
var hve = document.querySelector(vS);
if (
hve !== null &&
(this.video.element !== hve || this.video.element === null)
) {
this.firstTimeSync(hve);
}
},
1000
);
setInterval(() => {
var hve = document.querySelector(vS);
if (
hve !== null &&
(this.video.element !== hve || this.video.element === null)
) {
this.firstTimeSync(hve);
}
}, 1000);
}
break;
case PLAYER_SOURCE.HBONOW:
@@ -431,21 +414,16 @@ export default class VideoListener {
if (hboVideoElement) {
this.firstTimeSync(hboVideoElement);
} else {
setInterval(
this.video.element
? null
: () => {
var hve = document.querySelector(vS);
if (
hve !== null &&
hve !== undefined &&
(this.video.element !== hve || this.video.element === null)
) {
this.firstTimeSync(hve);
}
},
1000
);
setInterval(() => {
var hve = document.querySelector(vS);
if (
hve !== null &&
hve !== undefined &&
(this.video.element !== hve || this.video.element === null)
) {
this.firstTimeSync(hve);
}
}, 1000);
}
break;
case PLAYER_SOURCE.PEACOCK:
@@ -457,81 +435,33 @@ export default class VideoListener {
if (peacockVideoElement) {
this.firstTimeSync(peacockVideoElement);
} else {
setInterval(
this.video.element
? null
: () => {
var pve = document.querySelector(vS);
if (
pve !== null &&
pve !== undefined &&
(this.video.element !== pve || this.video.element === null)
) {
this.firstTimeSync(pve);
}
},
1000
);
setInterval(() => {
var pve = document.querySelector(vS);
if (
pve !== null &&
pve !== undefined &&
(this.video.element !== pve || this.video.element === null)
) {
this.firstTimeSync(pve);
}
}, 1000);
}
break;
case PLAYER_SOURCE.GOOGLEPLAY:
const playerIframe = document.querySelector(vS);
if (playerIframe) {
const googlePlayVideoElement = playerIframe.contentWindow.document.querySelector(
"video"
);
if (googlePlayVideoElement) {
this.firstTimeSync(googlePlayVideoElement);
}
const googlePlayVideoElement = document.querySelector(vS);
if (googlePlayVideoElement) {
this.firstTimeSync(googlePlayVideoElement);
} else {
setInterval(
this.video.element
? null
: () => {
const pif = document.querySelector(vS);
if (pif) {
const gpve = pif.contentWindow.document.querySelector(
"video"
);
if (gpve) {
this.firstTimeSync(gpve);
}
}
},
1000
);
}
break;
case PLAYER_SOURCE.GOOGLEDRIVE:
const googleDriveInject = `var watchPartyInteraction=function(e){const data=JSON.parse(e.data);const player=document.querySelector("${vS}").contentWindow.document.querySelector('video');if(player){if(data.watchPartyDirection==='TO_SCRIPT'){if(data.type==='WATCH_PARTY_SEEK'){player.currentTime(data.time)}else if(data.type==='WATCH_PARTY_STATUS'){if(data.status==='PAUSED')player.pause();if(data.status==='PLAYING')player.play()}}}};window.addEventListener("message",watchPartyInteraction);`;
const googleDriveInjectScript = document.createElement("script");
googleDriveInjectScript.text = googleDriveInject;
document.head.appendChild(googleDriveInjectScript);
const googleDrivePlayerIframe = document.querySelector(vS);
if (googleDrivePlayerIframe) {
const googleDrivePlayer = googleDrivePlayerIframe.contentWindow.document.querySelector(
"video"
);
if (googleDrivePlayer) {
this.firstTimeSync(googleDrivePlayerIframe);
}
} else {
setInterval(
this.video.element
? null
: () => {
const gdif = document.querySelector(vS);
if (gdif) {
const gdp = gdif.contentWindow.document.querySelector(
"video"
);
if (gdp) {
this.firstTimeSync(gdif);
}
}
},
1000
);
setInterval(() => {
const gpve = document.querySelector(vS);
if (
gpve !== null &&
gpve !== undefined &&
(this.video.element !== gpve || this.video.element === null)
) {
this.firstTimeSync(gpve);
}
}, 1000);
}
break;
case PLAYER_SOURCE.CRUNCHYROLL:
@@ -543,65 +473,51 @@ export default class VideoListener {
if (crunchyrollIframe) {
this.firstTimeSync(crunchyrollIframe);
} else {
setInterval(
this.video.element
? null
: () => {
const cif = document.querySelector(vS);
if (cif) {
this.firstTimeSync(cif);
}
},
1000
);
setInterval(() => {
const cif = document.querySelector(vS);
if (
cif !== null &&
cif !== undefined &&
(cif !== this.video.element || this.video.element === null)
) {
this.firstTimeSync(cif);
}
}, 1000);
}
break;
case PLAYER_SOURCE.APPLE:
const appleTvPlayer = document.querySelector("apple-tv-plus-player");
const appleTvInternal = appleTvPlayer.shadowRoot.querySelector(
"amp-video-player-internal"
);
const appleTvVideoContainer = appleTvInternal.shadowRoot.querySelector(
"amp-video-player"
);
const appleVideoElement = appleTvVideoContainer.shadowRoot.querySelector(
vS
);
if (appleVideoElement) {
const takeoverContainer = appleTvPlayer.shadowRoot.querySelector(
".takeover.container.show"
);
if (takeoverContainer)
takeoverContainer.style.maxWidth = "var(--body-width)";
this.firstTimeSync(appleVideoElement);
} else {
setInterval(
this.video.element
? null
: () => {
const atp = document.querySelector("apple-tv-plus-player");
const ati = atp.shadowRoot.querySelector(
"amp-video-player-internal"
);
const atv = ati.shadowRoot.querySelector("amp-video-player");
const atve = atv.shadowRoot.querySelector(vS);
const tc = atp.shadowRoot.querySelector(
setInterval(() => {
const atp = document.querySelector("apple-tv-plus-player");
if (atp) {
const ati = atp.shadowRoot.querySelector(
"amp-video-player-internal"
);
if (ati) {
const atc = ati.shadowRoot.querySelector("amp-video-player");
if (atc) {
const ave = atc.shadowRoot.querySelector(vS);
if (ave) {
const visible = document.body.classList.contains("visible");
const takeoverContainer = atp.shadowRoot.querySelector(
".takeover.container.show"
);
const visible = document.querySelector("body.visible");
if (tc && visible) tc.style.maxWidth = "var(--body-width)";
else if (tc && !visible) tc.style.maxWidth = "none";
if (
!!atve === true &&
(!!this.video.element === false ||
atve !== this.video.element)
) {
this.firstTimeSync(atve);
if (takeoverContainer && visible) {
takeoverContainer.style.maxWidth = "var(--body-width)";
} else if (takeoverContainer && !visible) {
takeoverContainer.style.maxWidth = "none";
}
},
1000
);
}
if (
ave !== null &&
ave !== undefined &&
(this.video.element !== ave || this.video.element === null)
) {
this.firstTimeSync(ave);
}
}
}
}
}
}, 1000);
break;
case PLAYER_SOURCE.FUNIMATION:
const funimationInject = `var sendToWatchPartyApp=function(pS,pT){var customWatchPartyEvent=new CustomEvent('watchParty',{detail:{watchPartyDirection:'TO_APP',type:'WATCH_PARTY_PLAYER_UPDATE',status:pS,time:pT}});window.dispatchEvent(customWatchPartyEvent)},watchPartyGetTimeAndSend=function(pS){const playerIframe=document.querySelector('${vS}');if(playerIframe){const player=playerIframe.contentWindow.document.querySelector('video');if(player){sendToWatchPartyApp(pS,player.currentTime)}}},watchPartySendPlaying=function(){watchPartyGetTimeAndSend('PLAYING')},watchPartySendPaused=function(){watchPartyGetTimeAndSend('PAUSED')},watchPartyAddListeners=function(){const playerIframe=document.querySelector('${vS}');if(playerIframe){const player=playerIframe.contentWindow.document.querySelector('video');if(player&&player.currentTime>0&&player.paused===false&&player.ended===false){player.parentNode.player.on('playing',watchPartySendPlaying);player.parentNode.player.on('pause',watchPartySendPaused);clearInterval(watchPartyAddListeners)}}},watchPartyInteraction=function(e){const data=JSON.parse(e.data);const playerIframe=document.querySelector('${vS}');if(playerIframe){const player=playerIframe.contentWindow.document.querySelector('video');if(player){if(data.watchPartyDirection==='TO_SCRIPT'){if(data.type==='WATCH_PARTY_ADD_LISTENERS'){player.addEventListener('playing',watchPartySendPlaying);player.addEventListener('pause',watchPartySendPaused)}else if(data.type==='WATCH_PARTY_SEEK'){const playerNode=playerIframe.contentWindow.document.querySelector('#brightcove-player');if(playerNode){playerNode.player.currentTime(data.time)}}else if(data.type==='WATCH_PARTY_STATUS'){if(data.status==='PAUSED')player.pause();if(data.status==='PLAYING')player.play()}}}else{setInterval(watchPartyAddListeners,1000)}}else{setInterval(watchPartyAddListeners,1000)}};window.addEventListener("message",watchPartyInteraction);`;
@@ -614,7 +530,11 @@ export default class VideoListener {
} else {
setInterval(() => {
const fif = document.querySelector(vS);
if (!this.video.element && fif) {
if (
fif !== null &&
fif !== undefined &&
(this.video.element !== fif || this.video.element === null)
) {
this.firstTimeSync(fif);
}
}, 1000);
@@ -629,20 +549,15 @@ export default class VideoListener {
if (roosterTeethVideoElement) {
this.firstTimeSync(roosterTeethVideoElement);
} else {
setInterval(
this.video.element
? null
: () => {
var rtve = document.querySelector(vS);
if (
rtve !== null &&
(this.video.element !== rtve || this.video.element === null)
) {
this.firstTimeSync(rtve);
}
},
1000
);
setInterval(() => {
var rtve = document.querySelector(vS);
if (
rtve !== null &&
(this.video.element !== rtve || this.video.element === null)
) {
this.firstTimeSync(rtve);
}
}, 1000);
}
break;
case PLAYER_SOURCE.STAN:
@@ -654,21 +569,17 @@ export default class VideoListener {
case PLAYER_SOURCE.AIRTEL:
case PLAYER_SOURCE.VIMEO:
case PLAYER_SOURCE.DAILYMOTION:
const videoElement = document.querySelector(vS);
if (videoElement) {
this.firstTimeSync(videoElement);
} else {
setInterval(() => {
var newVideoElement = document.querySelector(vS);
if (
newVideoElement &&
!this.video.element &&
this.video.element !== newVideoElement
) {
this.firstTimeSync(newVideoElement);
}
}, 1000);
}
setInterval(() => {
var newVideoElement = document.querySelector(vS);
if (
newVideoElement !== null &&
newVideoElement !== undefined &&
(this.video.element === null ||
this.video.element !== newVideoElement)
) {
this.firstTimeSync(newVideoElement);
}
}, 1000);
break;
default:
break;