From d05d37e4f9f7f605b886f910b4061e3083ff5e5f Mon Sep 17 00:00:00 2001
From: "karl.hudgell"
Date: Fri, 12 Mar 2021 13:56:26 +0000
Subject: [PATCH] latest
---
.dockerfile | 3 +--
.dockerignore | 4 +++-
SQL/build.sql | 16 +++++++-------
client/.dockerfile | 2 +-
client/Dockerfile.prod | 18 ++++++++++++++++
client/nginx/nginx.conf | 21 +++++++++++++++++++
client/src/App.test.js | 8 -------
client/src/checkAuth.js | 2 ++
client/src/components/AddAccount.jsx | 5 +++--
client/src/components/Navigation.jsx | 31 ++++++++++------------------
docker-compose.yml | 28 +++++++++++++------------
lib/streamArray.json | 2 +-
routes/getStreams.js | 2 +-
13 files changed, 85 insertions(+), 57 deletions(-)
create mode 100644 client/Dockerfile.prod
create mode 100644 client/nginx/nginx.conf
delete mode 100644 client/src/App.test.js
diff --git a/.dockerfile b/.dockerfile
index 5c4a3de..c72ae4c 100644
--- a/.dockerfile
+++ b/.dockerfile
@@ -2,7 +2,6 @@ FROM node:12-alpine
LABEL version="1.0"
LABEL description="DNS BACKEND"
-# LABEL maintainer = ["danielmurph8@gmail.com", "dylanedwards290@gmail.com"]
WORKDIR /app
@@ -10,7 +9,7 @@ COPY ["package.json", "package-lock.json", "./"]
RUN ls
RUN npm i
-RUN apk --no-cache add curl
+# RUN apk --no-cache add curl
COPY . .
diff --git a/.dockerignore b/.dockerignore
index 5171c54..6c0227f 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,2 +1,4 @@
node_modules
-npm-debug.log
\ No newline at end of file
+npm-debug.log
+client
+SQL
\ No newline at end of file
diff --git a/SQL/build.sql b/SQL/build.sql
index bebfe8a..7c56937 100644
--- a/SQL/build.sql
+++ b/SQL/build.sql
@@ -42,7 +42,7 @@ streamName
('Gambler', 'http://37723998.to:2052'),
('Liveclub', 'http://apkdns.store:8080'),
('Opplex', 'http://opplex.tv:8080'),
-('DIAZ', 'http://ruby.dnsfor.me:8880'),
+('DIAZ', 'http://gold.mypsx.net:8880'),
('USA', 'http://pimptv.dnsabr.com:8080'),
('VIPER', 'http://tavaratv.xyz:2095'),
('SUNBED', 'http://cms-tan.media:8880'),
@@ -88,13 +88,13 @@ username
('Dazg3012', '476dd5316a78251fe26cea0a2d2786e8ddaeb8da99f99bfff9e1e34267eb3d0e79f0549cb102edcacd9a1685ee940347f43343c0314fca3816f81d9ec7b9370670e4ec7dddd695795752ad188c56207eb1ef6464d0e8690d4a44084a0918ec12ba6ca01c0d613463886f', 'Old Premium', 2, 1640885178),
('Martin1607', '33db85e33346ac83bc72c2feac294873edab0ec43bba6da5830275af7dbca539a445d3667874ba3cb64b9861a52f9aaa452140d92a3df0e6f87cb8d2eb6eceb9d0c0faaf284164beacb0bca8f3870794c2acd1f29ef310c150b4b1ff2b6e007b249b33c9144688eac57f', 'GunSlinger', 3, 2147483647),
('Martin2204', '8c7e61d5131661fbb246ad7dad0eb05e481235fa5574707b287619331c77da16643ca1c94fb82fd4290a4bc79c7773428a56673e5c3b20c5d13753d66693da69326c3a5be854fefe8b9829e8e6f4e8775e949959cd4caa8d0d063870a8d0da35167566cb575d459a7594', 'Gold', 3, 1619089223),
-('Karl2404', 'c5ee1fa1168da4abdf5cd12697258141f0c68d50269d8f229c422e9af2f79662daabca432d9a1de40ef907cfdbcb42d8e3b98620a221a17020abb0c0552f50859d10baef6f06482d6fcba91d975034bb99c3428e78921f5c155467090a587a5d6cd0783b9051a06283cb', 'Gold', 1, NULL),
-('Karl2804', 'a2d35b98846ade449e1fb07f65627b9a219f5c755418cd3da5c51f6467f99e70e4a0f444899b355df7724c972ec88624298e8efb777005590d4053749d596c09abe96c1fc4ff38237e0d7583edc0aca8516dd54ac09d81bab7d0b55fcae5095db9385e6e8530bd9ef4b1', 'Gold', 1, NULL),
-('Karl2904', '55dfce0674e85eeef328c1ea86a9f4d1c661468c18cc1d4d60457e5bec45e19621d7e8a57367ba8d31a7461712bef8e5c05518b72194ffde95a5deed34a3bc3f68f48c1546a79a7a19dc260030c9b4cc5f4fef9544665846e50f5212a921a5053a5ee237895718db9e67', 'Gold', 1, NULL),
-('Karl150520', 'dc4c407fda600e361db82323cef5fc51c9c9cf67fbd67711b38a49f4c5b10b3dbf62d8b7a531252b35222b0186c876fbdfea39414484916765aabab08bbd828d67b6e668f89927f95a3e08f3b45206658ea516711a65c5c4e28d98b9236e5fd8a1317b78626e49572f83', 'Gold', 1, NULL),
-('Karl1505', '7bfdf1ab7d86e07a3eb6c5614578c41c571ae6f3faaf836233a9b6f33538c6ea1125dab202d99325a92cd35856191fc495b7e5ec6cb2765d5bafa2af18f43c94f3392425a65a14e0e712d1c5de04f662fb84dc14b37151796db7f0eaec8b34351adfd2a93961125b04d9', 'Gold', 1, NULL),
-('Karloss0403', '71f8993c61b41ece3e3a7e8b50ec956670998b9930e667e9f2881ce508effc5b98bac9ddc3579f0455111203e092713bc7375ddd552f0cd7a33c698c147a6d9eea623099c3f993ff8634ef42975c6f8f0e28fb5f81ab1fa3e17a9729388c4b9779e3e9e16204fa570bcb', 'KDB', 1, NULL),
-('Karloss0403', '364cafa40eb896ffc220975d3b52431723a6d715a17c13f12296d62fa1e5f31f71ba2809e3fb9120231de8c388a736eec9064494a187fa7cf10357425d5b8c9d545487e5fed49407afad377f0225d935ea08e867dd803f5c12472a3e70cca7bd233a314a8c747e8ec751', 'DIAZ', 1, NULL);
+('Karl2404', 'c5ee1fa1168da4abdf5cd12697258141f0c68d50269d8f229c422e9af2f79662daabca432d9a1de40ef907cfdbcb42d8e3b98620a221a17020abb0c0552f50859d10baef6f06482d6fcba91d975034bb99c3428e78921f5c155467090a587a5d6cd0783b9051a06283cb', 'Gold', 1, 1619272032),
+('Karl2804', 'a2d35b98846ade449e1fb07f65627b9a219f5c755418cd3da5c51f6467f99e70e4a0f444899b355df7724c972ec88624298e8efb777005590d4053749d596c09abe96c1fc4ff38237e0d7583edc0aca8516dd54ac09d81bab7d0b55fcae5095db9385e6e8530bd9ef4b1', 'Gold', 1, 1619627584),
+('Karl2904', '55dfce0674e85eeef328c1ea86a9f4d1c661468c18cc1d4d60457e5bec45e19621d7e8a57367ba8d31a7461712bef8e5c05518b72194ffde95a5deed34a3bc3f68f48c1546a79a7a19dc260030c9b4cc5f4fef9544665846e50f5212a921a5053a5ee237895718db9e67', 'Gold', 1, 1619717072),
+('Karl150520', 'dc4c407fda600e361db82323cef5fc51c9c9cf67fbd67711b38a49f4c5b10b3dbf62d8b7a531252b35222b0186c876fbdfea39414484916765aabab08bbd828d67b6e668f89927f95a3e08f3b45206658ea516711a65c5c4e28d98b9236e5fd8a1317b78626e49572f83', 'Gold', 1, 1621103874),
+('Karl1505', '7bfdf1ab7d86e07a3eb6c5614578c41c571ae6f3faaf836233a9b6f33538c6ea1125dab202d99325a92cd35856191fc495b7e5ec6cb2765d5bafa2af18f43c94f3392425a65a14e0e712d1c5de04f662fb84dc14b37151796db7f0eaec8b34351adfd2a93961125b04d9', 'Gold', 1, 1621103852),
+('Karloss0403', '71f8993c61b41ece3e3a7e8b50ec956670998b9930e667e9f2881ce508effc5b98bac9ddc3579f0455111203e092713bc7375ddd552f0cd7a33c698c147a6d9eea623099c3f993ff8634ef42975c6f8f0e28fb5f81ab1fa3e17a9729388c4b9779e3e9e16204fa570bcb', 'KDB', 1, 1646394742),
+('Karloss0403', '364cafa40eb896ffc220975d3b52431723a6d715a17c13f12296d62fa1e5f31f71ba2809e3fb9120231de8c388a736eec9064494a187fa7cf10357425d5b8c9d545487e5fed49407afad377f0225d935ea08e867dd803f5c12472a3e70cca7bd233a314a8c747e8ec751', 'DIAZ', 1, 1646394794);
DROP TABLE IF EXISTS `users`;
diff --git a/client/.dockerfile b/client/.dockerfile
index f5da75c..d14b2d8 100644
--- a/client/.dockerfile
+++ b/client/.dockerfile
@@ -9,7 +9,7 @@ COPY ["package.json", "package-lock.json", "./"]
ENV PORT=6969
-RUN apk --no-cache add curl
+# RUN apk --no-cache add curl
RUN npm install --production
COPY . .
diff --git a/client/Dockerfile.prod b/client/Dockerfile.prod
new file mode 100644
index 0000000..e8c8009
--- /dev/null
+++ b/client/Dockerfile.prod
@@ -0,0 +1,18 @@
+# stage1 - build react app first
+FROM node:12-alpine as build
+WORKDIR /app
+ENV PATH /app/node_modules/.bin:$PATH
+COPY ./package.json /app/
+COPY ./yarn.lock /app/
+RUN yarn
+COPY . /app
+RUN yarn build
+
+# stage 2 - build the final image and copy the react build files
+FROM nginx:1.17.8-alpine
+COPY --from=build /app/build /usr/share/nginx/html
+RUN apk --no-cache add curl
+RUN rm /etc/nginx/conf.d/default.conf
+COPY nginx/nginx.conf /etc/nginx/conf.d
+EXPOSE 6969
+CMD ["nginx", "-g", "daemon off;"]
\ No newline at end of file
diff --git a/client/nginx/nginx.conf b/client/nginx/nginx.conf
new file mode 100644
index 0000000..e6f315e
--- /dev/null
+++ b/client/nginx/nginx.conf
@@ -0,0 +1,21 @@
+server {
+
+ listen 6969;
+
+ location / {
+ root /usr/share/nginx/html;
+ index index.html index.htm;
+
+ # to redirect all the requests to index.html,
+ # useful when you are using react-router
+
+ try_files $uri /index.html;
+ }
+
+ error_page 500 502 503 504 /50x.html;
+
+ location = /50x.html {
+ root /usr/share/nginx/html;
+ }
+
+}
\ No newline at end of file
diff --git a/client/src/App.test.js b/client/src/App.test.js
deleted file mode 100644
index 1f03afe..0000000
--- a/client/src/App.test.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import { render, screen } from '@testing-library/react';
-import App from './App';
-
-test('renders learn react link', () => {
- render();
- const linkElement = screen.getByText(/learn react/i);
- expect(linkElement).toBeInTheDocument();
-});
diff --git a/client/src/checkAuth.js b/client/src/checkAuth.js
index a360954..07414b1 100644
--- a/client/src/checkAuth.js
+++ b/client/src/checkAuth.js
@@ -4,7 +4,9 @@ async function readCookie() {
try {
const res = await axios.get("/readCookie");
+ console.log('IM CHECKING AUTH')
if (res.data === "No Cookie Set") {
+ console.log('I CHECKED AUTH')
document.location = "/";
}
} catch (e) {
diff --git a/client/src/components/AddAccount.jsx b/client/src/components/AddAccount.jsx
index 9d010bb..755fc47 100644
--- a/client/src/components/AddAccount.jsx
+++ b/client/src/components/AddAccount.jsx
@@ -109,8 +109,9 @@ class AddAccount extends Component {
diff --git a/client/src/components/Navigation.jsx b/client/src/components/Navigation.jsx
index fda5c6d..a39a323 100644
--- a/client/src/components/Navigation.jsx
+++ b/client/src/components/Navigation.jsx
@@ -4,48 +4,39 @@ import { Link, withRouter } from "react-router-dom";
function Navigation(props) {
return (
-