0
Fork 0
mirror of https://github.com/stonith404/pingvin-share.git synced 2025-01-15 01:14:27 -05:00

Fix visitor limit check

This commit is contained in:
Elias Schneider 2022-04-28 08:20:15 +02:00
parent e0669979e2
commit 8274992e79
No known key found for this signature in database
GPG key ID: D5EC1C72D93244FD
2 changed files with 4 additions and 2 deletions

View file

@ -7,7 +7,9 @@ client
.setEndpoint( .setEndpoint(
(process.env["NEXT_PUBLIC_APPWRITE_HOST"] as string).replace( (process.env["NEXT_PUBLIC_APPWRITE_HOST"] as string).replace(
"localhost", "localhost",
"host.docker.internal" process.env.NODE_ENV == "production"
? "host.docker.internal"
: "localhost"
) )
) )
.setProject("pingvin-share") .setProject("pingvin-share")

View file

@ -19,7 +19,7 @@ export const checkSecurity = async (
.getDocument<SecurityDocument>("shareSecurity", shareDocument.securityID) .getDocument<SecurityDocument>("shareSecurity", shareDocument.securityID)
.then((securityDocument) => { .then((securityDocument) => {
if (securityDocument.maxVisitors) { if (securityDocument.maxVisitors) {
if (shareDocument.visitorCount > securityDocument.maxVisitors) { if (shareDocument.visitorCount >= securityDocument.maxVisitors) {
throw "visitor_limit_exceeded"; throw "visitor_limit_exceeded";
} }
} }