Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
1bff1109b8
BIN
Assets/Fonts/SpaceGrotesk.ttf
Normal file
BIN
Assets/Fonts/SpaceGrotesk.ttf
Normal file
Binary file not shown.
9
auth/gem.html
Normal file
9
auth/gem.html
Normal file
@ -0,0 +1,9 @@
|
||||
<div class="row">
|
||||
<div class="col">Enable Web Proxy</div>
|
||||
<div class="col">
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="gemini-proxy" checked>
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
@ -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."\"");
|
||||
}
|
||||
?>
|
||||
|
69
tools/toggleProxy
Executable file
69
tools/toggleProxy
Executable file
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user