mirror of
https://github.com/unraid/api.git
synced 2026-01-13 20:19:56 -06:00
* chore(web): mock user session cookie during development * refactor(scripts): change default mock session name to mock-user-session * tmp: log cookies in production * refactor(api): add dev fixture for a mock user session * fix(web): only mock session cookie during development * fix(web): type coercion of MOCK_USER_SESSION env flag
34 lines
953 B
Bash
Executable File
34 lines
953 B
Bash
Executable File
# This script creates a mock session on a server.
|
|
# During local dev/testing, you should run it in the api container,
|
|
# so the nest.js api can authenticate cookies against it.
|
|
#
|
|
# You should also set a cookie named 'unraid_...' whose value matches
|
|
# the name of the session you created (where name is sess_<name>).
|
|
# By default, this is my-session
|
|
|
|
sessions_dir=/var/lib/php
|
|
default_session_name=mock-user-session
|
|
|
|
if [ "$1" = "--help" ]; then
|
|
echo "This script creates a mock session on a server."
|
|
echo ""
|
|
echo "Usage: $0 [options]"
|
|
echo ""
|
|
echo "Options:"
|
|
echo " [name] Name of the session to create (default: mock-user-session)"
|
|
echo " --help Display this help message and exit"
|
|
echo ""
|
|
echo "Example: $0 a-session-name"
|
|
echo ""
|
|
echo "Current list of sessions:"
|
|
ls $sessions_dir
|
|
exit 0
|
|
fi
|
|
|
|
session_name="${1:-$default_session_name}"
|
|
|
|
mkdir -p $sessions_dir
|
|
touch "$sessions_dir/sess_$session_name"
|
|
|
|
ls $sessions_dir
|