diff --git a/Assets/Fonts/SpaceGrotesk.ttf b/Assets/Fonts/SpaceGrotesk.ttf new file mode 100644 index 0000000..e1329aa Binary files /dev/null and b/Assets/Fonts/SpaceGrotesk.ttf differ diff --git a/auth/gem.html b/auth/gem.html new file mode 100644 index 0000000..2c69d1b --- /dev/null +++ b/auth/gem.html @@ -0,0 +1,9 @@ +
+
Enable Web Proxy
+
+ +
+
diff --git a/secret/helpers.php b/secret/helpers.php index 3f9da87..2945f49 100644 --- a/secret/helpers.php +++ b/secret/helpers.php @@ -37,4 +37,16 @@ function returnSuccess($success, $refreshToken = ""){ )); exit(); } + +function getUsers(){ + return explode("\n", shell_exec("cut -d: -f1 /etc/passwd")); +} + +function userExists($user){ + return in_array($user, getUsers()); +} + +function geminiProxy($user, $action){ + return shell_exec("/usr/bin/sudo /etc/ttyserver/bin/toggleProxy ".$action." \"".$user."\""); +} ?> diff --git a/tools/toggleProxy b/tools/toggleProxy new file mode 100755 index 0000000..6e0f1af --- /dev/null +++ b/tools/toggleProxy @@ -0,0 +1,69 @@ +#!/bin/bash + +# $1 - get / enable / disable +# $2 - optional username + +ru=$USER +if [ "$EUID" != 0 ]; then + # Only for running user + if [ "$2" != "$USER" ]; then + echo "Cannot run for user other than yourself without superuser privileges." + exit 0 + fi +else + # Run for specified user + if [ "$2" != "" ]; then + ru=$2 + else + ru="root" + fi +fi + +hd="$(eval echo ~$ru)/public_gemini" + +if [ "$1" == "get" ]; then + if [ -d "$hd" ]; then + # gemini dir exists + if [ -r "$hd/.serve_ok" ]; then + echo "enabled" + else + echo "disabled" + fi + else + echo "no_exist" + fi +elif [ "$1" == "enable" ]; then + if [ -d "$hd" ]; then + if [ -r "$hd/.serve_ok" ]; then + echo "done" + else + touch "$hd/.serve_ok" + chown "$ru" "$hd/.serve_ok" + echo "done" + fi + else + mkdir "$hd" + touch "$hd/.serve_ok" + chown "$ru" -R "$hd" + echo "done" + fi +elif [ "$1" == "disable" ]; then + if [ -d "$hd" ]; then + if [ -w "$hd/.serve_ok" ]; then + rm "$hd/.serve_ok" + echo "done" + else + if [ -r "$hd/.serve_ok" ]; then + echo "no_perm" + else + echo "done" + fi + fi + else + echo "no_dir" + fi +else + # TODO: display command help guide + echo "TODO" +fi +