Compare commits

..

4 commits

Author SHA1 Message Date
ExostFlash
144dfaf8c8 modif 2025-08-29 10:43:49 +02:00
ExostFlash
fbd10c6fd5 modif all 2025-08-29 10:33:03 +02:00
ExostFlash
b04045ca8e modif 2025-08-29 10:26:00 +02:00
DarkMax31
d9c975ec2f tentavive page restos 2025-08-29 09:52:42 +02:00
6 changed files with 88 additions and 85 deletions

Binary file not shown.

View file

@ -1,13 +1,14 @@
const axios = require("axios"); const axios = require("axios");
const { getUserByDId } = require('../users/getUsers'); const { getUserByGId } = require('../users/getUsers');
const { postUser } = require('../users/postUsers'); const { postUser } = require('../users/postUsers');
const CLIEN_ID = "71229835507-9413gbpdamv2qbcb2ov8oda2oqgcsk8q.apps.googleusercontent.com"; const CLIEN_ID = "71229835507-9413gbpdamv2qbcb2ov8oda2oqgcsk8q.apps.googleusercontent.com";
const GOOGLE_SECRET = "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"; const GOOGLE_SECRET = "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";
const REDIRECT_URI = "http://localhost:3000/auth/google/callback"; const GOOGLE_REDIRECT_URI = "http://localhost:3000/auth/google/callback";
exports.handleGoogleAuth = async (code, res) => { exports.handleGoogleAuth = async (req, res) => {
const code = req.query.code;
if (!code) return res.status(400).json({ error: "Code de validation manquant" }); if (!code) return res.status(400).json({ error: "Code de validation manquant" });
try { try {
const params = new URLSearchParams(); const params = new URLSearchParams();
@ -41,8 +42,6 @@ exports.handleGoogleAuth = async (code, res) => {
const newUser = { const newUser = {
username: userData.name || userData.email, username: userData.name || userData.email,
google_id: userData.id, google_id: userData.id,
email: userData.email,
avatar: userData.picture || null,
}; };
savedUser = await postUser(newUser); savedUser = await postUser(newUser);
} }

View file

@ -49,8 +49,8 @@ main {
} }
.chart-placeholder { .chart-placeholder {
width: 150px; width: 200px;
height: 150px; height: 200px;
background: #eee; background: #eee;
display: flex; display: flex;
align-items: center; align-items: center;

View file

@ -22,6 +22,17 @@ router.get('/auth/discord', (req, res) => {
router.get('/auth/discord/callback', require('./modules/auth/discord').handleDiscordAuth); router.get('/auth/discord/callback', require('./modules/auth/discord').handleDiscordAuth);
// Auth Google
router.get('/auth/google', (req, res) => {
const clientId = '71229835507-9413gbpdamv2qbcb2ov8oda2oqgcsk8q.apps.googleusercontent.com';
const redirectUri = 'http://localhost:3000/auth/google/callback';
const scope = 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile';
const googleAuthUrl = `https://accounts.google.com/o/oauth2/auth?client_id=${clientId}&redirect_uri=${encodeURIComponent(redirectUri)}&response_type=code&scope=${encodeURIComponent(scope)}`;
res.redirect(googleAuthUrl);
});
router.get('/auth/google/callback', require('./modules/auth/google').handleGoogleAuth);
// Déconnexion // Déconnexion
router.get('/logout', (req, res) => { router.get('/logout', (req, res) => {
req.session.destroy((err) => { req.session.destroy((err) => {
@ -33,4 +44,4 @@ router.get('/logout', (req, res) => {
}); });
}); });
module.exports = router; module.exports = router;

View file

@ -1,76 +0,0 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Diagramme Radar avec Chart.js</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body>
<div style="width: 35%; margin: 0 auto;">
<canvas id="radarChart"></canvas>
</div>
<script>
const ctx = document.getElementById('radarChart').getContext('2d');
const radarChart = new Chart(ctx, {
type: 'radar',
data: {
labels: ['Qualité des plats', 'Ambiance', 'Accessibilité', 'Service', 'Tradition'],
datasets: [
{
label: 'Moyenne des notes',
data: [4.7, 4.6, 4.4, 4.3, 4.8],
fill: true,
backgroundColor: 'rgba(25, 80, 233, 0.2)',
borderColor: 'rgb(25, 80, 233, 10)',
pointBackgroundColor: 'rgb(55, 99, 132)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgb(255, 99, 132)',
pointStyle: 'circle',
pointRadius: 5,
pointRotation: 0,
},
]
},
options: {
plugins: {
legend: {
display: false
},
tooltip: {
callbacks: {
label: function(context) {
let label = context.dataset.label || '';
if (label) {
label += ': ';
}
label += context.formattedValue;
return label;
}
}
}
},
scales: {
r: {
max: 5,
min: 0,
ticks: {
stepSize: 1,
callback: function(value, index, values) {
return value.toFixed(1);
}
}
}
},
elements: {
line: {
borderWidth: 3
}
}
}
});
</script>
</body>
</html>

View file

@ -21,7 +21,9 @@
</div> </div>
</div> </div>
<div class="chart"> <div class="chart">
<div class="chart-placeholder">Graph radar</div> <div class="chart-placeholder">
<canvas id="radarChart"></canvas>
</div>
</div> </div>
</div> </div>
@ -95,3 +97,70 @@
</div> </div>
</div> </div>
</div> </div>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const ctx = document.getElementById('radarChart').getContext('2d');
const radarChart = new Chart(ctx, {
type: 'radar',
data: {
labels: ['Qualité des plats', 'Ambiance', 'Accessibilité', 'Service', 'Tradition'],
datasets: [
{
label: 'Moyenne des notes',
data: [4.7, 4.6, 4.4, 4.3, 4.8],
fill: true,
backgroundColor: 'rgba(255,215, 0, 0.2)',
borderColor: 'rgb(255,215, 0, 1)',
pointBackgroundColor: 'rgb(255,215, 0)',
pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgb(255,215, 0)',
pointStyle: 'circle',
pointRadius: 5,
pointRotation: 0,
},
]
},
options: {
plugins: {
legend: {
display: false
},
tooltip: {
callbacks: {
label: function(context) {
let label = context.dataset.label || '';
if (label) {
label += ': ';
}
label += context.formattedValue;
return label;
}
}
}
},
scales: {
r: {
max: 5,
min: 0,
ticks: {
stepSize: 1,
display: false,
callback: function(value, index, values) {
return value.toFixed(1);
}
}
}
},
elements: {
line: {
borderWidth: 3
}
}
}
});
});
</script>