have to check on config for proxycheck
This commit is contained in:
parent
5808d8a595
commit
77375eca64
|
@ -8,6 +8,9 @@ import webSockets from '../socket/websockets';
|
|||
|
||||
import { CHAT_CHANNELS } from './constants';
|
||||
import { cheapDetector } from './isProxy';
|
||||
import {
|
||||
USE_PROXYCHECK,
|
||||
} from './config';
|
||||
|
||||
|
||||
class ChatProvider {
|
||||
|
@ -106,7 +109,7 @@ class ChatProvider {
|
|||
}
|
||||
}
|
||||
|
||||
if (user.ip && await cheapDetector(user.ip)) {
|
||||
if (USE_PROXYCHECK && user.ip && await cheapDetector(user.ip)) {
|
||||
logger.info(
|
||||
`${name} / ${user.ip} tried to send chat message with proxy`,
|
||||
);
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
import type { Request, Response } from 'express';
|
||||
|
||||
import getMe from '../../core/me';
|
||||
import {
|
||||
USE_PROXYCHECK,
|
||||
} from '../../core/config';
|
||||
import { cheapDetector } from '../../core/isProxy';
|
||||
|
||||
|
||||
export default async (req: Request, res: Response) => {
|
||||
|
@ -14,6 +18,13 @@ export default async (req: Request, res: Response) => {
|
|||
const userdata = await getMe(user);
|
||||
user.updateLogInTimestamp();
|
||||
|
||||
const { trueIp: ip } = req;
|
||||
if (USE_PROXYCHECK && ip !== '0.0.0.1') {
|
||||
// pre-fire cheap Detector to give it time to get a real result
|
||||
// once api_pixel needs it
|
||||
cheapDetector(ip);
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/49547/how-to-control-web-page-caching-across-all-browsers
|
||||
res.set({
|
||||
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
||||
|
|
Loading…
Reference in New Issue
Block a user