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
+618 -299
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -65,7 +65,7 @@
"dotenv": "4.0.0",
"dotenv-expand": "4.2.0",
"file-loader": "4.2.0",
"firebase": "^7.14.0",
"firebase": "^7.19.1",
"fs-extra": "3.0.1",
"html-webpack-plugin": "^4.0.0-beta.8",
"jest": "20.0.4",
+1
View File
@@ -12,6 +12,7 @@ COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<style>
html {
height: fit-content;
+26 -7
View File
@@ -10,8 +10,11 @@ CITED ARE THE SOLE INTELLECTUAL PROPERTY OF AYUSHYA AMITABH, AND MAY NOT BE
COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION.
************************************************************************/
/* global chrome */
/* global browswer */
/* global firebase */
let CHROME_OR_BROWSER = chrome || browser;
const APP_VERSION = '1.7.2';
const APP_VERSION_STRING = APP_VERSION.replace(/\./g, '');
@@ -71,19 +74,19 @@ const sendAuth = async (sendResponse) => {
sendResponse(firebase.auth().currentUser);
};
chrome.runtime.onInstalled.addListener((details) => {
CHROME_OR_BROWSER.runtime.onInstalled.addListener((details) => {
if (details.reason) {
if (details.reason === 'install') {
if (window.localStorage.getItem('watchPartyVersion')) {
if (window.localStorage.getItem('watchPartyVersion') !== APP_VERSION) {
chrome.tabs.create({
CHROME_OR_BROWSER.tabs.create({
url: `http://www.chromewatchparty.com/changes/v${APP_VERSION}`,
active: true,
});
window.localStorage.setItem('watchPartyVersion', APP_VERSION);
}
} else {
chrome.tabs.create({
CHROME_OR_BROWSER.tabs.create({
url: 'https://www.chromewatchparty.com/welcome',
active: true,
});
@@ -92,14 +95,14 @@ chrome.runtime.onInstalled.addListener((details) => {
} else if (details.reason === 'update') {
if (window.localStorage.getItem('watchPartyVersion')) {
if (window.localStorage.getItem('watchPartyVersion') !== APP_VERSION) {
chrome.tabs.create({
CHROME_OR_BROWSER.tabs.create({
url: `http://www.chromewatchparty.com/changes/v${APP_VERSION}`,
active: true,
});
window.localStorage.setItem('watchPartyVersion', APP_VERSION);
}
} else {
chrome.tabs.create({
CHROME_OR_BROWSER.tabs.create({
url: `http://www.chromewatchparty.com/changes/v${APP_VERSION}`,
active: true,
});
@@ -109,7 +112,7 @@ chrome.runtime.onInstalled.addListener((details) => {
}
});
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
CHROME_OR_BROWSER.runtime.onMessage.addListener((request, sender, sendResponse) => {
const { type } = request;
switch (type) {
case 'API_CALL':
@@ -152,10 +155,11 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
return true;
});
chrome.runtime.onConnect.addListener((port) => {
CHROME_OR_BROWSER.runtime.onConnect.addListener((port) => {
port.onDisconnect.addListener(() => {
port.roomListener && port.roomListener();
port.userListener && port.userListener();
port.statusListener && port.statusListener();
port.messageListener && port.messageListener();
});
port.onMessage.addListener((request) => {
@@ -233,6 +237,21 @@ chrome.runtime.onConnect.addListener((port) => {
])
);
}
} else if (type === 'STATUS') {
port.statusListener = firebase
.firestore()
.collection('server')
.doc('status')
.onSnapshot(
(statusSnap) => {
port.postMessage({
status: statusSnap.data(),
});
},
(err) => {
port.postMessage({ isError: true, ...err });
}
);
}
});
});
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -4
View File
@@ -12,10 +12,7 @@ COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION.
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv="Content-Security-Policy"
content="default-src *; style-src 'self' https://* 'unsafe-inline'; script-src 'self' http://* 'unsafe-inline' 'unsafe-eval'"
/>
<meta charset="utf-8" />
<style>
:root {
--mdc-theme-primary: #beff94 !important;
+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';