mirror of
https://github.com/cassoule/flopobot_v2.git
synced 2026-01-18 16:37:40 +01:00
discord interaction req.body tampered fix
This commit is contained in:
6
index.js
6
index.js
@@ -67,7 +67,7 @@ const app = express();
|
||||
// Get port, or default to 25578
|
||||
const PORT = process.env.PORT || 25578;
|
||||
const FLAPI_URL = process.env.DEV_SITE === 'true' ? process.env.FLAPI_URL_DEV : process.env.FLAPI_URL
|
||||
app.use(express.json());
|
||||
|
||||
app.use((req, res, next) => {
|
||||
res.header('Access-Control-Allow-Origin', FLAPI_URL);
|
||||
res.header('Access-Control-Allow-Headers', 'Content-type, X-API-Key, ngrok-skip-browser-warning');
|
||||
@@ -322,7 +322,7 @@ async function getOnlineUsersWithRole(guild_id=process.env.GUILD_ID, role_id=pro
|
||||
}
|
||||
|
||||
// Login to Discord using bot token (optional)
|
||||
client.login(process.env.BOT_TOKEN);
|
||||
client.login(process.env.BOT_TOKEN).then(r => console.log(''));
|
||||
|
||||
// Listen for message events
|
||||
client.on('messageCreate', async (message) => {
|
||||
@@ -2664,6 +2664,8 @@ app.post('/interactions', verifyKeyMiddleware(process.env.PUBLIC_KEY), async fun
|
||||
return res.status(400).json({ error: 'unknown interaction type' });
|
||||
});
|
||||
|
||||
app.use(express.json());
|
||||
|
||||
// Check flAPI
|
||||
app.get('/check', (req, res) => {
|
||||
res.status(200).json({ check: true, status: 'OK' });
|
||||
|
||||
Reference in New Issue
Block a user