Merge remote-tracking branch 'origin/online' into apommier
This commit is contained in:
commit
b84c64254d
8
.env
8
.env
@ -13,8 +13,10 @@
|
|||||||
#URL
|
#URL
|
||||||
NGINX_ENVSUBST_TEMPLATE_SUFFIX=".conf"
|
NGINX_ENVSUBST_TEMPLATE_SUFFIX=".conf"
|
||||||
|
|
||||||
BASE_URL=http://localhost
|
# BASE_URL=http://localhost
|
||||||
|
BASE_URL=92.143.191.152
|
||||||
|
REACT_APP_BASE_URL=92.143.191.152
|
||||||
|
REDIRECT_URI=http://92.143.191.152/api/auth/login
|
||||||
#postgres var
|
#postgres var
|
||||||
# POSTGRES_HOST=127.0.0.1
|
# POSTGRES_HOST=127.0.0.1
|
||||||
# DB_TYPE=postgres
|
# DB_TYPE=postgres
|
||||||
@ -39,6 +41,6 @@ REACT_HOST=0.0.0.0
|
|||||||
|
|
||||||
#auth var
|
#auth var
|
||||||
JWT_SECRET=secrethere
|
JWT_SECRET=secrethere
|
||||||
REDIRECT_URI=http://localhost:80/api/auth/login
|
# REDIRECT_URI=http://localhost:80/api/auth/login
|
||||||
API_SECRET=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
|
API_SECRET=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
|
||||||
CLIENT_UID=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41
|
CLIENT_UID=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41
|
||||||
@ -289,7 +289,7 @@ export class AppController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Redirect('http://localhost/token', 302)
|
@Redirect('http://' + process.env.BASE_URL + '/token', 302)
|
||||||
@Get('auth/login')
|
@Get('auth/login')
|
||||||
async login2(@Req() request: Request) {
|
async login2(@Req() request: Request) {
|
||||||
const url = request.url;
|
const url = request.url;
|
||||||
@ -307,7 +307,7 @@ export class AppController {
|
|||||||
const token = (await data).access_token;
|
const token = (await data).access_token;
|
||||||
// console
|
// console
|
||||||
await this.userService.save(user);
|
await this.userService.save(user);
|
||||||
return { url: `http://localhost/token?data=${encodeURIComponent(JSON.stringify(token))}` };
|
return { url: 'http://' + process.env.BASE_URL + `/token?data=${encodeURIComponent(JSON.stringify(token))}` };
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
|
|||||||
@ -28,7 +28,7 @@ export class loginClass {
|
|||||||
// client_secret: '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',
|
// client_secret: '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',
|
||||||
client_secret: process.env.API_SECRET,
|
client_secret: process.env.API_SECRET,
|
||||||
code: code,
|
code: code,
|
||||||
redirect_uri: process.env.REDIRECT_URI || 'http://localhost:80/api/auth/login',
|
redirect_uri: process.env.REDIRECT_URI || 'http://' + process.env.REACT_APP_BASE_URL + '/api/auth/login',
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
2
containers/react/.env
Normal file
2
containers/react/.env
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
REACT_APP_BASE_URL=92.143.191.152
|
||||||
|
# REACT_APP_BASE_URL=192.168.1.19
|
||||||
@ -30,8 +30,8 @@ function AnimatedRoute () {
|
|||||||
<Route exact path="/" element={<HomeLogin/>}/>
|
<Route exact path="/" element={<HomeLogin/>}/>
|
||||||
<Route exact path="/token" element={<SuccessToken />}/>
|
<Route exact path="/token" element={<SuccessToken />}/>
|
||||||
|
|
||||||
<Route path="/404" element={<HomeLogin/>} />
|
{/* <Route path="/404" element={<HomeLogin/>} /> */}
|
||||||
<Route path="*" element={<Navigate to="/404" />} />
|
{/* <Route path="*" element={<Navigate to="/404" />} /> */}
|
||||||
</Routes>
|
</Routes>
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -104,7 +104,7 @@ function Chats(){
|
|||||||
// console.log(`user= ${tmpUser.data.username}`);
|
// console.log(`user= ${tmpUser.data.username}`);
|
||||||
// console.log(`user= ${tmpUser.data.nickname}`);
|
// console.log(`user= ${tmpUser.data.nickname}`);
|
||||||
// console.log(`user= ${tmpUser.data}`);
|
// console.log(`user= ${tmpUser.data}`);
|
||||||
socket.current = io("ws://localhost:4001");
|
socket.current = io('http://' + process.env.REACT_APP_BASE_URL + ':4001');
|
||||||
console.log(`connection....`);
|
console.log(`connection....`);
|
||||||
socket.current.emit('connection', {username: tmpUser.data.username})
|
socket.current.emit('connection', {username: tmpUser.data.username})
|
||||||
// const socket = io("http://localhost:4001", {
|
// const socket = io("http://localhost:4001", {
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
function Logout(){
|
function Logout(){
|
||||||
|
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
const path = `http://localhost/`;
|
const path = 'http://' + process.env.REACT_APP_BASE_URL + '/';
|
||||||
// history(path, { replace: true });
|
// history(path, { replace: true });
|
||||||
// window.location.replace(path);
|
// window.location.replace(path);
|
||||||
// window.history.pushState({}, '', path);
|
// window.history.pushState({}, '', path);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/06/09 08:18:58 by apommier #+# #+# */
|
/* Created: 2023/06/09 08:18:58 by apommier #+# #+# */
|
||||||
/* Updated: 2023/06/09 08:35:21 by apommier ### ########.fr */
|
/* Updated: 2023/06/15 19:05:14 by apommier ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -79,7 +79,8 @@ export default function Friend({currentUser})
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleButtonClick = (user) => {
|
const handleButtonClick = (user) => {
|
||||||
let path = `http://localhost/profile/${user.username}`;
|
let path = `http://` + process.env.REACT_APP_BASE_URL + `/profile/${user.username}`;
|
||||||
|
console.log("path= ", path)
|
||||||
// history(path, { replace: true });
|
// history(path, { replace: true });
|
||||||
// window.location.replace(path);
|
// window.location.replace(path);
|
||||||
window.history.pushState({}, null, path);
|
window.history.pushState({}, null, path);
|
||||||
|
|||||||
@ -53,7 +53,7 @@ export default function Friend({currentUser})
|
|||||||
}, [clickEvent])
|
}, [clickEvent])
|
||||||
|
|
||||||
const handleButtonClick = (user) => {
|
const handleButtonClick = (user) => {
|
||||||
let path = `http://localhost/profile/${user.username}`;
|
let path = `http://` + process.env.REACT_APP_BASE_URL + `/profile/${user.username}`;
|
||||||
// history(path, { replace: true });
|
// history(path, { replace: true });
|
||||||
// window.location.replace(path);
|
// window.location.replace(path);
|
||||||
window.history.pushState({}, null, path);
|
window.history.pushState({}, null, path);
|
||||||
|
|||||||
@ -26,7 +26,8 @@ function HomeLogin()
|
|||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
// else
|
// else
|
||||||
let path = "https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41&redirect_uri=http%3A%2F%2Flocalhost%3A80%2Fapi%2Fauth%2Flogin&response_type=code";
|
// let path = "https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41&redirect_uri=http%3A%2F%2F" + process.env.REACT_APP_BASE_URL + "%3A80%2Fapi%2Fauth%2Flogin&response_type=code";
|
||||||
|
let path = "https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41&redirect_uri=http%3A%2F%2F92.143.191.152%2Fapi%2Fauth%2Flogin&response_type=code"
|
||||||
window.location.replace(path);
|
window.location.replace(path);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ function DrawCanvas(option) {
|
|||||||
|
|
||||||
// const socketRef = useRef(null);
|
// const socketRef = useRef(null);
|
||||||
// socketRef.current = io('http://localhost:4000');
|
// socketRef.current = io('http://localhost:4000');
|
||||||
const socket = io('http://localhost:4000');
|
const socket = io('http://' + process.env.REACT_APP_BASE_URL + ':4000');
|
||||||
// const socket = socketRef.current
|
// const socket = socketRef.current
|
||||||
console.log("start function");
|
console.log("start function");
|
||||||
const canvas = document.getElementById('myCanvas');
|
const canvas = document.getElementById('myCanvas');
|
||||||
@ -362,7 +362,7 @@ matchmaking();
|
|||||||
|
|
||||||
function draw(timestamp)
|
function draw(timestamp)
|
||||||
{
|
{
|
||||||
console.log("send loose");
|
console.log("turning");
|
||||||
if (!running)
|
if (!running)
|
||||||
return ;
|
return ;
|
||||||
if (gameId === 0 )
|
if (gameId === 0 )
|
||||||
@ -390,7 +390,7 @@ function draw(timestamp)
|
|||||||
api.post('/status', {status: 1});
|
api.post('/status', {status: 1});
|
||||||
console.log("send loose");
|
console.log("send loose");
|
||||||
}
|
}
|
||||||
window.location.replace("http://localhost/pong");
|
window.location.replace("http://" + process.env.REACT_APP_BASE_URL + "/pong");
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,8 +12,17 @@ function getToken() {
|
|||||||
console.log(`getToken = ${getToken()}`)
|
console.log(`getToken = ${getToken()}`)
|
||||||
console.log(`Bearer ${localStorage.getItem("token")}`)
|
console.log(`Bearer ${localStorage.getItem("token")}`)
|
||||||
|
|
||||||
|
const test = "192.168.1.19"
|
||||||
|
// const url = 'http://' + process.env.REACT_APP_BASE_URL + '/api'
|
||||||
|
// const url = 'http://' + test + '/api'
|
||||||
|
|
||||||
|
// console.log("url= ", url)
|
||||||
|
console.log("test= ", test)
|
||||||
|
console.log("env= ", process.env.REACT_APP_BASE_URL)
|
||||||
|
|
||||||
let api = axios.create({
|
let api = axios.create({
|
||||||
baseURL: 'http://localhost/api',
|
// baseURL: 'http://localhost/api',
|
||||||
|
baseURL: 'http://' + process.env.REACT_APP_BASE_URL + '/api',
|
||||||
headers: {
|
headers: {
|
||||||
// Authorization: `Bearer ${getToken()}`,
|
// Authorization: `Bearer ${getToken()}`,
|
||||||
Authorization : `Bearer ${localStorage.getItem("token")}`
|
Authorization : `Bearer ${localStorage.getItem("token")}`
|
||||||
|
|||||||
@ -7,7 +7,7 @@ function SuccessToken() {
|
|||||||
const cleanData = data.slice(1, -1);
|
const cleanData = data.slice(1, -1);
|
||||||
localStorage.setItem('token', `${cleanData}`);
|
localStorage.setItem('token', `${cleanData}`);
|
||||||
console.log(`prout token2= ${localStorage.getItem('token')}`)
|
console.log(`prout token2= ${localStorage.getItem('token')}`)
|
||||||
window.location.replace("http://localhost/pong");
|
window.location.replace("http://" + process.env.REACT_APP_BASE_URL + "/pong");
|
||||||
}
|
}
|
||||||
|
|
||||||
export default SuccessToken;
|
export default SuccessToken;
|
||||||
2
containers/test
Normal file
2
containers/test
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
cc toi
|
||||||
|
cc 2
|
||||||
Loading…
Reference in New Issue
Block a user