Skip to content

Commit

Permalink
Fixes guest only mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert27 committed Apr 15, 2024
1 parent 84ea8fb commit 1b96ec9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ RUN curl --output-dir data/ https://assets.neuland.app/generated/ical-courses.js

RUN npm run build

ENV NODE_ENV=production

USER node
EXPOSE 3000
CMD ["npm", "start"]
2 changes: 1 addition & 1 deletion assets/spo-parser/run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

if [ -n "$NEXT_PUBLIC_GUEST_ONLY" ]; then
if [ "$NEXT_PUBLIC_GUEST_ONLY" = "true" ]; then
echo "Skipping grade weight extraction (guest only mode)"
echo "{}" > spo-grade-weights.json
exit 0
Expand Down
2 changes: 1 addition & 1 deletion rogue-thi-app/lib/backend/thi-session-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export async function callWithSession(method) {
// redirect user if he never had a session
if (!session) {
throw new NoSessionError()
} else if (session === 'guest2' || process.env.NEXT_PUBLIC_GUEST_ONLY) {
} else if (session === 'guest2' || process.env.NEXT_PUBLIC_GUEST_ONLY === 'true') {
throw new UnavailableSessionError()
}

Expand Down
2 changes: 1 addition & 1 deletion rogue-thi-app/pages/login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const ORIGINAL_ERROR_WRONG_CREDENTIALS = 'Wrong credentials'
const IMPRINT_URL = process.env.NEXT_PUBLIC_IMPRINT_URL
const PRIVACY_URL = process.env.NEXT_PUBLIC_PRIVACY_URL
const GIT_URL = process.env.NEXT_PUBLIC_GIT_URL
const GUEST_ONLY = !!process.env.NEXT_PUBLIC_GUEST_ONLY
const GUEST_ONLY = process.env.NEXT_PUBLIC_GUEST_ONLY === 'true'

const KNOWN_BACKEND_ERRORS = ['Response is not valid JSON']

Expand Down

0 comments on commit 1b96ec9

Please sign in to comment.