first commit

This commit is contained in:
Andres
2026-09-17 17:21:39 -04:00
parent c17f11f591
commit 252152b9fa
6 changed files with 466 additions and 155 deletions
@@ -1,17 +0,0 @@
const ALLOWED_IPS = [
"86.106.20.28", // L2
"89.116.209.21", // L2
"86.106.20.24", // L3
"84.32.173.80", // L3
"34.141.125.49", // euw3-stage-koalemos
"35.230.138.117", // euw2-prod-apollo
"35.242.131.17", // euw2-prod-apollo
"34.89.86.34", // euw2-prod-apollo
"35.242.132.122", // euw2-prod-apollo
"35.234.116.158", // euw3-stage-koalemos
"34.159.186.242", // euw3-stage-koalemos
]
module.exports = {
ALLOWED_IPS,
}
-101
View File
@@ -1,101 +0,0 @@
/// <reference path="../pb_data/types.d.ts" />
onRecordCreateRequest((e) => {
const { ALLOWED_IPS } = require(`${__hooks}/superusers-allow-list.js`)
const ip = e.realIP()
if (!ALLOWED_IPS.includes(ip)) {
throw new BadRequestError(`Not allowed to create superuser`)
}
e.next()
}, "_superusers")
onRecordUpdateRequest((e) => {
const { ALLOWED_IPS } = require(`${__hooks}/superusers-allow-list.js`)
const ip = e.realIP()
if (!ALLOWED_IPS.includes(ip)) {
throw new BadRequestError(`Not allowed to update superuser`)
}
e.next()
}, "_superusers")
onRecordDeleteRequest((e) => {
const { ALLOWED_IPS } = require(`${__hooks}/superusers-allow-list.js`)
const ip = e.realIP()
if (!ALLOWED_IPS.includes(ip)) {
throw new BadRequestError(`Not allowed to delete superuser`)
}
e.next()
}, "_superusers")
onRecordRequestPasswordResetRequest((e) => {
const { ALLOWED_IPS } = require(`${__hooks}/superusers-allow-list.js`)
const ip = e.realIP()
if (!ALLOWED_IPS.includes(ip)) {
throw new BadRequestError(`Not allowed to request password reset for superuser`)
}
e.next()
}, "_superusers")
onCollectionViewRequest((e) => {
const { ALLOWED_IPS } = require(`${__hooks}/superusers-allow-list.js`)
const ip = e.realIP()
if (!ALLOWED_IPS.includes(ip)) {
throw new BadRequestError(`Not allowed to view collection`)
}
e.next()
})
onCollectionCreateRequest((e) => {
const { ALLOWED_IPS } = require(`${__hooks}/superusers-allow-list.js`)
const ip = e.realIP()
if (!ALLOWED_IPS.includes(ip)) {
throw new BadRequestError(`Not allowed to create collection`)
}
e.next()
})
onCollectionUpdateRequest((e) => {
const { ALLOWED_IPS } = require(`${__hooks}/superusers-allow-list.js`)
const ip = e.realIP()
if (!ALLOWED_IPS.includes(ip)) {
throw new BadRequestError(`Not allowed to update collection`)
}
e.next()
})
onCollectionDeleteRequest((e) => {
const { ALLOWED_IPS } = require(`${__hooks}/superusers-allow-list.js`)
const ip = e.realIP()
if (!ALLOWED_IPS.includes(ip)) {
throw new BadRequestError(`Not allowed to delete collection`)
}
e.next()
})
onCollectionsImportRequest((e) => {
const { ALLOWED_IPS } = require(`${__hooks}/superusers-allow-list.js`)
const ip = e.realIP()
if (!ALLOWED_IPS.includes(ip)) {
throw new BadRequestError(`Not allowed to import collections`)
}
e.next()
})