Compare commits
No commits in common. "master" and "react-branch" have entirely different histories.
master
...
react-bran
@ -2,6 +2,7 @@ FROM node:12-alpine
|
||||
|
||||
LABEL version="1.0"
|
||||
LABEL description="DNS BACKEND"
|
||||
# LABEL maintainer = ["danielmurph8@gmail.com", "dylanedwards290@gmail.com"]
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@ -9,7 +10,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 . .
|
||||
|
||||
|
@ -1,4 +1,2 @@
|
||||
node_modules
|
||||
npm-debug.log
|
||||
client
|
||||
SQL
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1 @@
|
||||
node_modules
|
||||
test2.js
|
||||
.env
|
||||
|
50
.vscode/launch.json
vendored
50
.vscode/launch.json
vendored
@ -5,22 +5,11 @@
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Program",
|
||||
"program": "${workspaceFolder}/lib/apache_functions.js",
|
||||
"name": "React",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"type": "pwa-node",
|
||||
"env": {
|
||||
"DBHOST": "vps.k-world.me.uk",
|
||||
"DBUSER": "root",
|
||||
"DBPASS": "Grd555269",
|
||||
"DATABASE": "BBLB_DNS",
|
||||
"DBPORT": "3306",
|
||||
"TORSSRV": "localhost",
|
||||
"TORSPWD": "KarlMax",
|
||||
}
|
||||
"url": "http://localhost:6969",
|
||||
"webRoot": "${workspaceRoot}/react-backend/client/src"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
@ -29,16 +18,7 @@
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"program": "${workspaceFolder}/bin/www",
|
||||
"env": {
|
||||
"DBHOST": "vps.k-world.me.uk",
|
||||
"DBUSER": "root",
|
||||
"DBPASS": "Grd555269",
|
||||
"DATABASE": "BBLB_DNS",
|
||||
"DBPORT": "3306",
|
||||
"TORSSRV": "localhost",
|
||||
"TORSPWD": "KarlMax",
|
||||
}
|
||||
"program": "${workspaceFolder}/bin/www"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
@ -47,16 +27,16 @@
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"program": "${workspaceFolder}/lib/checker.js",
|
||||
"env": {
|
||||
"DBHOST": "vps.k-world.me.uk",
|
||||
"DBUSER": "root",
|
||||
"DBPASS": "Grd555269",
|
||||
"DATABASE": "BBLB_DNS",
|
||||
"DBPORT": "3306",
|
||||
"TORSSRV": "localhost",
|
||||
"TORSPWD": "KarlMax",
|
||||
}
|
||||
"program": "${workspaceFolder}/checker.js"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "password",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"program": "${workspaceFolder}/lib/addAccounts.js"
|
||||
}
|
||||
]
|
||||
}
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -1,2 +0,0 @@
|
||||
{
|
||||
}
|
0
SQL (1)/BBLB_DNS_userAccounts.sql
Normal file
0
SQL (1)/BBLB_DNS_userAccounts.sql
Normal file
@ -1,96 +0,0 @@
|
||||
-- Adminer 4.7.8 MySQL dump
|
||||
|
||||
SET NAMES utf8;
|
||||
SET time_zone
|
||||
= '+00:00';
|
||||
SET foreign_key_checks
|
||||
= 0;
|
||||
SET sql_mode
|
||||
= 'NO_AUTO_VALUE_ON_ZERO';
|
||||
|
||||
DROP DATABASE IF EXISTS `BBLB_DNS`;
|
||||
CREATE DATABASE `BBLB_DNS` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin */;
|
||||
USE `BBLB_DNS`;
|
||||
|
||||
DROP TABLE IF EXISTS `streams`;
|
||||
CREATE TABLE `streams`
|
||||
(
|
||||
`id` int
|
||||
(11) NOT NULL AUTO_INCREMENT,
|
||||
`streamName` varchar
|
||||
(255) COLLATE utf8_bin NOT NULL,
|
||||
`streamURL` varchar
|
||||
(255) COLLATE utf8_bin NOT NULL,
|
||||
PRIMARY KEY
|
||||
(`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
DROP TABLE IF EXISTS `userAccounts`;
|
||||
CREATE TABLE `userAccounts`
|
||||
(
|
||||
`id` int
|
||||
(11) NOT NULL AUTO_INCREMENT,
|
||||
`username` varchar
|
||||
(255) COLLATE utf8_bin NOT NULL,
|
||||
`password` varchar
|
||||
(255) COLLATE utf8_bin NOT NULL,
|
||||
`stream` varchar
|
||||
(255) COLLATE utf8_bin NOT NULL,
|
||||
`userId` int
|
||||
(11) NOT NULL,
|
||||
`expiaryDate` int
|
||||
(11) NOT NULL,
|
||||
`streamURL` varchar
|
||||
(255) COLLATE utf8_bin NOT NULL,
|
||||
PRIMARY KEY
|
||||
(`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
INSERT INTO userAccounts (
|
||||
username
|
||||
, password, stream, userId, expiaryDate) VALUES
|
||||
('Karl2903', '436e09390f77663091780c2796418f095a74ae0a9b181b69cc51575ec3bcd3a1c8b5a47d1af288b25dd757c27e74319d7457b8a37859e7a248e71f0f9ef5b23304dbf784d26ec2accf9ce6b612c0008387086289527dfaf10d8368c811a853d5402e09815226d6dc', 'Gold', 1, 1617100032),
|
||||
('Karl2802', 'bf8605f7c3386f5857a6df3c15be0a3de9cfb32179cb2f0454cf1f46844b4ae2b24a4d6e2705e78dcf3e019a3b7f3b9d90e9f3bf279f8950ae187de96d19c50989e921b6a4c1fe3d1cf189474db05933c505e7eea91ef18a25bdc7f74274e63af4ce8c01da69aeab83fe', 'PremiumPlus', 1, 1614504315),
|
||||
('Karl0704', '89e8e131570896ee1f83bf97fc2a73a61f448cfe379cef9c8af8489f21a5aa7c0309de4350c443f7d5bbc15162ef5c6115db6c58ac510d9a982414f8725246cb6c801fe526d0eac98c198f25b7e1b17c38647cfce3cf8ba4e6276d081ac6522cfc0778d71796294e3f97', 'VIP', 1, 1617787739),
|
||||
('Karl24', '482899bc267eaa17c97ff9440588717feccfd591aa7501d0c16eb0a9667204f6a35c39a098330efef2d167d918ad5a49c3917b85a3dd4e8af7e391e0cb47beff7276dccb3f6a450ee7dafedcbe3a1593c4569509c32b8e8cbbb26bd8db31fe2f214f928d61bf09e8744b', 'Insanity', 1, 1624444437),
|
||||
('Karl2206', 'a047fa4d67f78d94b7eb3834055d9ae6af398c448e59701e2e4a52f9e36f72c59529674acb2cb1f334b9eba88b154638f43ab5865c85ed77f1300ed11bcab337e7457a854dd9d1e8f484ddda960d7864448fd12b117690350c19c2a0d583391a279465b6f9e356ab4104', 'GunSlinger', 1, 1624301605),
|
||||
('Darren1706', 'cfe5a6be558d12daf878e0570a84bfb96ff02a2b436e9edb8ddd258fc1311522305139f3758e345b905c5b15f3d41fc06f2f5006dee50975342a5eadc2b48f30b106b3c75510e1201f131235f23716edfc61250972018233532f72a537bf4762776ff1bd0e39d4f6017d', 'Technoid', 2, 1624005116),
|
||||
('Dazg3012', '476dd5316a78251fe26cea0a2d2786e8ddaeb8da99f99bfff9e1e34267eb3d0e79f0549cb102edcacd9a1685ee940347f43343c0314fca3816f81d9ec7b9370670e4ec7dddd695795752ad188c56207eb1ef6464d0e8690d4a44084a0918ec12ba6ca01c0d613463886f', 'Old Premium', 2, 1640885178),
|
||||
('Martin1607', '33db85e33346ac83bc72c2feac294873edab0ec43bba6da5830275af7dbca539a445d3667874ba3cb64b9861a52f9aaa452140d92a3df0e6f87cb8d2eb6eceb9d0c0faaf284164beacb0bca8f3870794c2acd1f29ef310c150b4b1ff2b6e007b249b33c9144688eac57f', 'GunSlinger', 3, 2147483647),
|
||||
('Martin2204', '8c7e61d5131661fbb246ad7dad0eb05e481235fa5574707b287619331c77da16643ca1c94fb82fd4290a4bc79c7773428a56673e5c3b20c5d13753d66693da69326c3a5be854fefe8b9829e8e6f4e8775e949959cd4caa8d0d063870a8d0da35167566cb575d459a7594', 'Gold', 3, 1619089223),
|
||||
('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),
|
||||
('Karl0ss1703', 'b96aaf626027d671a0d0b3975bdc498631e33f9a177700b006db2edd1b31d3fc35bbc0812b6ee86e0693a76d358309ce1a070a7d35117cfd3fde8a6d7763766d42c35702b5cc0e933069a955ebd36c00349eedc2c9b80e5c493dcf69e9cfa62afdd81c0d9eadd67b405b', 'KDB', 1, 1647549531),
|
||||
('Karl0ss1703', '2cfaf0ebd2aa3fc2f8b750cc24bdd54e3f2ea53ba7204e77ab35b85cb24a801fcaabffb74c7f755ab79646fcb36cd45cd3ce4de10148d006ede36154e86a839defc6d3f473e27f4cd520de11b179a1df445cb34cb9857128d440632c59c154a2118f46555d9b48afdc09', 'Titan', 1, 1647549703);
|
||||
|
||||
DROP TABLE IF EXISTS `users`;
|
||||
CREATE TABLE `users`
|
||||
(
|
||||
`id` int
|
||||
(11) NOT NULL AUTO_INCREMENT,
|
||||
`userName` varchar
|
||||
(255) COLLATE utf8_bin NOT NULL,
|
||||
`password` varchar
|
||||
(255) COLLATE utf8_bin NOT NULL,
|
||||
PRIMARY KEY
|
||||
(`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
INSERT INTO users (
|
||||
userName
|
||||
, password) VALUES
|
||||
('Karl', 'TEST'),
|
||||
('Darren', 'bla'),
|
||||
('Duly', 'Blda')
|
||||
ON DUPLICATE KEY
|
||||
UPDATE `id` = VALUES
|
||||
(`id`), `userName` = VALUES
|
||||
(`userName`), `password` = VALUES
|
||||
(`password`);
|
||||
|
||||
-- 2021-02-28 10:28:08
|
21
SQL/streams.sql
Normal file
21
SQL/streams.sql
Normal file
@ -0,0 +1,21 @@
|
||||
-- Script was generated by Devart dbForge Studio for MySQL, Version 6.0.128.0
|
||||
-- Product home page: http://www.devart.com/dbforge/mysql/studio
|
||||
-- Script date 17/02/2021 10:52:02
|
||||
-- Server version: 5.5.5-10.5.8-MariaDB-1:10.5.8+maria~focal
|
||||
-- Client version: 4.1
|
||||
|
||||
SET NAMES 'utf8';
|
||||
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
|
||||
(1, 'Gold', 'http://catenamode.cf:8090');
|
||||
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
|
||||
(2, 'Insanity', 'https://trippy.pro:443');
|
||||
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
|
||||
(3, 'PremiumPlus', 'https://itty.in:443');
|
||||
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
|
||||
(4, 'GunSlinger', 'http://gunslingertv.org:8080');
|
||||
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
|
||||
(5, 'VIP', 'http://oven-cleaner.com:8080/');
|
||||
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
|
||||
(6, 'Technoid', 'http://capoisagod2021.org:8080');
|
||||
INSERT INTO BBLB_DNS.streams(idstreams, streamName, streamURL) VALUES
|
||||
(7, 'Old Premium', 'https://caporeds.online:443');
|
7
SQL/unknownstreams.sql
Normal file
7
SQL/unknownstreams.sql
Normal file
@ -0,0 +1,7 @@
|
||||
-- Script was generated by Devart dbForge Studio for MySQL, Version 6.0.128.0
|
||||
-- Product home page: http://www.devart.com/dbforge/mysql/studio
|
||||
-- Script date 17/02/2021 10:52:03
|
||||
-- Server version: 5.5.5-10.5.8-MariaDB-1:10.5.8+maria~focal
|
||||
-- Client version: 4.1
|
||||
|
||||
SET NAMES 'utf8';
|
25
SQL/userAccounts.sql
Normal file
25
SQL/userAccounts.sql
Normal file
@ -0,0 +1,25 @@
|
||||
-- Script was generated by Devart dbForge Studio for MySQL, Version 6.0.128.0
|
||||
-- Product home page: http://www.devart.com/dbforge/mysql/studio
|
||||
-- Script date 17/02/2021 10:52:01
|
||||
-- Server version: 5.5.5-10.5.8-MariaDB-1:10.5.8+maria~focal
|
||||
-- Client version: 4.1
|
||||
|
||||
SET NAMES 'utf8';
|
||||
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
|
||||
(12, 'Karl2903', '436e09390f77663091780c2796418f095a74ae0a9b181b69cc51575ec3bcd3a1c8b5a47d1af288b25dd757c27e74319d7457b8a37859e7a248e71f0f9ef5b23304dbf784d26ec2accf9ce6b612c0008387086289527dfaf10d8368c811a853d5402e09815226d6dc', 'Gold', '1', 1617100032);
|
||||
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
|
||||
(16, 'Karl2802', 'bf8605f7c3386f5857a6df3c15be0a3de9cfb32179cb2f0454cf1f46844b4ae2b24a4d6e2705e78dcf3e019a3b7f3b9d90e9f3bf279f8950ae187de96d19c50989e921b6a4c1fe3d1cf189474db05933c505e7eea91ef18a25bdc7f74274e63af4ce8c01da69aeab83fe', 'PremiumPlus', '1', 1614504315);
|
||||
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
|
||||
(17, 'Karl0704', '89e8e131570896ee1f83bf97fc2a73a61f448cfe379cef9c8af8489f21a5aa7c0309de4350c443f7d5bbc15162ef5c6115db6c58ac510d9a982414f8725246cb6c801fe526d0eac98c198f25b7e1b17c38647cfce3cf8ba4e6276d081ac6522cfc0778d71796294e3f97', 'VIP', '1', 1617787739);
|
||||
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
|
||||
(18, 'Karl24', '482899bc267eaa17c97ff9440588717feccfd591aa7501d0c16eb0a9667204f6a35c39a098330efef2d167d918ad5a49c3917b85a3dd4e8af7e391e0cb47beff7276dccb3f6a450ee7dafedcbe3a1593c4569509c32b8e8cbbb26bd8db31fe2f214f928d61bf09e8744b', 'Insanity', '1', 1624444437);
|
||||
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
|
||||
(19, 'Karl2206', 'a047fa4d67f78d94b7eb3834055d9ae6af398c448e59701e2e4a52f9e36f72c59529674acb2cb1f334b9eba88b154638f43ab5865c85ed77f1300ed11bcab337e7457a854dd9d1e8f484ddda960d7864448fd12b117690350c19c2a0d583391a279465b6f9e356ab4104', 'GunSlinger', '1', 1624301605);
|
||||
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
|
||||
(20, 'Darren1706', 'cfe5a6be558d12daf878e0570a84bfb96ff02a2b436e9edb8ddd258fc1311522305139f3758e345b905c5b15f3d41fc06f2f5006dee50975342a5eadc2b48f30b106b3c75510e1201f131235f23716edfc61250972018233532f72a537bf4762776ff1bd0e39d4f6017d', 'Technoid', '2', 1624005116);
|
||||
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
|
||||
(21, 'Dazg3012', '476dd5316a78251fe26cea0a2d2786e8ddaeb8da99f99bfff9e1e34267eb3d0e79f0549cb102edcacd9a1685ee940347f43343c0314fca3816f81d9ec7b9370670e4ec7dddd695795752ad188c56207eb1ef6464d0e8690d4a44084a0918ec12ba6ca01c0d613463886f', 'Old Premium', '2', 1640885178);
|
||||
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
|
||||
(22, 'Martin1607', '33db85e33346ac83bc72c2feac294873edab0ec43bba6da5830275af7dbca539a445d3667874ba3cb64b9861a52f9aaa452140d92a3df0e6f87cb8d2eb6eceb9d0c0faaf284164beacb0bca8f3870794c2acd1f29ef310c150b4b1ff2b6e007b249b33c9144688eac57f', 'GunSlinger', '3', 2147483647);
|
||||
INSERT INTO BBLB_DNS.userAccounts(userscol, username, password, stream, userID, expiaryDate) VALUES
|
||||
(23, 'Martin2204', '8c7e61d5131661fbb246ad7dad0eb05e481235fa5574707b287619331c77da16643ca1c94fb82fd4290a4bc79c7773428a56673e5c3b20c5d13753d66693da69326c3a5be854fefe8b9829e8e6f4e8775e949959cd4caa8d0d063870a8d0da35167566cb575d459a7594', 'Gold', '3', 1619089223);
|
13
SQL/users.sql
Normal file
13
SQL/users.sql
Normal file
@ -0,0 +1,13 @@
|
||||
-- Script was generated by Devart dbForge Studio for MySQL, Version 6.0.128.0
|
||||
-- Product home page: http://www.devart.com/dbforge/mysql/studio
|
||||
-- Script date 17/02/2021 10:52:04
|
||||
-- Server version: 5.5.5-10.5.8-MariaDB-1:10.5.8+maria~focal
|
||||
-- Client version: 4.1
|
||||
|
||||
SET NAMES 'utf8';
|
||||
INSERT INTO BBLB_DNS.users(idusers, userName, password) VALUES
|
||||
(1, 'Karl', 'TEST');
|
||||
INSERT INTO BBLB_DNS.users(idusers, userName, password) VALUES
|
||||
(2, 'Darren', 'bla');
|
||||
INSERT INTO BBLB_DNS.users(idusers, userName, password) VALUES
|
||||
(3, 'Duly', 'Blda');
|
@ -1,4 +1,4 @@
|
||||
docker stop ktvmanager &\
|
||||
docker rm --force ktvmanager &\
|
||||
docker build -t ktvmanager . &&\
|
||||
docker run -p 6969:6969 -v ${PWD}/logs:/usr/src/app/logs -d --name kTvManager ktvmanager:latest
|
||||
docker stop bblbtv_dns &&\
|
||||
docker rm --force bblbtv_dns &&\
|
||||
docker build -t bblbtv_dns . &&\
|
||||
docker run -p 6969:6969 -v ${PWD}/logs:/usr/src/app/logs -d --name bblbtv_dns bblbtv_dns:latest
|
37
app.js
37
app.js
@ -1,31 +1,38 @@
|
||||
var createError = require('http-errors');
|
||||
var express = require('express');
|
||||
const basicAuth = require('express-basic-auth')
|
||||
|
||||
const { getUsers } = require('./lib/getUsers')
|
||||
var path = require('path');
|
||||
var cookieParser = require('cookie-parser');
|
||||
var logger = require('morgan');
|
||||
|
||||
var indexRouter = require('./routes/index');
|
||||
var streamsRouter = require('./routes/getStreams');
|
||||
var getUserAccounts = require('./routes/getUserAccounts')
|
||||
var singleUserCheck = require('./routes/singleCheck')
|
||||
var addAccount = require('./routes/addAccount')
|
||||
var deleteAccount = require('./routes/deleteAccount')
|
||||
var login = require('./routes/login')
|
||||
var app = express();
|
||||
// const basicAuth = require('express-basic-auth')
|
||||
|
||||
|
||||
let usersList = getUsers()
|
||||
// view engine setup
|
||||
app.set('views', path.join(__dirname, 'views'));
|
||||
app.set('view engine', 'jade');
|
||||
|
||||
const users = {
|
||||
users: usersList,
|
||||
challenge: true
|
||||
}
|
||||
app.use(logger('dev'));
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: false }));
|
||||
app.use(cookieParser());
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
app.use('/', indexRouter);
|
||||
app.use('/login', basicAuth(users), login)
|
||||
app.use('/getUserAccounts', basicAuth(users), getUserAccounts);
|
||||
app.use('/singleCheck', basicAuth(users), singleUserCheck)
|
||||
app.use('/addAccount', basicAuth(users), addAccount)
|
||||
app.use('/deleteAccount', basicAuth(users), deleteAccount)
|
||||
app.use('/getStreams', streamsRouter);
|
||||
app.use('/getUserAccounts', getUserAccounts);
|
||||
app.use('/singleCheck', singleUserCheck)
|
||||
app.use('/addAccount', addAccount)
|
||||
// app.use(basicAuth({
|
||||
// users: { 'BBLBTV': 'BBLBTV' },
|
||||
// challenge: true,
|
||||
// realm: 'foo',
|
||||
// }))
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function (req, res, next) {
|
||||
|
2
bin/www
2
bin/www
@ -4,8 +4,6 @@
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
require('dotenv').config()
|
||||
|
||||
var app = require('../app');
|
||||
var debug = require('debug')('react-backend:server');
|
||||
var http = require('http');
|
||||
|
20
client/.dockerfile
Normal file
20
client/.dockerfile
Normal file
@ -0,0 +1,20 @@
|
||||
FROM node:12-alpine
|
||||
|
||||
LABEL version="1.0"
|
||||
LABEL description="FRONTEND"
|
||||
# LABEL maintainer = ["danielmurph8@gmail.com", "dylanedwards290@gmail.com"]
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ["package.json", "package-lock.json", "./"]
|
||||
|
||||
ENV PORT=6969
|
||||
|
||||
RUN apk --no-cache add curl
|
||||
RUN npm install --production
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 6969
|
||||
|
||||
CMD ["npm", "start"]
|
23
client/.gitignore
vendored
Normal file
23
client/.gitignore
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
70
client/README.md
Normal file
70
client/README.md
Normal file
@ -0,0 +1,70 @@
|
||||
# Getting Started with Create React App
|
||||
|
||||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `yarn start`
|
||||
|
||||
Runs the app in the development mode.\
|
||||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
||||
|
||||
The page will reload if you make edits.\
|
||||
You will also see any lint errors in the console.
|
||||
|
||||
### `yarn test`
|
||||
|
||||
Launches the test runner in the interactive watch mode.\
|
||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
||||
|
||||
### `yarn build`
|
||||
|
||||
Builds the app for production to the `build` folder.\
|
||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.\
|
||||
Your app is ready to be deployed!
|
||||
|
||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
||||
|
||||
### `yarn eject`
|
||||
|
||||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
||||
|
||||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
||||
|
||||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
||||
|
||||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
||||
|
||||
## Learn More
|
||||
|
||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
||||
|
||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
||||
|
||||
### Code Splitting
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
||||
|
||||
### Analyzing the Bundle Size
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
||||
|
||||
### Making a Progressive Web App
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
||||
|
||||
### Advanced Configuration
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
||||
|
||||
### Deployment
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
||||
|
||||
### `yarn build` fails to minify
|
||||
|
||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
15641
client/package-lock.json
generated
Normal file
15641
client/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
39
client/package.json
Normal file
39
client/package.json
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "client",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@testing-library/jest-dom": "^5.11.4",
|
||||
"@testing-library/react": "^11.1.0",
|
||||
"@testing-library/user-event": "^12.1.10",
|
||||
"react": "^17.0.1",
|
||||
"react-dom": "^17.0.1",
|
||||
"react-scripts": "4.0.2",
|
||||
"web-vitals": "^1.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "set PORT=6969 && react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"proxy": "http://localhost:3001",
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
BIN
client/public/favicon.ico
Normal file
BIN
client/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
43
client/public/index.html
Normal file
43
client/public/index.html
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="description"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>React App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
BIN
client/public/logo192.png
Normal file
BIN
client/public/logo192.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
BIN
client/public/logo512.png
Normal file
BIN
client/public/logo512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.4 KiB |
25
client/public/manifest.json
Normal file
25
client/public/manifest.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
3
client/public/robots.txt
Normal file
3
client/public/robots.txt
Normal file
@ -0,0 +1,3 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
53
client/src/App.css
Normal file
53
client/src/App.css
Normal file
@ -0,0 +1,53 @@
|
||||
/* Pen-specific styles */
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
font-size: 1.25rem;
|
||||
font-family: sans-serif;
|
||||
line-height: 150%;
|
||||
text-shadow: 0 2px 2px #1b1917;
|
||||
}
|
||||
|
||||
section {
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
article {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.75rem;
|
||||
margin: 0 0 0.75rem 0;
|
||||
}
|
||||
|
||||
/* Pattern styles */
|
||||
.container {
|
||||
display: table;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.left-half {
|
||||
background-color: #060b4d9f;
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.right-half {
|
||||
background-color: #060b4d9f;
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
width: 50%;
|
||||
}
|
81
client/src/App.js
Normal file
81
client/src/App.js
Normal file
@ -0,0 +1,81 @@
|
||||
import React, { Component } from 'react';
|
||||
import axios from 'axios';
|
||||
import './App.css';
|
||||
class App extends Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
fname: '',
|
||||
lname: '',
|
||||
streams: []
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
componentDidMount() {
|
||||
fetch('/getStreams')
|
||||
.then(res => res.json())
|
||||
.then(streams => this.setState({ streams }));
|
||||
}
|
||||
|
||||
|
||||
onChange = (e) => {
|
||||
/*
|
||||
Because we named the inputs to match their
|
||||
corresponding values in state, it's
|
||||
super easy to update the state
|
||||
*/
|
||||
this.setState({ [e.target.name]: e.target.value });
|
||||
}
|
||||
|
||||
onSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
// get our form data out of state
|
||||
const { fname, lname } = this.state;
|
||||
console.log({ fname, lname })
|
||||
}
|
||||
|
||||
render() {
|
||||
const { fname, lname } = this.state;
|
||||
return (
|
||||
<section class="container">
|
||||
<div class="left-half">
|
||||
<article>
|
||||
<h1>User Login</h1>
|
||||
<p>
|
||||
<form onSubmit={this.onSubmit}>
|
||||
<p>UserName
|
||||
<input
|
||||
type="text"
|
||||
name="fname"
|
||||
value={fname}
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
</p>
|
||||
<p>Password
|
||||
<input
|
||||
type="text"
|
||||
name="lname"
|
||||
value={lname}
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
</p>
|
||||
<br />
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
<div class="right-half">
|
||||
<article>
|
||||
<h1>Stream Details</h1>
|
||||
{this.state.streams.map(stream =>
|
||||
<div key={stream.StreamName}>{stream.StreamName} - {stream.StreamURL}</div>
|
||||
)}
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
}
|
||||
export default App;
|
8
client/src/App.test.js
Normal file
8
client/src/App.test.js
Normal file
@ -0,0 +1,8 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import App from './App';
|
||||
|
||||
test('renders learn react link', () => {
|
||||
render(<App />);
|
||||
const linkElement = screen.getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
});
|
60
client/src/app2.js
Normal file
60
client/src/app2.js
Normal file
@ -0,0 +1,60 @@
|
||||
import React, { Component } from 'react';
|
||||
import axios from 'axios';
|
||||
|
||||
class UserForm extends Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
fname: '',
|
||||
lname: '',
|
||||
email: '',
|
||||
};
|
||||
}
|
||||
|
||||
onChange = (e) => {
|
||||
/*
|
||||
Because we named the inputs to match their
|
||||
corresponding values in state, it's
|
||||
super easy to update the state
|
||||
*/
|
||||
this.setState({ [e.target.name]: e.target.value });
|
||||
}
|
||||
|
||||
onSubmit = (e) => {
|
||||
e.preventDefault();
|
||||
// get our form data out of state
|
||||
const { fname, lname, email } = this.state;
|
||||
|
||||
axios.post('/', { fname, lname, email })
|
||||
.then((result) => {
|
||||
//access the results here....
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const { fname, lname, email } = this.state;
|
||||
return (
|
||||
<form onSubmit={this.onSubmit}>
|
||||
<input
|
||||
type="text"
|
||||
name="fname"
|
||||
value={fname}
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
name="lname"
|
||||
value={lname}
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
<input
|
||||
type="text"
|
||||
name="email"
|
||||
value={email}
|
||||
onChange={this.onChange}
|
||||
/>
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
}
|
13
client/src/index.css
Normal file
13
client/src/index.css
Normal file
@ -0,0 +1,13 @@
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
monospace;
|
||||
}
|
17
client/src/index.js
Normal file
17
client/src/index.js
Normal file
@ -0,0 +1,17 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||
reportWebVitals();
|
99
client/src/login.js
Normal file
99
client/src/login.js
Normal file
@ -0,0 +1,99 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import ReactDOM from "react-dom";
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
function View (props) {
|
||||
const { screen, setScreen } = props;
|
||||
|
||||
const [data, setData] = useState();
|
||||
|
||||
const deleteCookie = async () => {
|
||||
try {
|
||||
await axios.get('/clear-cookie');
|
||||
setScreen('auth');
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
|
||||
const getData = async () => {
|
||||
try {
|
||||
const res = await axios.get('/get-data');
|
||||
console.log(res.data)
|
||||
setData(res.data);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<p>{screen}</p>
|
||||
<p>{data}</p>
|
||||
<button onClick={getData}>Get Data</button>
|
||||
<button onClick={deleteCookie}>Logout</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function App() {
|
||||
|
||||
const [screen, setScreen] = useState('auth');
|
||||
const [username, setUsername] = useState();
|
||||
const [password, setPassword] = useState();
|
||||
|
||||
const auth = async () => {
|
||||
try {
|
||||
const res = await axios.get('/authenticate', { auth: { username, password } });
|
||||
|
||||
if (res.data.screen !== undefined) {
|
||||
setScreen(res.data.screen);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
|
||||
const readCookie = async () => {
|
||||
try {
|
||||
const res = await axios.get('/read-cookie');
|
||||
|
||||
if (res.data.screen !== undefined) {
|
||||
setScreen(res.data.screen);
|
||||
}
|
||||
} catch (e) {
|
||||
setScreen('auth');
|
||||
console.log(e);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
readCookie();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="App">
|
||||
{screen === 'auth'
|
||||
? <div>
|
||||
<label>Username: </label>
|
||||
<br/>
|
||||
<input type="text" onChange={e => setUsername(e.target.value)} />
|
||||
<br/>
|
||||
<label>Password: </label>
|
||||
<br/>
|
||||
<input type="password" onChange={e => setPassword(e.target.value)} />
|
||||
<br/>
|
||||
<button onClick={auth}>Login</button>
|
||||
</div>
|
||||
: <View screen={screen} setScreen={setScreen} />
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
||||
|
||||
const rootElement = document.getElementById("root");
|
||||
ReactDOM.render(<App />, rootElement);
|
1
client/src/logo.svg
Normal file
1
client/src/logo.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
|
After Width: | Height: | Size: 2.6 KiB |
13
client/src/reportWebVitals.js
Normal file
13
client/src/reportWebVitals.js
Normal file
@ -0,0 +1,13 @@
|
||||
const reportWebVitals = onPerfEntry => {
|
||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||
getCLS(onPerfEntry);
|
||||
getFID(onPerfEntry);
|
||||
getFCP(onPerfEntry);
|
||||
getLCP(onPerfEntry);
|
||||
getTTFB(onPerfEntry);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default reportWebVitals;
|
5
client/src/setupTests.js
Normal file
5
client/src/setupTests.js
Normal file
@ -0,0 +1,5 @@
|
||||
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom';
|
11392
client/yarn.lock
Normal file
11392
client/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@ -5,31 +5,27 @@ services:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: .dockerfile
|
||||
image: "karl0ss/ktvmanager"
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
volumes:
|
||||
- ./SQL/:/docker-entrypoint-initdb.d
|
||||
image: "karl0ss/bblbtv_dns-backend"
|
||||
ports:
|
||||
- "3001:3001"
|
||||
frontend:
|
||||
build:
|
||||
context: ./client
|
||||
dockerfile: .dockerfile
|
||||
image: "karl0ss/bblbtv_dns-frontend"
|
||||
ports:
|
||||
- "6969:6969"
|
||||
environment:
|
||||
- DBHOST=vps.k-world.me.uk
|
||||
- DBUSER=root
|
||||
- DBPASS=Grd555269
|
||||
- DATABASE=BBLB_DNS
|
||||
- DBPORT=3306
|
||||
- TORSSRV=host.docker.internal
|
||||
- TORSPWD=KarlMax
|
||||
# frontend:
|
||||
# build:
|
||||
# context: ./client
|
||||
# dockerfile: Dockerfile.prod
|
||||
# # dockerfile: .dockerfile
|
||||
# image: "karl0ss/bblbtv_dns-frontend"
|
||||
# ports:
|
||||
# - "6969:6969"
|
||||
# environment:
|
||||
# - URL=vps.k-world.me.uk
|
||||
# - PORT=6969
|
||||
# links:
|
||||
# - "backend"
|
||||
- PORT=6969
|
||||
links:
|
||||
- "backend:be"
|
||||
db:
|
||||
image: mariadb
|
||||
restart: always
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: example
|
||||
adminer:
|
||||
image: adminer
|
||||
restart: always
|
||||
ports:
|
||||
- 8080:8080
|
||||
|
@ -1,5 +1,4 @@
|
||||
[
|
||||
"http://apppanel.co.uk/panel/capo/smarters/api//home.php?action=dns",
|
||||
"http://panelhost.xyz/cli3nts/Funky/Smarters/api/home.php?action=dns"
|
||||
|
||||
"http://webservgroup.xyz/smarters4567891/api/home.php?action=dns",
|
||||
"https://webservgroup.xyz/lippy/api/home.php?action=dns"
|
||||
]
|
@ -1,5 +0,0 @@
|
||||
[
|
||||
"http://webservgroup.xyz/smarters4567891/api/home.php?action=dns",
|
||||
"http://panelhost.xyz/cli3nts/Funky/Smarters/api/home.php?action=dns",
|
||||
"http://panelhost.xyz/cli3nts/smartersv3/funky/api/home.php?action=dns"
|
||||
]
|
@ -1,29 +1,19 @@
|
||||
const Cryptr = require('cryptr');
|
||||
const cryptr = new Cryptr('BBLBTV-DNS-PASSWORDS');
|
||||
|
||||
|
||||
const sql = require('./mysql')
|
||||
|
||||
function storeAccountToDB(accountDetails) {
|
||||
const encryptedPassword = cryptr.encrypt(accountDetails.password);
|
||||
const result = sql.query(`INSERT userAccounts (username, password, stream, userID, expiaryDate, streamURL, maxConnections) VALUES ("${accountDetails.username}", "${encryptedPassword}", "${accountDetails.streamName}", ${accountDetails.userId}, ${accountDetails.expiryDate}, "${accountDetails.streamURL}", ${accountDetails.maxConnections})`);
|
||||
const result = sql.query(`INSERT userAccounts (username, password, stream, userID) VALUES ("${accountDetails.username}", "${encryptedPassword}", "${accountDetails.stream}", ${accountDetails.userId})`);
|
||||
return result
|
||||
}
|
||||
|
||||
function removeAccountFromDB(accountDetails) {
|
||||
const result = sql.query(`DELETE FROM userAccounts WHERE
|
||||
username = '${accountDetails.user}' AND
|
||||
stream = '${accountDetails.stream}' AND
|
||||
userId = ${accountDetails.userId} `);
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
function retrievePasswordFromDB(user, userAccUser) {
|
||||
let userId
|
||||
try {
|
||||
userId = sql.query(`SELECT u.id FROM users u WHERE u.userName = '${user}'`);
|
||||
userId = userId[0].id
|
||||
userId = sql.query(`SELECT u.idusers FROM users u WHERE u.userName = '${user}'`);
|
||||
userId = userId[0].idusers
|
||||
} catch (error) {
|
||||
console.log('User not found')
|
||||
return (error)
|
||||
@ -45,24 +35,12 @@ WHERE userAccounts.userID = ${userId} AND userAccounts.username = '${userAccUser
|
||||
} else {
|
||||
const decryptedString = cryptr.decrypt(accountPassword[0].password);
|
||||
console.log(decryptedString)
|
||||
return decryptedString
|
||||
}
|
||||
}
|
||||
|
||||
// accountDetails = {
|
||||
// "username": "Darren110921",
|
||||
// "password" :"saD2V2kjyNqH",
|
||||
// "stream": "Badger",
|
||||
// "userId" : "2"
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// retrievePasswordFromDB('Karl', 'Maxine2206')
|
||||
// storeAccountToDB(accountDetails)
|
||||
retrievePasswordFromDB('Karl', 'Karl2903')
|
||||
|
||||
module.exports = {
|
||||
removeAccountFromDB,
|
||||
storeAccountToDB,
|
||||
retrievePasswordFromDB
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
const { configs } = require('apache-api');
|
||||
|
||||
const { getStreamsNew } = require('../routes/getStreams')
|
||||
const { getURLandStreams } = require('./getStreamNames')
|
||||
const { allUserCheck } = require('./checker')
|
||||
|
||||
apache_config = 'tv.k-world'
|
||||
|
||||
const { exec } = require("child_process");
|
||||
|
||||
function restart() {
|
||||
exec("sudo service apache2 reload", (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
console.log(`error: ${error.message}`);
|
||||
return;
|
||||
}
|
||||
if (stderr) {
|
||||
console.log(`stderr: ${stderr}`);
|
||||
return;
|
||||
}
|
||||
console.log(`no issues`);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function makeid() {
|
||||
var result = '';
|
||||
var characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||
var charactersLength = characters.length;
|
||||
for (var i = 0; i < 5; i++) {
|
||||
result += characters.charAt(Math.floor(Math.random() *
|
||||
charactersLength));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
async function get_config() {
|
||||
return await configs.readConfig(apache_config, true, true)
|
||||
}
|
||||
|
||||
async function split_streams(siteList) {
|
||||
const notUndefined = anyValue => typeof anyValue !== 'undefined'
|
||||
|
||||
final_array = siteList.map(function (item) {
|
||||
if (item.content.includes('Redirect')) {
|
||||
var cleanString = item.content.replace(/^(.*?)\//g, "");
|
||||
cleanString = cleanString.split(' ')
|
||||
cleanString[1] = cleanString[1].replace(/"/g, "")
|
||||
return cleanString
|
||||
}
|
||||
}).filter(notUndefined)
|
||||
return final_array
|
||||
}
|
||||
|
||||
async function updateStream(updatedStreams) {
|
||||
config = await get_config()
|
||||
updatedStreams.forEach(async stream => {
|
||||
config.children[0].children.map(async function (item) {
|
||||
if (item.content.includes(stream[1])) {
|
||||
return item.content = `Redirect 302 /${stream[0]} "${stream[2]}"`
|
||||
}
|
||||
})
|
||||
try {
|
||||
await configs.saveConfig(apache_config, config, true, true)
|
||||
console.log(stream[0] + ' url updated')
|
||||
} catch (error) {
|
||||
console.log(stream[0] + ' url failed to update')
|
||||
console.log(error)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function updateStreamCheck(streamsFromKtvDB, streamsFromConfig) {
|
||||
updatedStreams = []
|
||||
streamsFromConfig.forEach(sfc => {
|
||||
streamsFromKtvDB.forEach(sfktv => {
|
||||
if (sfc[0] == sfktv.stream) {
|
||||
sfc[0]
|
||||
sfktv.stream
|
||||
if (sfc[1] != sfktv.streamURL) {
|
||||
console.log(sfc[0] + ' url changed')
|
||||
updatedStreams.push([sfc[0], sfc[1], sfktv.streamURL])
|
||||
} else {
|
||||
// console.log(sfc[0] + ' not updated')
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
return updatedStreams
|
||||
}
|
||||
|
||||
|
||||
async function checkExists(fullStreamList, mappedStreams) {
|
||||
newstreams = mappedStreams.map(function (s) {
|
||||
return s[1]
|
||||
})
|
||||
myArray = fullStreamList.filter(function (el) {
|
||||
return newstreams.indexOf(el) < 0;
|
||||
});
|
||||
if (myArray.length == 0) {
|
||||
console.log('No new streams')
|
||||
} else {
|
||||
console.log('New streams ' + myArray)
|
||||
}
|
||||
return myArray
|
||||
}
|
||||
|
||||
|
||||
async function addNewStreams(config, streamList) {
|
||||
streamList.forEach(stream => {
|
||||
config.children[0].children.push({ "tagName": '$rule', "content": `Redirect 302 /${makeid()} "${stream}"` })
|
||||
})
|
||||
try {
|
||||
await configs.saveConfig(apache_config, config, true, true)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
|
||||
async function syncApache() {
|
||||
// console.log('Updating all user account from ktv')
|
||||
// await allUserCheck()
|
||||
// console.log('Update complete')
|
||||
console.log('Comparing streams from ktv and apache')
|
||||
streams = await getStreamsNew()
|
||||
config = await get_config()
|
||||
streamsFromConfig = await split_streams(config.children[0].children)
|
||||
|
||||
streamsFromKtvDB = await getURLandStreams()
|
||||
updatedStreams = await updateStreamCheck(streamsFromKtvDB, streamsFromConfig)
|
||||
await updateStream(updatedStreams)
|
||||
console.log('Complete')
|
||||
console.log('Adding any missing streams to apache')
|
||||
streams = await getStreamsNew()
|
||||
config = await get_config()
|
||||
streamsFromConfig = await split_streams(config.children[0].children)
|
||||
missingStreamsInApache = await checkExists(streams, streamsFromConfig)
|
||||
resultOfAddStreams = await addNewStreams(config, missingStreamsInApache)
|
||||
console.log('Complete')
|
||||
console.log('Restarting Apache')
|
||||
await restart()
|
||||
console.log('Complete')
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
syncApache
|
||||
}
|
||||
|
263
lib/checker.js
263
lib/checker.js
@ -1,236 +1,65 @@
|
||||
const { getStreamsNew } = require('../routes/getStreams')
|
||||
const { updateStreamData, updateOtherURLs } = require('./updateStreams')
|
||||
const { decryptPassword } = require('./password')
|
||||
const { getUserAccountsCheck, getAllUniqueAccounts, getAllUserAccounts, getUserUniqueAccounts } = require('./getUser')
|
||||
const { storeAccountToDB } = require('../lib/Accounts')
|
||||
const { syncApache } = require('./apache_functions')
|
||||
|
||||
let streamArrays = require('./streamArray.json')
|
||||
|
||||
const axios = require('axios')
|
||||
const tor_axios = require('tor-axios');
|
||||
const tor = tor_axios.torSetup({
|
||||
ip: process.env.TORSSRV,
|
||||
port: 9050,
|
||||
controlPort: 9051,
|
||||
controlPassword: process.env.TORSPWD,
|
||||
})
|
||||
let users = require('./logins.json')
|
||||
|
||||
axios.defaults.timeout = 3000;
|
||||
tor.defaults.timeout = 3000
|
||||
const { gotRequest } = require('./gotRequest')
|
||||
|
||||
const inst = axios.create({
|
||||
httpAgent: tor.httpAgent(),
|
||||
httpsagent: tor.httpsAgent(),
|
||||
});
|
||||
const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
|
||||
let axiosOptions = {
|
||||
headers: {
|
||||
'User-Agent': 'IPTV Smarters Pro'
|
||||
async function singleCheck(username) {
|
||||
let user = users.find(user => user.username === username)
|
||||
for (let index = 0; index < streamArrays.length; index++) {
|
||||
await delay(500);
|
||||
const stream = streamArrays[index];
|
||||
process.stdout.write('.')
|
||||
let url = stream.StreamURL + "/player_api.php?username=" + user.username + "&password=" + user.password
|
||||
let t = await gotRequest(url)
|
||||
let body = t.body
|
||||
if (t.statusCode == 200 && body !== "") {
|
||||
body = JSON.parse(body)
|
||||
if (body.user_info.auth) {
|
||||
var date = new Date(body.user_info.exp_date * 1000)
|
||||
process.stdout.write('\n')
|
||||
console.log('Match - ' + user.username + ' - ' + stream.StreamURL + ' - ' + stream.StreamName + ' - Expires - ' + date)
|
||||
stream.username = user.username
|
||||
stream.expiaryDate = date.toLocaleDateString('en-GB')
|
||||
return (stream)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// const delay = ms => new Promise(res => setTimeout(res, ms));
|
||||
|
||||
|
||||
async function buildURL(streamURL, username, password) {
|
||||
let url = streamURL + "/player_api.php?username=" + username + "&password=" + password
|
||||
return url
|
||||
}
|
||||
process.stdout.write('\nEnd Of Streams\n\n')
|
||||
}
|
||||
|
||||
async function splitURL(url) {
|
||||
try {
|
||||
let extractedURL = url.match(/[^/]*\/\/[^/]*/)[0]
|
||||
let extractedUserPass = url.match(/\/player_api\.php\?username=([\s\S]*)$/)[1]
|
||||
let UserPass = extractedUserPass.split('&password=')
|
||||
return {
|
||||
"extractedUrl": extractedURL,
|
||||
"username": UserPass[0],
|
||||
"password": UserPass[1]
|
||||
}
|
||||
} catch {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
async function updateAccounts(userAccounts, data, url) {
|
||||
let urlData = await splitURL(url)
|
||||
|
||||
let account = userAccounts.filter(account => account.username == urlData.username && account.passwordDecryped == urlData.password)[0]
|
||||
|
||||
await updateStreamData({
|
||||
"username": account.username,
|
||||
"password": account.password,
|
||||
"userId": account.userId
|
||||
}, urlData.extractedUrl, data.user_info.exp_date)
|
||||
console.log(`${urlData.extractedUrl}.`)
|
||||
|
||||
await updateOtherURLs(account.stream, urlData.extractedUrl)
|
||||
}
|
||||
|
||||
|
||||
async function addNewAccount(userAccount, data, url) {
|
||||
try {
|
||||
let URL = await splitURL(url)
|
||||
|
||||
await storeAccountToDB({
|
||||
"username": userAccount.username,
|
||||
"password": userAccount.password,
|
||||
"userId": userAccount.userId,
|
||||
"streamName": userAccount.stream,
|
||||
"streamURL": URL.extractedUrl,
|
||||
"expiryDate": data.user_info.exp_date,
|
||||
"maxConnections": data.user_info.max_connections
|
||||
}, URL.extractedUrl, data.user_info.exp_date)
|
||||
var date = new Date(data.user_info.exp_date * 1000).toLocaleDateString(undefined, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })
|
||||
console.log(`${userAccount.username} - ${URL.extractedUrl} - Expires ${date}.`)
|
||||
} catch (error) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function urlChecker(userAccounts) {
|
||||
let ip = await inst.get('http://api.ipify.org')
|
||||
console.log(ip.data);
|
||||
|
||||
let updateCount = 0
|
||||
|
||||
for (let index = 0; index < userAccounts.length; index++) {
|
||||
const userAccount = userAccounts[index];
|
||||
let count = index + 1
|
||||
console.log(count + ' of ' + userAccounts.length + ' ' + userAccount.username)
|
||||
for (let index2 = 0; index2 < userAccount.urls.length; index2++) {
|
||||
const url = userAccount.urls[index2];
|
||||
// console.log('url ' + index2 + 1 + ' of ' + userAccount.urls.length)
|
||||
// console.log('.')
|
||||
try {
|
||||
let response = await inst.get(url, axiosOptions)
|
||||
if (response.data.user_info.auth) {
|
||||
await updateAccounts(userAccounts, response.data, url)
|
||||
updateCount++
|
||||
async function main() {
|
||||
for (let index = 0; index < users.length; index++) {
|
||||
const user = users[index];
|
||||
console.log('Trying ' + user.username)
|
||||
for (let index = 0; index < streamArrays.length; index++) {
|
||||
await delay(500);
|
||||
const stream = streamArrays[index];
|
||||
process.stdout.write('.')
|
||||
let url = stream.StreamURL + "/player_api.php?username=" + user.username + "&password=" + user.password
|
||||
let t = await gotRequest(url)
|
||||
let body = t.body
|
||||
if (t.statusCode == 200 && body !== "") {
|
||||
body = JSON.parse(body)
|
||||
if (body.user_info.auth) {
|
||||
// var date = new Date(body.user_info.exp_date * 1000).toLocaleDateString('en-GB')
|
||||
process.stdout.write('\n')
|
||||
console.log('Match - ' + user.username + ' - ' + stream.StreamURL + ' - ' + stream.StreamName + ' - Expires - ' + body.user_info.exp_date)
|
||||
break
|
||||
}
|
||||
} catch (error) {
|
||||
try {
|
||||
if (error.response.status == 403) {
|
||||
let response2 = await axios.get(url, axiosOptions)
|
||||
if (response2.data.user_info.auth) {
|
||||
try {
|
||||
await updateAccounts(userAccounts, response2.data, url)
|
||||
updateCount++
|
||||
break
|
||||
} catch (error) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
process.stdout.write('\nEnd Of Streams\n\n')
|
||||
}
|
||||
} catch (error) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
syncApache()
|
||||
return {
|
||||
"updatedCount": updateCount,
|
||||
"totalAccounts": userAccounts.length
|
||||
}
|
||||
console.log('Finished')
|
||||
}
|
||||
|
||||
async function userCheck(accountData) {
|
||||
let start = Date.now()
|
||||
console.log(start)
|
||||
streamURLS = await getStreamsNew()
|
||||
let userAccounts = await getUserUniqueAccounts(accountData.userId)
|
||||
|
||||
userAccounts = userAccounts.map(user => {
|
||||
user.userId = accountData.userId
|
||||
user.passwordDecryped = decryptPassword(user.password)
|
||||
return user
|
||||
})
|
||||
urlList = []
|
||||
|
||||
for (let index = 0; index < userAccounts.length; index++) {
|
||||
let userAccount = userAccounts[index];
|
||||
userAccount.urls = []
|
||||
for (let index = 0; index < streamURLS.length; index++) {
|
||||
const streamURL = streamURLS[index];
|
||||
userAccount.urls.push(await buildURL(streamURL, userAccount.username, userAccount.passwordDecryped))
|
||||
urlList.push(await buildURL(streamURL, userAccount.username, userAccount.passwordDecryped))
|
||||
}
|
||||
userAccount.urls = userAccount.urls.filter(function (e) { return !e.includes('stormtv') && !e.includes('megaott') })
|
||||
}
|
||||
|
||||
values = await urlChecker(userAccounts)
|
||||
if (values.updatedCount > 0) {
|
||||
return {
|
||||
"update": true,
|
||||
"count": values.updatedCount
|
||||
}
|
||||
}
|
||||
else {
|
||||
return endresponse = false
|
||||
}
|
||||
}
|
||||
|
||||
async function accountChecker(accountData, urlList) {
|
||||
let ip = await inst.get('http://api.ipify.org')
|
||||
console.log(ip.data);
|
||||
|
||||
for (let index = 0; index < urlList.length; index++) {
|
||||
const url = urlList[index];
|
||||
console.log(index + 1 + ' of ' + urlList.length + ' urls checked')
|
||||
try {
|
||||
let response = await inst.get(url, axiosOptions)
|
||||
if (response.data.user_info.auth) {
|
||||
addNewAccount(accountData, data, url)
|
||||
console.log('New Account Added')
|
||||
syncApache()
|
||||
return true
|
||||
}
|
||||
} catch (error) {
|
||||
try {
|
||||
if (error.response.status == 403) {
|
||||
let response2 = await axios.get(url, axiosOptions)
|
||||
if (response2.data.user_info.auth) {
|
||||
try {
|
||||
await addNewAccount(accountData, response2.data, url)
|
||||
console.log('New Account Added')
|
||||
syncApache()
|
||||
return true
|
||||
} catch (error) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
async function singleAccountCheck(accountData) {
|
||||
streamURLS = await getStreamsNew()
|
||||
|
||||
urlList = []
|
||||
|
||||
for (let index = 0; index < streamURLS.length; index++) {
|
||||
const streamURL = streamURLS[index];
|
||||
urlList.push(await buildURL(streamURL, accountData.username, accountData.password))
|
||||
}
|
||||
urlList
|
||||
return await accountChecker(accountData, urlList)
|
||||
}
|
||||
|
||||
|
||||
|
||||
main()
|
||||
|
||||
module.exports = {
|
||||
userCheck,
|
||||
singleAccountCheck,
|
||||
singleCheck,
|
||||
main
|
||||
}
|
||||
|
||||
// singleAccountCheck({ "username": "Karl0ss01", "password": "YqQjYH9Nzw", "userId": 1, "stream": "Badger" })
|
@ -1,28 +0,0 @@
|
||||
const sql = require('./mysql')
|
||||
|
||||
function getStreamNames() {
|
||||
let data = sql.query(`SELECT id, streamName FROM BBLB_DNS.streams`)
|
||||
// console.log(data)
|
||||
if (data.length == 0) {
|
||||
return 'StreamsFailed'
|
||||
} else {
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getURLandStreams() {
|
||||
let data = sql.query(`SELECT DISTINCT stream, streamURL FROM BBLB_DNS.userAccounts`)
|
||||
// console.log(data)
|
||||
if (data.length == 0) {
|
||||
return 'StreamsFailed'
|
||||
} else {
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getStreamNames,
|
||||
getURLandStreams
|
||||
}
|
||||
|
@ -3,14 +3,14 @@ const sql = require('./mysql')
|
||||
function getUserAccounts(user) {
|
||||
let data = sql.query(`SELECT
|
||||
userAccounts.username,
|
||||
userAccounts.stream,
|
||||
userAccounts.streamURL,
|
||||
userAccounts.expiaryDate,
|
||||
userAccounts.password
|
||||
streams.streamName,
|
||||
streams.streamURL
|
||||
FROM users
|
||||
INNER JOIN userAccounts
|
||||
ON users.id = userAccounts.userID
|
||||
WHERE users.id = '${user}'`)
|
||||
ON users.idusers = userAccounts.userID
|
||||
INNER JOIN streams
|
||||
ON userAccounts.stream = streams.streamName
|
||||
WHERE users.username = '${user}'`)
|
||||
// console.log(data)
|
||||
if (data.length == 0) {
|
||||
return 'User Not Found'
|
||||
@ -19,84 +19,7 @@ function getUserAccounts(user) {
|
||||
}
|
||||
}
|
||||
|
||||
function getUserAccountsCheck(user) {
|
||||
let data = sql.query(`SELECT
|
||||
userAccounts.username,
|
||||
userAccounts.stream,
|
||||
userAccounts.streamURL,
|
||||
userAccounts.expiaryDate,
|
||||
userAccounts.password
|
||||
FROM users
|
||||
INNER JOIN userAccounts
|
||||
ON users.id = userAccounts.userID
|
||||
WHERE users.id = '${user}'`)
|
||||
// console.log(data)
|
||||
if (data.length == 0) {
|
||||
return 'User Not Found'
|
||||
} else {
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
function getAllUserAccounts() {
|
||||
let data = sql.query(`SELECT
|
||||
userAccounts.username,
|
||||
userAccounts.password,
|
||||
userAccounts.expiaryDate,
|
||||
userAccounts.stream
|
||||
FROM userAccounts
|
||||
WHERE userAccounts.expiaryDate != '0'
|
||||
ORDER BY userAccounts.id DESC
|
||||
`)
|
||||
// console.log(data)
|
||||
if (data.length == 0) {
|
||||
return 'User Not Found'
|
||||
} else {
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
function getAllUniqueAccounts() {
|
||||
let data = sql.query(`SELECT DISTINCT(userAccounts.stream), userAccounts.username, userAccounts.password, userAccounts.stream FROM userAccounts
|
||||
WHERE userAccounts.expiaryDate != '0'
|
||||
GROUP BY userAccounts.stream;`)
|
||||
if (data.length == 0) {
|
||||
return 'User Not Found'
|
||||
} else {
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
function getUserUniqueAccounts(userid) {
|
||||
let data = sql.query(`SELECT DISTINCT(userAccounts.streamURL), userAccounts.username, userAccounts.password, userAccounts.stream , userAccounts.streamURL FROM userAccounts
|
||||
WHERE userAccounts.expiaryDate != '0' AND
|
||||
userAccounts.userId = ${userid}
|
||||
GROUP BY userAccounts.stream
|
||||
ORDER BY userAccounts.stream ASC;`)
|
||||
if (data.length == 0) {
|
||||
return 'User Not Found'
|
||||
} else {
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
||||
function getUserId(user) {
|
||||
let data = sql.query(`SELECT id FROM users WHERE userName = '${user}'`)
|
||||
// console.log(data)
|
||||
if (data.length == 0) {
|
||||
return 'User Not Found'
|
||||
} else {
|
||||
return data[0].id
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
getUserAccounts,
|
||||
getAllUserAccounts,
|
||||
getUserId,
|
||||
getUserAccountsCheck,
|
||||
getUserUniqueAccounts,
|
||||
getAllUniqueAccounts
|
||||
getUserAccounts
|
||||
}
|
||||
|
||||
|
@ -1,38 +0,0 @@
|
||||
const sql = require('./mysql')
|
||||
|
||||
function getUsers() {
|
||||
let data = sql.query(`SELECT
|
||||
|
||||
userName,
|
||||
password
|
||||
FROM users
|
||||
`)
|
||||
// console.log(data)
|
||||
if (data.length == 0) {
|
||||
return 'User Not Found'
|
||||
} else {
|
||||
var object = data.reduce(
|
||||
(obj, item) => Object.assign(obj, { [item.userName]: item.password }), {});
|
||||
|
||||
return object
|
||||
}
|
||||
}
|
||||
|
||||
function getUserName(userId) {
|
||||
let data = sql.query(`SELECT
|
||||
userName
|
||||
FROM users
|
||||
WHERE id = ${userId}
|
||||
`)
|
||||
// console.log(data)
|
||||
if (data.length == 0) {
|
||||
return 'User Not Found'
|
||||
} else {
|
||||
return data[0].userName
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getUsers, getUserName
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ const got = require('got')
|
||||
|
||||
const gotRequest = async (url) => {
|
||||
let returnResponse = {};
|
||||
let options = {
|
||||
timeout: 2000
|
||||
}
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let options = {}
|
||||
await got(url, options)
|
||||
.then((response) => {
|
||||
returnResponse = response;
|
||||
@ -18,8 +15,7 @@ const gotRequest = async (url) => {
|
||||
}
|
||||
});
|
||||
|
||||
resolve(returnResponse);
|
||||
})
|
||||
return returnResponse;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
58
lib/logins.json
Normal file
58
lib/logins.json
Normal file
@ -0,0 +1,58 @@
|
||||
[
|
||||
{
|
||||
"username": "Karl2903",
|
||||
"password": "kcshkzex"
|
||||
},
|
||||
{
|
||||
"username": "Karl2404",
|
||||
"password": "pkrcbobqau"
|
||||
},
|
||||
{
|
||||
"username": "Karl2804",
|
||||
"password": "ckazebawsk"
|
||||
},
|
||||
{
|
||||
"username": "Karl2904",
|
||||
"password": "peyofdjtau"
|
||||
},
|
||||
{
|
||||
"username": "Karl150520",
|
||||
"password": "snqqfndtpn"
|
||||
},
|
||||
{
|
||||
"username": "Karl1505",
|
||||
"password": "upfjwtouwc"
|
||||
},
|
||||
{
|
||||
"username": "Karl2802",
|
||||
"password": "hgChnj8Fks"
|
||||
},
|
||||
{
|
||||
"username": "Karl0704",
|
||||
"password": "CJXENz4vxy"
|
||||
},
|
||||
{
|
||||
"username": "Karl24",
|
||||
"password": "3vpfS48hHF"
|
||||
},
|
||||
{
|
||||
"username": "Karl2206",
|
||||
"password": "913TpVzp3F"
|
||||
},
|
||||
{
|
||||
"username": "Darren1706",
|
||||
"password": "IqEoN5RjN5"
|
||||
},
|
||||
{
|
||||
"username": "Dazg3012",
|
||||
"password": "tXrD5tUvZB"
|
||||
},
|
||||
{
|
||||
"username": "Martin1607",
|
||||
"password": "7Fw698gY7b"
|
||||
},
|
||||
{
|
||||
"username": "Martin2204",
|
||||
"password": "jpruheknsf"
|
||||
}
|
||||
]
|
10
lib/mysql.js
10
lib/mysql.js
@ -1,11 +1,11 @@
|
||||
var mysql = require('sync-mysql');
|
||||
|
||||
var connection = new mysql({
|
||||
host: process.env.DBHOST,
|
||||
port: process.env.DBPORT,
|
||||
user: process.env.DBUSER,
|
||||
password: process.env.DBPASS,
|
||||
database: process.env.DATABASE,
|
||||
host: 'localhost',
|
||||
port: 3306,
|
||||
user: 'root',
|
||||
password: 'example',
|
||||
database: 'BBLB_DNS',
|
||||
insecureAuth: true
|
||||
})
|
||||
|
||||
|
4
lib/otherDNS.json
Normal file
4
lib/otherDNS.json
Normal file
@ -0,0 +1,4 @@
|
||||
[
|
||||
"https://trippy.pro:443",
|
||||
"https://itty.in:443"
|
||||
]
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"using": [
|
||||
|
||||
|
||||
],
|
||||
"notUsing": [
|
||||
"https://blackpud475.xyz",
|
||||
"https://trippy.pro:443",
|
||||
"https://itty.in:443",
|
||||
"http://sting.ltd:25461",
|
||||
"http://37723998.to:2052",
|
||||
"https://tictacs.win"
|
||||
]
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
const Cryptr = require('cryptr');
|
||||
const cryptr = new Cryptr('BBLBTV-DNS-PASSWORDS');
|
||||
|
||||
function decryptPassword(password) {
|
||||
const decryptedString = cryptr.decrypt(password);
|
||||
// console.log(decryptedString)
|
||||
return decryptedString
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
decryptPassword
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
const sql = require('./mysql')
|
||||
|
||||
function setExpired(userAccount) {
|
||||
console.log(userAccount.username + ' ' + userAccount.stream + ' Expired on ' + userAccount.expiaryDate.toLocaleDateString(undefined, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }))
|
||||
let result
|
||||
try {
|
||||
result = sql.query(`UPDATE userAccounts SET expiaryDate = "0" WHERE username = "${userAccount.username}" AND password = "${userAccount.password}"; `);
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
setExpired
|
||||
}
|
||||
|
1
lib/streamArray.json
Normal file
1
lib/streamArray.json
Normal file
@ -0,0 +1 @@
|
||||
[{"StreamName":"Insanity","StreamURL":"https://trippy.pro:443"},{"StreamName":"PremPlus","StreamURL":"https://itty.in:443"},{"StreamName":"GunSlinger","StreamURL":"http://gunslingertv.org:8080"},{"StreamName":"VIP","StreamURL":"http://oven-cleaner.com:8080/"},{"StreamName":"Technoid","StreamURL":"http://capoisagod2021.org:8080"},{"StreamName":"Old Premium","StreamURL":"https://caporeds.online:443","username":"Dazg3012","expiaryDate":"12/30/2021"},{"StreamName":"??","StreamURL":"http://screamstreams.info:8080"},{"StreamName":"Gold","StreamURL":"http://catenamode.cf:8090"},{"StreamName":"??","StreamURL":"http://sulu.xyz:2086"},{"StreamName":"??","StreamURL":"http://bigbox.me.uk:2086"},{"StreamName":"??","StreamURL":"http://beautifilm.xyz:8080"},{"StreamName":"??","StreamURL":"https://hulks.xyz:443"},{"StreamName":"??","StreamURL":"http://mytv.digital:8080/"},{"StreamName":"??","StreamURL":"http://theonlinemedia.network:2052"},{"StreamName":"Gold","StreamURL":"http://server1.jforbes.club:8090"},{"StreamName":"??","StreamURL":"http://ths.viewdns.net:8080"},{"StreamName":"??","StreamURL":"http://vpsuk.store:8080"},{"StreamName":"??","StreamURL":"http://ac.mustardsubs.tk:8880"},{"StreamName":"??","StreamURL":"http://faithhosting.xyz:25461"},{"StreamName":"??","StreamURL":"http://ip365.cx:80"},{"StreamName":"??","StreamURL":"https://trippy.pro:443"},{"StreamName":"??","StreamURL":"http://g132.caporeds.online:8080/"},{"StreamName":"??","StreamURL":"http://theonlinemedia.network:2052"},{"StreamName":"??","StreamURL":"http://beautifilm.xyz:8080"},{"StreamName":"??","StreamURL":"http://pimptv.dnsabr.com:8080"},{"StreamName":"??","StreamURL":"http://tavaratv.xyz:2095"},{"StreamName":"??","StreamURL":"http://cms-tan.media:8880"},{"StreamName":"??","StreamURL":"http://streamknighttv.xyz:8080"},{"StreamName":"??","StreamURL":"http://covidsucks.xyz:8080"},{"StreamName":"Gambler","StreamURL":"http://fckbrexit.link:8080"},{"StreamName":"??","StreamURL":"http://tv.realot.xyz:35001"},{"StreamName":"??","StreamURL":"http://www.tvxclnt.com:8080"},{"StreamName":"??","StreamURL":"http://iptv.satplex.co.uk:8080"}]
|
@ -1,30 +0,0 @@
|
||||
const sql = require('./mysql')
|
||||
|
||||
async function updateStreamData(userAccount, streamURL, expiaryDate) {
|
||||
// let result
|
||||
try {
|
||||
let result = sql.query(`UPDATE userAccounts SET streamURL = "${streamURL}", expiaryDate = ${expiaryDate} WHERE username = "${userAccount.username}" AND password = "${userAccount.password}"; `);
|
||||
return result
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
|
||||
async function updateOtherURLs(streamName, newUrl) {
|
||||
// let result
|
||||
try {
|
||||
let result = sql.query(`update userAccounts
|
||||
set userAccounts.streamURL = '${newUrl}'
|
||||
WHERE userAccounts.stream ='${streamName}'`);
|
||||
return result
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
updateStreamData,
|
||||
updateOtherURLs
|
||||
}
|
||||
|
1307
package-lock.json
generated
1307
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
21
package.json
21
package.json
@ -6,23 +6,20 @@
|
||||
"start": "node ./bin/www"
|
||||
},
|
||||
"dependencies": {
|
||||
"apache-api": "^1.2.5",
|
||||
"axios": "^0.21.4",
|
||||
"axios-cookiejar-support": "^2.0.0",
|
||||
"axios": "^0.21.1",
|
||||
"bcrypt": "^5.0.0",
|
||||
"cookie-parser": "~1.4.4",
|
||||
"cryptr": "^6.0.2",
|
||||
"deepdash": "^5.3.9",
|
||||
"dotenv": "^10.0.0",
|
||||
"debug": "~2.6.9",
|
||||
"express": "~4.16.1",
|
||||
"express-basic-auth": "^1.2.0",
|
||||
"fs": "0.0.1-security",
|
||||
"got": "^11.8.1",
|
||||
"http-errors": "~1.6.3",
|
||||
"lodash": "^4.17.21",
|
||||
"obj-traverse": "^1.0.0",
|
||||
"request": "^2.88.2",
|
||||
"sync-mysql": "^3.0.1",
|
||||
"tor-axios": "^1.0.9",
|
||||
"tough-cookie": "^4.0.0",
|
||||
"yourls": "git+https://github.com/karl0ss/node-yourls.git"
|
||||
"jade": "~1.11.0",
|
||||
"morgan": "~1.9.1",
|
||||
"mysql": "^2.18.1",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"sync-mysql": "^3.0.1"
|
||||
}
|
||||
}
|
||||
|
8
public/stylesheets/style.css
Normal file
8
public/stylesheets/style.css
Normal file
@ -0,0 +1,8 @@
|
||||
body {
|
||||
padding: 50px;
|
||||
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #00B7FF;
|
||||
}
|
@ -1,28 +1,19 @@
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
const { getUserId } = require('../lib/getUser')
|
||||
const { singleAccountCheck } = require('../lib/checker')
|
||||
|
||||
const { storeAccountToDB } = require('../lib/addAccounts')
|
||||
|
||||
|
||||
/* POST postUser page. */
|
||||
router.post('/', async function (req, res, next) {
|
||||
let postData = req.body
|
||||
for (var key in postData) {
|
||||
postData[key] = postData[key].trim();
|
||||
}
|
||||
if (postData.username.includes('KarlOss')) {
|
||||
postData.username = postData.username.replace("O", "0")
|
||||
}
|
||||
postData.userId = getUserId(req.auth.user)
|
||||
a = await singleAccountCheck(postData)
|
||||
if (a) {
|
||||
res.send('Account ' + postData.username + ' Added successfully to ' + req.auth.user)
|
||||
let result = await storeAccountToDB(postData)
|
||||
console.log(result)
|
||||
if (result.affectedRows < 1) {
|
||||
res.send('Adding account failed')
|
||||
} else {
|
||||
res.sendStatus(500);
|
||||
res.send('Account ' + postData.username + ' Added successfully')
|
||||
}
|
||||
// }
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
@ -1,22 +0,0 @@
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
const { removeAccountFromDB } = require('../lib/Accounts')
|
||||
const { getUserId } = require('../lib/getUser')
|
||||
|
||||
|
||||
/* POST postUser page. */
|
||||
router.post('/', async function (req, res, next) {
|
||||
let postData = req.body
|
||||
postData.userId = getUserId(req.auth.user)
|
||||
let userName = req.auth.user
|
||||
let result = await removeAccountFromDB(postData)
|
||||
console.log(result)
|
||||
if (result.affectedRows < 1) {
|
||||
res.sendStatus(500)
|
||||
} else {
|
||||
res.send('Account ' + postData.username + ' Deleted from ' + userName)
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
@ -1,16 +0,0 @@
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
const { getStreamNames } = require('../lib/getStreamNames')
|
||||
|
||||
/* POST postUser page. */
|
||||
router.get('/', async function (req, res, next) {
|
||||
if (req.cookies.user === undefined) {
|
||||
res.send('Cookie Not Set')
|
||||
} else {
|
||||
let data = await getStreamNames()
|
||||
res.send(data)
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
@ -3,40 +3,49 @@ var router = express.Router();
|
||||
const fs = require('fs');
|
||||
|
||||
let DNSArray = require('../lib/DNSArray.json')
|
||||
const otherURLs = require('../lib/otherURLs.json')
|
||||
let streamArrays = require('../lib/streamArray.json')
|
||||
const otherDNS = require('../lib/otherDNS.json')
|
||||
|
||||
const { gotRequest } = require('../lib/gotRequest')
|
||||
|
||||
function writeFile(streamArrays) {
|
||||
fs.writeFileSync(__dirname + '/../lib/streamArray.json', JSON.stringify(streamArrays), function (err) {
|
||||
if (err) return console.log(err);
|
||||
});
|
||||
}
|
||||
|
||||
function splitToArray(DNS) {
|
||||
DNS = DNS.split(',')
|
||||
return DNS
|
||||
}
|
||||
|
||||
async function getStreamsNew() {
|
||||
function mapToStream(DNSList) {
|
||||
console.log('---Updated URLS---')
|
||||
DNSList.unshift(...otherDNS)
|
||||
for (let index = 0; index < streamArrays.length; index++) {
|
||||
let element = streamArrays[index];
|
||||
element.StreamURL = DNSList[index]
|
||||
console.log(element.StreamName + ' ' + element.StreamURL)
|
||||
}
|
||||
writeFile(streamArrays)
|
||||
console.log('---Updated URLS---')
|
||||
return streamArrays
|
||||
}
|
||||
|
||||
async function main() {
|
||||
let requestData
|
||||
let jointArray = []
|
||||
for (let index = 0; index < DNSArray.length; index++) {
|
||||
const url = DNSArray[index];
|
||||
requestData = await gotRequest(url)
|
||||
let DNSList = requestData.body
|
||||
if (typeof DNSList === 'string' || DNSList instanceof String) {
|
||||
try {
|
||||
DNSList = JSON.parse(DNSList)
|
||||
} catch (error) {
|
||||
jointArray.unshift(...otherURLs.using)
|
||||
jointArray = [...new Set(jointArray)]
|
||||
return jointArray
|
||||
}
|
||||
}
|
||||
let DNSList = JSON.parse(requestData.body)
|
||||
DNSList = splitToArray(DNSList.su)
|
||||
DNSList.forEach(url => {
|
||||
jointArray.push(url)
|
||||
});
|
||||
}
|
||||
jointArray.unshift(...otherURLs.using)
|
||||
jointArray = [...new Set(jointArray)]
|
||||
return jointArray
|
||||
await mapToStream(jointArray)
|
||||
return streamArrays
|
||||
}
|
||||
/* GET users listing. */
|
||||
router.get('/', async function (req, res, next) {
|
||||
@ -44,6 +53,4 @@ router.get('/', async function (req, res, next) {
|
||||
res.send(fullStreamArray)
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
router, getStreamsNew
|
||||
}
|
||||
module.exports = router;
|
@ -1,39 +1,13 @@
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
const { getUserAccounts, getUserId } = require('../lib/getUser')
|
||||
const { getStreamsNew } = require('../routes/getStreams')
|
||||
const { decryptPassword } = require('../lib/password')
|
||||
const { getUserAccounts } = require('../lib/getUser')
|
||||
|
||||
/* POST postUser page. */
|
||||
router.get('/', async function (req, res, next) {
|
||||
let userId = await getUserId(req.auth.user)
|
||||
let data = await getUserAccounts(userId)
|
||||
for (let index = 0; index < data.length; index++) {
|
||||
let element = data[index];
|
||||
element.password = await decryptPassword(element.password)
|
||||
}
|
||||
|
||||
let data = await getUserAccounts(req.body.username)
|
||||
res.send(data)
|
||||
});
|
||||
|
||||
router.get('/count', async function (req, res, next) {
|
||||
try {
|
||||
let data = await getUserAccounts(await getUserId(req.auth.user))
|
||||
res.json({ "streamCount": data.length })
|
||||
} catch (error) {
|
||||
res.sendStatus(500)
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/streams', async function (req, res, next) {
|
||||
try {
|
||||
let data = await getStreamsNew()
|
||||
res.json(data)
|
||||
} catch (error) {
|
||||
res.sendStatus(500)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
module.exports = router;
|
||||
|
@ -1,30 +0,0 @@
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
/* GET home page. */
|
||||
router.get('/', function (req, res, next) {
|
||||
const options = {
|
||||
domain: 'vps.k-world.me.uk',
|
||||
httpOnly: false,
|
||||
sameSite: false,
|
||||
signed: false,
|
||||
path: '/'
|
||||
// overwrite: true
|
||||
}
|
||||
try {
|
||||
if (req.auth.user === 'Karl') {
|
||||
res.cookie('user', 1, options)
|
||||
}
|
||||
else if (req.auth.user === 'Darren') {
|
||||
res.cookie('user', 2, options)
|
||||
}
|
||||
else if (req.auth.user === 'Duly') {
|
||||
res.cookie('user', 3, options)
|
||||
}
|
||||
} catch (error) {
|
||||
res.send({ auth: 'Fail' });
|
||||
}
|
||||
res.send({ auth: 'Success' });
|
||||
});
|
||||
|
||||
module.exports = router;
|
@ -1,19 +0,0 @@
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
/* POST postUser page. */
|
||||
router.get('/', async function (req, res, next) {
|
||||
|
||||
console.log('cookie value=! ' + req.cookies.user)
|
||||
if (req.cookies.user === undefined) {
|
||||
res.send('No Cookie Set');
|
||||
} else {
|
||||
res.send(req.cookies);
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/clear', (req, res) => {
|
||||
res.clearCookie('user').end();
|
||||
});
|
||||
|
||||
module.exports = router;
|
@ -1,21 +1,14 @@
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
|
||||
const { getUserId } = require('../lib/getUser')
|
||||
const { userCheck } = require('../lib/checker')
|
||||
|
||||
const { singleCheck } = require('../lib/checker')
|
||||
/* POST postUser page. */
|
||||
router.get('/', async function (req, res, next) {
|
||||
let postData = req.body
|
||||
postData.userId = getUserId(req.auth.user)
|
||||
// postData.userId = 5
|
||||
let response = await userCheck(postData)
|
||||
console.log(Date.now())
|
||||
if (response.update) {
|
||||
res.json({ "updatedAccounts": response.count })
|
||||
} else {
|
||||
res.sendStatus(500);
|
||||
}
|
||||
router.post('/', async function (req, res, next) {
|
||||
let postedUsername = req.body.username
|
||||
|
||||
let data = await singleCheck(postedUsername)
|
||||
|
||||
res.send(data);
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
21
test.js
21
test.js
@ -1,21 +0,0 @@
|
||||
const tor_axios = require('tor-axios');
|
||||
const tor = tor_axios.torSetup({
|
||||
ip: 'localhost',
|
||||
port: 9050,
|
||||
controlPort: '9051',
|
||||
controlPassword: 'KarlMax',
|
||||
})
|
||||
|
||||
async function main() {
|
||||
let response = await tor.get('http://api.ipify.org');
|
||||
let ip = response.data;
|
||||
console.log(await tor.get('http://api.ipify.org'));
|
||||
|
||||
await tor.torNewSession(); //change tor ip
|
||||
|
||||
response = await tor.get('http://api.ipify.org');
|
||||
ip = response.data;
|
||||
console.log(ip);
|
||||
}
|
||||
|
||||
main()
|
6
views/error.jade
Normal file
6
views/error.jade
Normal file
@ -0,0 +1,6 @@
|
||||
extends layout
|
||||
|
||||
block content
|
||||
h1= message
|
||||
h2= error.status
|
||||
pre #{error.stack}
|
5
views/index.jade
Normal file
5
views/index.jade
Normal file
@ -0,0 +1,5 @@
|
||||
extends layout
|
||||
|
||||
block content
|
||||
h1= title
|
||||
p Welcome to #{title}
|
7
views/layout.jade
Normal file
7
views/layout.jade
Normal file
@ -0,0 +1,7 @@
|
||||
doctype html
|
||||
html
|
||||
head
|
||||
title= title
|
||||
link(rel='stylesheet', href='/stylesheets/style.css')
|
||||
body
|
||||
block content
|
Loading…
x
Reference in New Issue
Block a user