Added host to config.json

This commit is contained in:
Akif9748 2022-09-17 19:48:27 +03:00
parent e4a93cbf52
commit b048d6a685
2 changed files with 4 additions and 4 deletions

View file

@ -13,5 +13,6 @@
"max": 25, "max": 25,
"windowMs": 60000 "windowMs": 60000
}, },
"discord_auth": false "discord_auth": false,
"host": "akf-forum.glitch.me"
} }

View file

@ -4,7 +4,7 @@ const { urlencoded: BP } = require('body-parser'),
SES = require('express-session'); SES = require('express-session');
const const
{ def_theme, forum_name, description, limits, global_ratelimit: RLS, discord_auth } = require("./config.json"), { def_theme, forum_name, description, limits, global_ratelimit: RLS, discord_auth, host } = require("./config.json"),
{ UserModel, BanModel } = require("./models"), { UserModel, BanModel } = require("./models"),
port = process.env.PORT || 3000, port = process.env.PORT || 3000,
mongoose = require("mongoose"), mongoose = require("mongoose"),
@ -54,6 +54,5 @@ const server = app.listen(port, () => console.log(`${forum_name}-forum on port:`
if (discord_auth) { if (discord_auth) {
const { address } = server.address(); const { address } = server.address();
console.log(`https://discord.com/api/oauth2/authorize?client_id=${process.env.DISCORD_CLIENT}&redirect_uri=http%3A%2F%2F${address == '::' ? 'localhost:' + port : address}%2Fdiscord_auth%2Fhash&response_type=token&scope=identify`) app.set("discord_auth", `https://discord.com/api/oauth2/authorize?client_id=${process.env.DISCORD_CLIENT}&redirect_uri=http%3A%2F%2F${host}%2Fdiscord_auth%2Fhash&response_type=token&scope=identify`);
app.set("discord_auth", `https://discord.com/api/oauth2/authorize?client_id=${process.env.DISCORD_CLIENT}&redirect_uri=http%3A%2F%2F${address == '::' ? 'localhost:' + port : address}%2Fdiscord_auth%2Fhash&response_type=token&scope=identify`);
} }