- this.handleAlertDescriptionChange(e.target.value, r.version, i)
+ this.handleAlertDescriptionChange(
+ e.target.value,
+ r.version,
+ i
+ )
}
/>
Link
@@ -449,14 +762,22 @@ export default class Dashboard extends Component {
value={a.linkText}
placeholder="Link Text"
onChange={(e) =>
- this.handleAlertLinkTextChange(e.target.value, r.version, i)
+ this.handleAlertLinkTextChange(
+ e.target.value,
+ r.version,
+ i
+ )
}
/>
- this.handleAlertLinkChange(e.target.value, r.version, i)
+ this.handleAlertLinkChange(
+ e.target.value,
+ r.version,
+ i
+ )
}
/>
@@ -472,7 +793,10 @@ export default class Dashboard extends Component {
- this.saveAlerts(r.version)} className="add-alert-card">
+ this.saveAlerts(r.version)}
+ className="add-alert-card"
+ >
@@ -493,19 +817,41 @@ export default class Dashboard extends Component {
onChange={(e) => this.handleVideoSelectorChange(e, source)}
/>
))}
- }
- className="save-video-selector"
- onClick={this.updateVideoSelector}
- loading={refreshing}
- >
- Save Video Selectors
-
- name selectors
+
+ {Object.keys(nameSelectors)
+ .sort()
+ .map((source) => (
+
+
+ this.handleVideoNameSelectorChange(e, source, "show")
+ }
+ />
+
+ this.handleVideoNameSelectorChange(
+ e,
+ source,
+ "episode"
+ )
+ }
+ />
+
+ ))}
+
diff --git a/admin/src/index.css b/admin/src/index.css
index 541ad3c..056bde9 100644
--- a/admin/src/index.css
+++ b/admin/src/index.css
@@ -1,5 +1,5 @@
-@import '~antd/dist/antd.css';
-@import '~antd/dist/antd.dark.css' screen and (prefers-color-scheme: dark);
+@import "~antd/dist/antd.css";
+@import "~antd/dist/antd.dark.css" screen and (prefers-color-scheme: dark);
#root,
#root .app-wrapper {
@@ -29,8 +29,12 @@
border-top-left-radius: 0px;
}
+.dashboard-wrapper {
+ padding: 35px 70px;
+ padding-top: 0;
+}
+
.dashboard-wrapper .ant-card {
- margin: 35px 70px;
border-radius: 26px;
filter: drop-shadow(0px 0px 5px rgba(221, 221, 221, 0.438));
}
@@ -52,6 +56,7 @@
margin: 5px 2px !important;
filter: none !important;
border-radius: initial !important;
+ max-width: 400px;
}
.alerts-wrapper .ant-card-body input,
@@ -81,3 +86,47 @@ span#call-icon svg {
width: 25px;
height: 25px;
}
+
+.title-header {
+ margin-bottom: 17.5px;
+}
+
+.title-header .ant-page-header-heading-title,
+.title-header .ant-page-header-heading-sub-title {
+ letter-spacing: 1.5px;
+}
+
+.party-details-wrapper > td {
+ padding: 0 !important;
+}
+
+.party-details-wrapper .ant-descriptions-view table {
+ width: 100% !important;
+}
+
+.party-details-wrapper .ant-descriptions-view table td,
+.party-details-wrapper .ant-descriptions-view table th {
+ border-bottom: 1px solid #f0f0f0;
+}
+
+.ant-page-header .ant-badge {
+ margin-right: 10px;
+}
+
+.ant-page-header .ant-badge-count {
+ right: 100%;
+ z-index: 9;
+ top: -10%;
+}
+
+.ant-page-header .active .ant-badge-count {
+ background: green;
+}
+.ant-page-header .afk .ant-badge-count {
+ background: rgb(79, 120, 209);
+}
+
+.ant-modal-body > * {
+ margin: 5px 0px;
+ width: 100%;
+}
diff --git a/app/src/Inactive.js b/app/src/Inactive.js
index a82fffc..6d0d8fb 100644
--- a/app/src/Inactive.js
+++ b/app/src/Inactive.js
@@ -9,14 +9,16 @@ ALL CONTENT ON WATCH PARTY'S WEBSITE OR IN WATCH PARTY'S CHROME EXTENSION APP, U
CITED ARE THE SOLE INTELECTUAL PROPERTY OF AYUSHYA AMITABH, AND MAY NOT BE
COPIED, EDITED, OR REPRODUCED WITHOUT PERMISSION.
************************************************************************/
-import React from 'react';
-import { Typography } from '@material-ui/core';
-import { Warning } from '@material-ui/icons';
+import React from "react";
+import { Typography } from "@material-ui/core";
+import { Warning } from "@material-ui/icons";
const Inactive = (props) => (
- SORRY, WATCH PARTY IS UNAVAILABLE RIGHT NOW
+
+ SORRY, WATCH PARTY IS UNAVAILABLE RIGHT NOW
+
{props.status}
);
diff --git a/functions/admin/index.js b/functions/admin/index.js
index 586d188..d200e3e 100644
--- a/functions/admin/index.js
+++ b/functions/admin/index.js
@@ -1,10 +1,14 @@
-const superAuth = require('./superAuth');
-const partyDashboard = require('./partyDashboard');
-const serverDashboard = require('./serverDashboard');
-const updateVersionActive = require('./updateVersionActive');
-const updateVideoSelectors = require('./updateVideoSelectors');
+const superAuth = require("./superAuth");
+const partyDashboard = require("./partyDashboard");
+const serverDashboard = require("./serverDashboard");
+const updateVersionActive = require("./updateVersionActive");
+const updateVideoSelectors = require("./updateVideoSelectors");
+const updateVideoNameSelectors = require("./updateVideoNameSelectors");
+const sendMessage = require("./sendMessage");
module.exports = {
+ sendMessage,
+ updateVideoNameSelectors,
updateVideoSelectors,
updateVersionActive,
serverDashboard,
diff --git a/functions/admin/partyDashboard.js b/functions/admin/partyDashboard.js
index 2b0b335..d8dc9f8 100644
--- a/functions/admin/partyDashboard.js
+++ b/functions/admin/partyDashboard.js
@@ -1,14 +1,14 @@
/* eslint-disable promise/no-nesting */
-const admin = require('firebase-admin');
-const Logger = require('../Logger');
-const mLogger = new Logger('admin', 'partyDashboard');
+const admin = require("firebase-admin");
+const Logger = require("../Logger");
+const mLogger = new Logger("admin", "partyDashboard");
module.exports = async (req, res) => {
mLogger.start();
var partyData = await admin
.firestore()
- .collection('rooms')
+ .collection("rooms")
.get()
.then((roomSnapshot) => {
const docData = [];
@@ -18,38 +18,43 @@ module.exports = async (req, res) => {
createTime: doc.createTime.toDate().toUTCString(),
updateTime: doc.updateTime.toDate().toUTCString(),
source: doc.data().player.source,
- onCall: doc.data().hasOwnProperty('conference'),
- showName: doc.data().player.showName || '',
+ onCall: doc.data().hasOwnProperty("conference"),
+ showName: doc.data().player.showName || "",
time: doc.data().player.time || 0,
- status: doc.data().player.status || '',
+ status: doc.data().player.status || "",
});
});
return docData;
})
.catch((err) => {
- mLogger.error('FAILED TO RESOLVE PARTIES', err);
- res.status(500).send({ message: 'Unable to get all parties', error: err });
+ mLogger.error("FAILED TO RESOLVE PARTIES", err);
+ res
+ .status(500)
+ .send({ message: "Unable to get all parties", error: err });
});
- await partyData.forEach((party) => {
- const messageCount = admin
+ const p = await partyData.map(async (party) => {
+ const messageCount = await admin
.firestore()
- .collection('rooms')
+ .collection("rooms")
.doc(party.id)
- .collection('messages')
+ .collection("messages")
.get()
.then((snap) => snap.size);
- const userCount = admin
+ const userCount = await admin
.firestore()
- .collection('rooms')
+ .collection("rooms")
.doc(party.id)
- .collection('users')
+ .collection("users")
.get()
.then((snap) => snap.size);
party.messageCount = messageCount || 0;
party.userCount = userCount || 0;
+ return party;
});
- mLogger.success('GOT ALL PARTIES', { parties: partyData.length });
- return res.status(200).send({ partyData });
+ return Promise.all(p).then((v) => {
+ mLogger.success("GOT ALL PARTIES", { parties: partyData.length });
+ return res.status(200).send({ partyData });
+ });
};
diff --git a/functions/admin/sendMessage.js b/functions/admin/sendMessage.js
new file mode 100644
index 0000000..38d3b3c
--- /dev/null
+++ b/functions/admin/sendMessage.js
@@ -0,0 +1,32 @@
+const admin = require("firebase-admin");
+const Logger = require("../Logger");
+const mLogger = new Logger("admin", "sendMessage");
+
+module.exports = async (req, res) => {
+ mLogger.start();
+ const { selectedParties, newMessage } = JSON.parse(req.body);
+ if (selectedParties && newMessage && selectedParties.length > 0) {
+ if (newMessage.text && newMessage.time && newMessage.uid) {
+ newMessage.time = new Date();
+ await selectedParties.map(async (partyId) => {
+ await admin
+ .firestore()
+ .collection("rooms")
+ .doc(partyId)
+ .collection("messages")
+ .add(newMessage)
+ .catch((err) => {
+ mLogger.error("FAILED TO SEND MESSAGE", { partyId, err });
+ });
+ });
+ mLogger.success("SENT MESSAGES", { newMessage, selectedParties });
+ res.status(200).send({ message: "SENT MESSAGES" });
+ } else {
+ mLogger.error("MESSAGE NOT VALID");
+ res.status(500).send({ message: "Message is missing fields" });
+ }
+ } else {
+ mLogger.error("VALUES NOT RECEIVED");
+ res.status(500).send({ message: "Values not received" });
+ }
+};
diff --git a/functions/admin/updateVideoNameSelectors.js b/functions/admin/updateVideoNameSelectors.js
new file mode 100644
index 0000000..9ceefbe
--- /dev/null
+++ b/functions/admin/updateVideoNameSelectors.js
@@ -0,0 +1,26 @@
+const admin = require("firebase-admin");
+const Logger = require("../Logger");
+const mLogger = new Logger("admin", "updateVideoNameSelectors");
+
+module.exports = async (req, res) => {
+ mLogger.start();
+ const { nameSelectors } = JSON.parse(req.body);
+ if (nameSelectors) {
+ await admin
+ .firestore()
+ .collection("server")
+ .doc("status")
+ .update({
+ nameSelectors,
+ })
+ .catch((err) => {
+ mLogger.error("FAILED TO UPDATE", err);
+ res.status(500).send({ message: "FAILED TO UPDATE", error: err });
+ });
+ mLogger.success("UPDATED NAME SELECTORS");
+ res.status(200).send({ message: "Updated video name selectors" });
+ } else {
+ mLogger.error("VALUES NOT RECEIVED");
+ res.status(500).send({ message: "Values not received" });
+ }
+};
diff --git a/functions/app.js b/functions/app.js
index 7c97cbc..2b5c682 100644
--- a/functions/app.js
+++ b/functions/app.js
@@ -1,40 +1,46 @@
-const FunctionModules = require('./modules/index');
-const Webhooks = require('./webhooks/index');
-const AdminModules = require('./admin/index');
-const express = require('express');
-const cors = require('cors');
+const FunctionModules = require("./modules/index");
+const Webhooks = require("./webhooks/index");
+const AdminModules = require("./admin/index");
+const express = require("express");
+const cors = require("cors");
// WEBHOOKS
const webhooks = express();
webhooks.use(cors({ origin: true }));
-webhooks.all('/conferenceEnded', Webhooks.conferenceEnd);
-webhooks.all('/scheduledCleanup', Webhooks.scheduledCleanUp);
-webhooks.all('/ask', Webhooks.ask);
-webhooks.all('/userCleanUp', Webhooks.userCleanUp);
+webhooks.all("/conferenceEnded", Webhooks.conferenceEnd);
+webhooks.all("/scheduledCleanup", Webhooks.scheduledCleanUp);
+webhooks.all("/ask", Webhooks.ask);
+webhooks.all("/userCleanUp", Webhooks.userCleanUp);
// VERSION 1
const app = express();
app.use(cors({ origin: true }));
app.use(FunctionModules.authenticator);
-app.get('/validator/:partyName', FunctionModules.tokenValidator);
-app.get('/refresher/:token', FunctionModules.tokenRefresher);
-app.post('/create', FunctionModules.createRoom);
-app.post('/join', FunctionModules.joinRoom);
-app.post('/message', FunctionModules.sendMessage);
-app.post('/updatePlayer', FunctionModules.updatePlayer);
-app.post('/updateVoxeet', FunctionModules.updateVoxeet);
-app.delete('/leave/:rid/users/:uid', FunctionModules.leaveRoom);
-app.delete('/delete/:rid', FunctionModules.deleteRoom);
-app.put('/updateAdminOnly/:rid/:adminOnly', FunctionModules.updateAdminOnly);
+app.get("/validator/:partyName", FunctionModules.tokenValidator);
+app.get("/refresher/:token", FunctionModules.tokenRefresher);
+app.post("/create", FunctionModules.createRoom);
+app.post("/join", FunctionModules.joinRoom);
+app.post("/message", FunctionModules.sendMessage);
+app.post("/updatePlayer", FunctionModules.updatePlayer);
+app.post("/updateVoxeet", FunctionModules.updateVoxeet);
+app.delete("/leave/:rid/users/:uid", FunctionModules.leaveRoom);
+app.delete("/delete/:rid", FunctionModules.deleteRoom);
+app.put("/updateAdminOnly/:rid/:adminOnly", FunctionModules.updateAdminOnly);
// ADMIN
const admin = express();
-admin.use(cors({ origin: ['http://localhost:3000', 'https://admin.chromewatchparty.com/*'] }));
+admin.use(
+ cors({
+ origin: ["http://localhost:3000", "https://admin.chromewatchparty.com/*"],
+ })
+);
admin.use(AdminModules.superAuth);
-admin.get('/partyDashboard', AdminModules.partyDashboard);
-admin.get('/serverDashboard', AdminModules.serverDashboard);
-admin.post('/updateVersionActive', AdminModules.updateVersionActive);
-admin.post('/updateVideoSelectors', AdminModules.updateVideoSelectors);
+admin.get("/partyDashboard", AdminModules.partyDashboard);
+admin.get("/serverDashboard", AdminModules.serverDashboard);
+admin.post("/updateVersionActive", AdminModules.updateVersionActive);
+admin.post("/updateVideoSelectors", AdminModules.updateVideoSelectors);
+admin.post("/updateVideoNameSelectors", AdminModules.updateVideoNameSelectors);
+admin.post("/sendMessage", AdminModules.sendMessage);
module.exports = {
v1: app,