Skip to content

Commit b366a33

Browse files
Remove execution_mode dependencies from InstalledScriptsTab (#50)
- Remove ExecutionModeBadge import and usage - Update filtering logic to use server_name presence instead of execution_mode - Simplify update script logic by removing mode property - Update Terminal component call to determine mode based on server presence - Replace ExecutionModeBadge in table with simple text display - Maintain backend API compatibility by keeping execution_mode in mutations - Use nullish coalescing operator (??) for better null handling
1 parent e09c1bb commit b366a33

31 files changed

+1117
-849
lines changed

package-lock.json

Lines changed: 68 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"typecheck": "tsc --noEmit"
2323
},
2424
"dependencies": {
25+
"@radix-ui/react-slot": "^1.2.3",
2526
"@t3-oss/env-nextjs": "^0.13.8",
2627
"@tanstack/react-query": "^5.87.4",
2728
"@trpc/client": "^11.0.0",
@@ -33,6 +34,8 @@
3334
"@xterm/addon-web-links": "^0.11.0",
3435
"@xterm/xterm": "^5.5.0",
3536
"better-sqlite3": "^9.6.0",
37+
"class-variance-authority": "^0.7.1",
38+
"clsx": "^2.1.1",
3639
"next": "^15.5.3",
3740
"node-pty": "^1.0.0",
3841
"react": "^19.0.0",
@@ -42,6 +45,7 @@
4245
"server-only": "^0.0.1",
4346
"strip-ansi": "^7.1.2",
4447
"superjson": "^2.2.1",
48+
"tailwind-merge": "^3.3.1",
4549
"ws": "^8.18.3",
4650
"zod": "^3.24.2"
4751
},

scripts/ct/2fauth.sh

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/usr/bin/env bash
2+
SCRIPT_DIR="$(dirname "$0")"
3+
source "$SCRIPT_DIR/../core/build.func"
4+
# Copyright (c) 2021-2025 community-scripts ORG
5+
# Author: jkrgr0
6+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
7+
# Source: https://docs.2fauth.app/
8+
9+
APP="2FAuth"
10+
var_tags="${var_tags:-2fa;authenticator}"
11+
var_cpu="${var_cpu:-1}"
12+
var_ram="${var_ram:-512}"
13+
var_disk="${var_disk:-2}"
14+
var_os="${var_os:-debian}"
15+
var_version="${var_version:-13}"
16+
var_unprivileged="${var_unprivileged:-1}"
17+
18+
header_info "$APP"
19+
variables
20+
color
21+
catch_errors
22+
23+
function update_script() {
24+
header_info
25+
check_container_storage
26+
check_container_resources
27+
28+
if [[ ! -d "/opt/2fauth" ]]; then
29+
msg_error "No ${APP} Installation Found!"
30+
exit
31+
fi
32+
if check_for_gh_release "2fauth" "Bubka/2FAuth"; then
33+
$STD apt update
34+
$STD apt -y upgrade
35+
36+
msg_info "Creating Backup"
37+
mv "/opt/2fauth" "/opt/2fauth-backup"
38+
if ! dpkg -l | grep -q 'php8.3'; then
39+
cp /etc/nginx/conf.d/2fauth.conf /etc/nginx/conf.d/2fauth.conf.bak
40+
fi
41+
msg_ok "Backup Created"
42+
43+
if ! dpkg -l | grep -q 'php8.3'; then
44+
$STD apt-get install -y \
45+
lsb-release \
46+
gnupg2
47+
PHP_VERSION="8.3" PHP_MODULE="common,ctype,fileinfo,mysql,cli" PHP_FPM="YES" setup_php
48+
sed -i 's/php8.2/php8.3/g' /etc/nginx/conf.d/2fauth.conf
49+
fi
50+
fetch_and_deploy_gh_release "2fauth" "Bubka/2FAuth"
51+
setup_composer
52+
mv "/opt/2fauth-backup/.env" "/opt/2fauth/.env"
53+
mv "/opt/2fauth-backup/storage" "/opt/2fauth/storage"
54+
cd "/opt/2fauth" || return
55+
chown -R www-data: "/opt/2fauth"
56+
chmod -R 755 "/opt/2fauth"
57+
export COMPOSER_ALLOW_SUPERUSER=1
58+
$STD composer install --no-dev --prefer-source
59+
php artisan 2fauth:install
60+
$STD systemctl restart nginx
61+
62+
msg_info "Cleaning Up"
63+
if dpkg -l | grep -q 'php8.2'; then
64+
$STD apt remove --purge -y php8.2*
65+
fi
66+
$STD apt -y autoremove
67+
$STD apt -y autoclean
68+
$STD apt -y clean
69+
msg_ok "Cleanup Completed"
70+
msg_ok "Updated Successfully"
71+
fi
72+
exit
73+
}
74+
75+
start
76+
build_container
77+
description
78+
79+
msg_ok "Completed Successfully!\n"
80+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
81+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
82+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:80${CL}"

scripts/install/2fauth-install.sh

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: jkrgr0
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://docs.2fauth.app/
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt install -y \
18+
lsb-release \
19+
nginx
20+
msg_ok "Installed Dependencies"
21+
22+
PHP_VERSION="8.3" PHP_MODULE="common,ctype,fileinfo,mysql,cli" PHP_FPM="YES" setup_php
23+
setup_composer
24+
setup_mariadb
25+
26+
msg_info "Setting up Database"
27+
DB_NAME=2fauth_db
28+
DB_USER=2fauth
29+
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
30+
$STD mariadb -u root -e "CREATE DATABASE $DB_NAME;"
31+
$STD mariadb -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASS';"
32+
$STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;"
33+
{
34+
echo "2FAuth Credentials"
35+
echo "Database User: $DB_USER"
36+
echo "Database Password: $DB_PASS"
37+
echo "Database Name: $DB_NAME"
38+
} >>~/2FAuth.creds
39+
msg_ok "Set up Database"
40+
41+
fetch_and_deploy_gh_release "2fauth" "Bubka/2FAuth"
42+
43+
msg_info "Setup 2FAuth"
44+
cd /opt/2fauth || exit
45+
cp .env.example .env
46+
IPADDRESS=$(hostname -I | awk '{print $1}')
47+
sed -i -e "s|^APP_URL=.*|APP_URL=http://$IPADDRESS|" \
48+
-e "s|^DB_CONNECTION=$|DB_CONNECTION=mysql|" \
49+
-e "s|^DB_DATABASE=$|DB_DATABASE=$DB_NAME|" \
50+
-e "s|^DB_HOST=$|DB_HOST=127.0.0.1|" \
51+
-e "s|^DB_PORT=$|DB_PORT=3306|" \
52+
-e "s|^DB_USERNAME=$|DB_USERNAME=$DB_USER|" \
53+
-e "s|^DB_PASSWORD=$|DB_PASSWORD=$DB_PASS|" .env
54+
export COMPOSER_ALLOW_SUPERUSER=1
55+
$STD composer update --no-plugins --no-scripts
56+
$STD composer install --no-dev --prefer-source --no-plugins --no-scripts
57+
$STD php artisan key:generate --force
58+
$STD php artisan migrate:refresh
59+
$STD php artisan passport:install -q -n
60+
$STD php artisan storage:link
61+
$STD php artisan config:cache
62+
chown -R www-data: /opt/2fauth
63+
chmod -R 755 /opt/2fauth
64+
msg_ok "Setup 2fauth"
65+
66+
msg_info "Configure Service"
67+
cat <<EOF >/etc/nginx/conf.d/2fauth.conf
68+
server {
69+
listen 80;
70+
root /opt/2fauth/public;
71+
server_name $IPADDRESS;
72+
index index.php;
73+
charset utf-8;
74+
75+
location / {
76+
try_files \$uri \$uri/ /index.php?\$query_string;
77+
}
78+
79+
location = /favicon.ico { access_log off; log_not_found off; }
80+
location = /robots.txt { access_log off; log_not_found off; }
81+
82+
error_page 404 /index.php;
83+
84+
location ~ \.php\$ {
85+
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
86+
fastcgi_param SCRIPT_FILENAME \$realpath_root\$fastcgi_script_name;
87+
include fastcgi_params;
88+
}
89+
90+
location ~ /\.(?!well-known).* {
91+
deny all;
92+
}
93+
}
94+
EOF
95+
systemctl reload nginx
96+
msg_ok "Configured Service"
97+
98+
motd_ssh
99+
customize
100+
101+
msg_info "Cleaning up"
102+
$STD apt -y autoremove
103+
$STD apt -y autoclean
104+
$STD apt -y clean
105+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)