v1.7.2/release

This commit is contained in:
2020-09-09 14:56:39 -04:00
parent eaf7663f0c
commit 7d016f1423
14 changed files with 951 additions and 346 deletions
+9 -6
View File
@@ -10,6 +10,9 @@ CITED ARE THE SOLE INTELLECTUAL PROPERTY OF AYUSHYA AMITABH, AND MAY NOT BE
COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION.
************************************************************************/
/*global chrome*/
/*global browser*/
let CHROME_OR_BROWSER = chrome || browser;
const API_HOST = 'https://api.chromewatchparty.com';
@@ -62,7 +65,7 @@ export const getPlayerSource = () => {
export const getShowWPButton = () =>
new Promise((resolve, reject) => {
chrome.runtime.sendMessage(
CHROME_OR_BROWSER.runtime.sendMessage(
{
type: 'IS_HIDDEN',
},
@@ -74,7 +77,7 @@ export const getShowWPButton = () =>
export const getTutorialStatus = () =>
new Promise((resolve, reject) => {
chrome.runtime.sendMessage(
CHROME_OR_BROWSER.runtime.sendMessage(
{
type: 'GET_TUTORIAL',
},
@@ -86,7 +89,7 @@ export const getTutorialStatus = () =>
export const setTutorialStatus = (status) =>
new Promise((resolve, reject) => {
chrome.runtime.sendMessage(
CHROME_OR_BROWSER.runtime.sendMessage(
{
type: 'SET_TUTORIAL',
status,
@@ -126,7 +129,7 @@ export const scrollThread = () => {
export const getUserUid = async () =>
new Promise((resolve, reject) => {
chrome.runtime.sendMessage(
CHROME_OR_BROWSER.runtime.sendMessage(
{
type: 'GET_AUTH',
},
@@ -141,7 +144,7 @@ export const getUserUid = async () =>
export const fetcher = async ({ endpoint, method, ...args }) => {
const url = `${API_HOST}/${endpoint}`;
return new Promise((resolve, reject) =>
chrome.runtime.sendMessage(
CHROME_OR_BROWSER.runtime.sendMessage(
{
type: 'API_CALL',
url,
@@ -158,7 +161,7 @@ export const fetcher = async ({ endpoint, method, ...args }) => {
export const webhookFetcher = async ({ endpoint, ...args }) => {
return new Promise((resolve, reject) =>
chrome.runtime.sendMessage(
CHROME_OR_BROWSER.runtime.sendMessage(
{
type: 'API_CALL',
url: endpoint,
+15 -11
View File
@@ -9,13 +9,14 @@ ALL CONTENT ON WATCH PARTY'S WEBSITE OR IN WATCH PARTY'S CHROME EXTENSION APP, U
CITED ARE THE SOLE INTELLECTUAL PROPERTY OF AYUSHYA AMITABH, AND MAY NOT BE
COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION.
************************************************************************/
/*global chrome*/
/*global browser*/
import React, { useState, useEffect } from 'react';
import Router from 'route-lite';
import { Fab, createMuiTheme, ThemeProvider, Snackbar, Tooltip } from '@material-ui/core';
import Create from './Create';
import Loading from './Loading';
import firebase from 'firebase/app';
import 'firebase/firestore';
import Inactive from './Inactive';
import {
getUserUid,
@@ -73,6 +74,9 @@ const startResize = (ev) => {
document.documentElement.addEventListener('mouseup', stopResize, false);
};
let CHROME_OR_BROWSER = chrome || browser;
let port;
const App = () => {
const closedNotification = { open: false, message: '' };
@@ -87,14 +91,14 @@ const App = () => {
useEffect(() => {
setLoading(true);
getUserUid();
firebase
.firestore()
.collection('server')
.doc('status')
.onSnapshot((statusSnap) => {
setStatus(statusSnap.data());
setLoading(false);
});
port = CHROME_OR_BROWSER.runtime.connect({ name: `WATCH_PARTY_STATUS` });
port.postMessage({
type: 'STATUS',
});
port.onMessage.addListener((response) => {
setStatus(response.status);
setLoading(false);
});
getShowWPButton().then((showWPButton) => {
setShowFab(showWPButton);
if (showWPButton === true) {
@@ -185,7 +189,7 @@ const App = () => {
status={
status[APP_VERSION_STRING]
? status[APP_VERSION_STRING].message
: "Uh oh, can't connect to server. Trying again..."
: 'Connecting to server...'
}
/>
)}
+4 -2
View File
@@ -717,9 +717,11 @@ export default class VideoListener {
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('${
this.selectors[PLAYER_SOURCE.FUNIMATION]
}');if(playerIframe){const player=playerIframe.contentWindow.document.querySelector('video');if(player){sendToWatchPartyApp(pS,player.currentTime)}}},watchPartySendPlaying=function(){watchPartyGetTimeAndSend('PLAYING')},watchPartySendPaused=function(){watchPartyGetTimeAndSend('PAUSED')},watchPartyInteraction=function(e){const data=JSON.parse(e.data);const playerIframe=document.querySelector('${
}');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('${
this.selectors[PLAYER_SOURCE.FUNIMATION]
}');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()}}}}};window.addEventListener("message",watchPartyInteraction);`;
}');if(playerIframe){const player=playerIframe.contentWindow.document.querySelector('video');if(player && player.currentTime > 0 && player.paused === false && player.ended === false){player.addEventListener('playing',watchPartySendPlaying);player.addEventListener('pause',watchPartySendPaused);clearInterval(watchPartyAddListeners)}}},watchPartyInteraction=function(e){const data=JSON.parse(e.data);const playerIframe=document.querySelector('${
this.selectors[PLAYER_SOURCE.FUNIMATION]
}');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);`;
const funimationInjectScript = document.createElement('script');
funimationInjectScript.text = funimationInject;
document.head.appendChild(funimationInjectScript);
+2 -16
View File
@@ -9,26 +9,12 @@ ALL CONTENT ON WATCH PARTY'S WEBSITE OR IN WATCH PARTY'S CHROME EXTENSION APP, U
CITED ARE THE SOLE INTELLECTUAL PROPERTY OF AYUSHYA AMITABH, AND MAY NOT BE
COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION.
************************************************************************/
import App from './App';
import React from 'react';
import ReactDOM from 'react-dom';
import firebase from 'firebase/app';
import App from './App';
import { PLAYER_SOURCE, getPlayerSource } from './Api';
import './index.css';
import 'react-virtualized/styles.css';
import { PLAYER_SOURCE, getPlayerSource } from './Api';
const firebaseConfig = {
apiKey: 'AIzaSyCJLuYpzXLDRmu2ttzFuSGmYcpFxqToWFU',
authDomain: 'watch-party-crx.firebaseapp.com',
databaseURL: 'https://watch-party-crx.firebaseio.com',
projectId: 'watch-party-crx',
storageBucket: 'watch-party-crx.appspot.com',
messagingSenderId: '712242707190',
appId: '1:712242707190:web:65fa7f772e30da364b0ad7',
measurementId: 'G-EZS4PEVG4T',
};
firebase.initializeApp(firebaseConfig);
const PartyWrapper = document.createElement('div');
PartyWrapper.id = 'party_wrapper';