diff --git a/web-service/client/src/App.js b/web-service/client/src/App.js index 51998828c135f1595b43d37b04a4fa14407fce5e..a758c4afc382fbf71baad954a528f761ad82dd8f 100644 --- a/web-service/client/src/App.js +++ b/web-service/client/src/App.js @@ -1,28 +1,30 @@ import React, { useState } from 'react'; import './App.css' -//import Streams from 'Streams' +//import {Route, BrowserRouter, Link} from 'react-router-domm +import Streams from './Streams' const App = () => { const [user, setUser] = useState(null); - const [username, setUsername] = useState(''); - - const handleLogin = async() => { - /* User clicks on the image of either Haka login or Google Oauth - Server redirects the user then to google oauths site or to the haka site */ + const handleLogin = () => { //BEFORE BUILD CHANGE THE URL TO /google - //Otherwise it wont work as a static build in node server window.location.href="/google"; } + const clearCookies = () => { + window.localStorage.clear(); + window.location.reload(); + } + if(window.localStorage.getItem('token')){ return ( - <div style={{'margin': 'auto', 'text-align': 'center'}}> - <h1>IT WORKS!!</h1> - <h2>Namibia here we come!</h2> - <button onClick={() => {window.localStorage.clear()}}>Remove all cookies</button> - </div> + /* + This should redirect the router path to point at /streams + So instead of the div down below it would render + <Streams /> + */ + <Streams clearCookies={clearCookies}/> ) } return ( diff --git a/web-service/client/src/Stream.js b/web-service/client/src/Stream.js new file mode 100644 index 0000000000000000000000000000000000000000..36feeebf13d643ae6181b3838624c2e63485aab2 --- /dev/null +++ b/web-service/client/src/Stream.js @@ -0,0 +1,5 @@ +/* +Component for individual stream + Router will render to this component in path /stream + Gets specific streams object key as prop +*/ \ No newline at end of file diff --git a/web-service/client/src/Streams.js b/web-service/client/src/Streams.js index a3b02ca4aa74bd28b9fc67dd2e1fe2f606d5b95d..36ffa8aa076aad177b9e347b6472fe74ab577742 100644 --- a/web-service/client/src/Streams.js +++ b/web-service/client/src/Streams.js @@ -1,7 +1,34 @@ - +import React from 'react' /* This file will contain list of streams. The user is able to select which stream he/she will WebAuthentication. - The user will be redirected to Stream.js file -*/ \ No newline at end of file +*/ + +const Streams = ({clearCookies}) => { + return( + <div style={{'margin': 'auto', 'text-align': 'center'}}> + <h1>Streams component works!!</h1> + <h2>Namibia here we come!</h2> + <button onClick={clearCookies}>Logout</button> + </div> + ) +} + +export default Streams; +/* + Server has web socket method "list_streams" that returns the keys for all streams. + + TODO: + React Router + Path might be something like /streams + How will the component get a stream thumbnail? + After getting the stream keys it renders bunch of child components + that each get one key. After getting the key the individual child component makes + a request for "get_stream" method. + + How will the component connect to a stream? + When one of the thumbnails is clicked, it redirects to path /stream and gives it the specific streams object key as props + + + */ \ No newline at end of file diff --git a/web-service/server/package-lock.json b/web-service/server/package-lock.json index 1cbb0937c76a3bdd0d39f1eeb937c4e0f28806ea..48e2bd48423203cc8f1e59ad84ed5a4ad8b0c19d 100644 --- a/web-service/server/package-lock.json +++ b/web-service/server/package-lock.json @@ -54,6 +54,11 @@ "type-is": "~1.6.17" } }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" + }, "bytes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", @@ -105,6 +110,14 @@ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, + "ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -229,6 +242,84 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, + "jsonwebtoken": { + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", + "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", + "requires": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^5.6.0" + }, + "dependencies": { + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + } + } + }, + "jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "requires": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=" + }, + "lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=" + }, + "lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=" + }, + "lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=" + }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=" + }, + "lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=" + }, + "lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" + }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -404,6 +495,11 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, "send": { "version": "0.17.1", "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",