Fixed IP-Hashing and Alt Detection behind Reverse Proxies

This commit is contained in:
rainbow napkin 2025-04-27 05:46:01 -04:00
parent 46a7e9e067
commit 8b6aa69c51
7 changed files with 42 additions and 10 deletions

View file

@ -15,6 +15,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.*/
//local imports
const config = require('../../../config.json');
const channelModel = require('../../schemas/channel/channelSchema');
const permissionModel = require('../../schemas/permissionSchema');
const flairModel = require('../../schemas/flairSchema');
@ -58,8 +59,14 @@ module.exports = class{
//Send out the currently playing item
this.channel.queue.sendMedia(socket);
//Tattoo hashed IP address to user account for seven days
await userDB.tattooIPRecord(socket.handshake.address);
//If we're proxied
if(config.proxied){
//Tattoo hashed IP address from reverse proxy to user account for seven days
await userDB.tattooIPRecord(socket.handshake.headers['x-forwarded-for']);
}else{
//Tattoo hashed IP address to user account for seven days
await userDB.tattooIPRecord(socket.handshake.address);
}
}
socketCrawl(cb){