mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 09:49:20 +02:00
Anonymize IP stored in Redis too
This commit is contained in:
parent
4af8f5a581
commit
4b857f50c8
4 changed files with 65 additions and 13 deletions
|
@ -341,7 +341,9 @@ class Redis {
|
|||
generateLocalVideoViewerKeys (ip: string, videoId: number): { setKey: string, viewerKey: string }
|
||||
generateLocalVideoViewerKeys (): { setKey: string }
|
||||
generateLocalVideoViewerKeys (ip?: string, videoId?: number) {
|
||||
return { setKey: `local-video-viewer-stats-keys`, viewerKey: `local-video-viewer-stats-${ip}-${videoId}` }
|
||||
const anonymousIP = sha256(CONFIG.SECRETS + '-' + ip)
|
||||
|
||||
return { setKey: `local-video-viewer-stats-keys`, viewerKey: `local-video-viewer-stats-${anonymousIP}-${videoId}` }
|
||||
}
|
||||
|
||||
private generateVideoViewStatsKeys (options: { videoId?: number, hour?: number }) {
|
||||
|
@ -369,11 +371,11 @@ class Redis {
|
|||
}
|
||||
|
||||
generateIPViewKey (ip: string, videoUUID: string) {
|
||||
return `views-${videoUUID}-${ip}`
|
||||
return `views-${videoUUID}-${sha256(CONFIG.SECRETS.PEERTUBE + '-' + ip)}`
|
||||
}
|
||||
|
||||
private generateContactFormKey (ip: string) {
|
||||
return 'contact-form-' + ip
|
||||
return 'contact-form-' + sha256(CONFIG.SECRETS.PEERTUBE + '-' + ip)
|
||||
}
|
||||
|
||||
private generateAPUnavailabilityKey (url: string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue