latest
This commit is contained in:
parent
74aecb9101
commit
4cbd6dafde
5
app.js
5
app.js
@ -23,7 +23,7 @@ const basicAuth = require('express-basic-auth')
|
|||||||
app.set('views', path.join(__dirname, 'views'));
|
app.set('views', path.join(__dirname, 'views'));
|
||||||
app.set('view engine', 'jade');
|
app.set('view engine', 'jade');
|
||||||
|
|
||||||
app.use(cors())
|
app.use(cors({ origin: true, credentials: true, methods: 'GET,PUT,POST,OPTIONS', allowedHeaders: 'Content-Type,Authorization' }));
|
||||||
app.use(logger('dev'));
|
app.use(logger('dev'));
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
app.use(express.urlencoded({ extended: false }));
|
app.use(express.urlencoded({ extended: false }));
|
||||||
@ -34,8 +34,7 @@ let usersList = getUsers()
|
|||||||
|
|
||||||
const users = {
|
const users = {
|
||||||
users: usersList,
|
users: usersList,
|
||||||
challenge: true,
|
challenge: true
|
||||||
realm: 'foo',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
app.use('/', indexRouter);
|
app.use('/', indexRouter);
|
||||||
|
@ -3,7 +3,7 @@ import axios from "axios";
|
|||||||
async function readCookie() {
|
async function readCookie() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await axios.get("http://vps.k-world.me.uk:3001/readCookie");
|
const res = await axios.get("http://vps.k-world.me.uk:3001/readCookie", { withCredentials: true });
|
||||||
console.log('IM CHECKING AUTH')
|
console.log('IM CHECKING AUTH')
|
||||||
if (res.data === "No Cookie Set") {
|
if (res.data === "No Cookie Set") {
|
||||||
console.log('I CHECKED AUTH')
|
console.log('I CHECKED AUTH')
|
||||||
|
@ -22,7 +22,7 @@ class AddAccount extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fetchOptions() {
|
fetchOptions() {
|
||||||
fetch("http://" + process.env.URL + ":3001/getStreamNames")
|
fetch("http://vps.k-world.me.uk:3001/getStreamNames")
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
return res.json();
|
return res.json();
|
||||||
})
|
})
|
||||||
@ -60,11 +60,11 @@ class AddAccount extends Component {
|
|||||||
console.log({ username, password, stream });
|
console.log({ username, password, stream });
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.post("http://" + process.env.URL + ":3001/addAccount", {
|
.post("http://vps.k-world.me.uk:3001/addAccount", {
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
stream,
|
stream,
|
||||||
})
|
}, { withCredentials: true })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
console.log(res.data);
|
console.log(res.data);
|
||||||
|
@ -6,7 +6,7 @@ import axios from "axios";
|
|||||||
function App() {
|
function App() {
|
||||||
const deleteCookie = async () => {
|
const deleteCookie = async () => {
|
||||||
try {
|
try {
|
||||||
await axios.get("http://" + process.env.URL + ":3001/readCookie/clear");
|
await axios.get("http://vps.k-world.me.uk:3001/readCookie/clear");
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
@ -18,7 +18,7 @@ function App() {
|
|||||||
|
|
||||||
const auth = async () => {
|
const auth = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await axios.get("http://" + process.env.URL + ":3001/login", {
|
const res = await axios.get("http://vps.k-world.me.uk:3001/login", {
|
||||||
auth: { username, password },
|
auth: { username, password },
|
||||||
});
|
});
|
||||||
if (res.data.auth === "Success") {
|
if (res.data.auth === "Success") {
|
||||||
|
@ -17,7 +17,7 @@ class DropDown extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fetchOptions() {
|
fetchOptions() {
|
||||||
fetch("http://" + process.env.URL + ":3001/getStreamNames")
|
fetch("http://vps.k-world.me.uk:3001/getStreamNames")
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
return res.json();
|
return res.json();
|
||||||
})
|
})
|
||||||
|
@ -32,8 +32,8 @@ export default class MatDataTable extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount(prevProps) {
|
componentDidMount(prevProps) {
|
||||||
const url = "http://" + process.env.URL + ":3001/getUserAccounts";
|
const url = "http://vps.k-world.me.uk:3001/getUserAccounts";
|
||||||
axios.get(url).then((results) => {
|
axios.get(url, { withCredentials: true }).then((results) => {
|
||||||
console.log(results);
|
console.log(results);
|
||||||
console.log(results.data);
|
console.log(results.data);
|
||||||
this.setState({ person: results.data });
|
this.setState({ person: results.data });
|
||||||
|
@ -13,11 +13,9 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- DBHOST=vps.k-world.me.uk
|
- DBHOST=vps.k-world.me.uk
|
||||||
- DBUSER=root
|
- DBUSER=root
|
||||||
- DBPASS=example
|
- DBPASS=Grd555269
|
||||||
- DATABASE=BBLB_DNS
|
- DATABASE=BBLB_DNS
|
||||||
- DBPORT=3307
|
- DBPORT=3306
|
||||||
depends_on:
|
|
||||||
- "db"
|
|
||||||
frontend:
|
frontend:
|
||||||
build:
|
build:
|
||||||
context: ./client
|
context: ./client
|
||||||
@ -30,15 +28,3 @@ services:
|
|||||||
- PORT=6969
|
- PORT=6969
|
||||||
links:
|
links:
|
||||||
- "backend"
|
- "backend"
|
||||||
db:
|
|
||||||
image: mariadb
|
|
||||||
restart: always
|
|
||||||
environment:
|
|
||||||
MYSQL_ROOT_PASSWORD: example
|
|
||||||
ports:
|
|
||||||
- 3307:3306
|
|
||||||
adminer:
|
|
||||||
image: adminer
|
|
||||||
restart: always
|
|
||||||
ports:
|
|
||||||
- 8080:8080
|
|
||||||
|
@ -5,7 +5,7 @@ const { getStreamNames } = require('../lib/getStreamNames')
|
|||||||
|
|
||||||
/* POST postUser page. */
|
/* POST postUser page. */
|
||||||
router.get('/', async function (req, res, next) {
|
router.get('/', async function (req, res, next) {
|
||||||
if (req.signedCookies.user === undefined) {
|
if (req.cookies.user === undefined) {
|
||||||
res.send('Cookie Not Set')
|
res.send('Cookie Not Set')
|
||||||
} else {
|
} else {
|
||||||
let data = await getStreamNames()
|
let data = await getStreamNames()
|
||||||
|
@ -5,10 +5,10 @@ const { getUserAccounts } = require('../lib/getUser')
|
|||||||
|
|
||||||
/* POST postUser page. */
|
/* POST postUser page. */
|
||||||
router.get('/', async function (req, res, next) {
|
router.get('/', async function (req, res, next) {
|
||||||
if (req.signedCookies.user === undefined) {
|
if (req.cookies.user === undefined) {
|
||||||
res.send('Cookie Not Set')
|
res.send('Cookie Not Set')
|
||||||
} else {
|
} else {
|
||||||
let data = await getUserAccounts(req.signedCookies.user)
|
let data = await getUserAccounts(req.cookies.user)
|
||||||
res.send(data)
|
res.send(data)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -4,8 +4,12 @@ var router = express.Router();
|
|||||||
/* GET home page. */
|
/* GET home page. */
|
||||||
router.get('/', function (req, res, next) {
|
router.get('/', function (req, res, next) {
|
||||||
const options = {
|
const options = {
|
||||||
httpOnly: true,
|
domain: 'vps.k-world.me.uk',
|
||||||
signed: true,
|
httpOnly: false,
|
||||||
|
sameSite: false,
|
||||||
|
signed: false,
|
||||||
|
path: '/'
|
||||||
|
// overwrite: true
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (req.auth.user === 'Karl') {
|
if (req.auth.user === 'Karl') {
|
||||||
|
@ -3,10 +3,12 @@ var router = express.Router();
|
|||||||
|
|
||||||
/* POST postUser page. */
|
/* POST postUser page. */
|
||||||
router.get('/', async function (req, res, next) {
|
router.get('/', async function (req, res, next) {
|
||||||
if (req.signedCookies.user === undefined) {
|
|
||||||
|
console.log('cookie value=! ' + req.cookies.user)
|
||||||
|
if (req.cookies.user === undefined) {
|
||||||
res.send('No Cookie Set');
|
res.send('No Cookie Set');
|
||||||
} else {
|
} else {
|
||||||
res.send(req.signedCookies);
|
res.send(req.cookies);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user