1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lingva_ynh.git synced 2024-09-03 19:36:20 +02:00

penambahan fitur sub-jalur

This commit is contained in:
Neko Nekowazarashi 2023-05-29 21:28:58 +07:00
parent 5c71751633
commit e66ebaed5f
5 changed files with 35 additions and 7 deletions

View file

@ -1,4 +1,4 @@
location / { location __PATH__/ {
# Standard nginx configuration # Standard nginx configuration
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
@ -6,7 +6,7 @@ location / {
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:__PORT__; proxy_pass http://localhost:__PORT__/__PATH__;
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;

View file

@ -27,6 +27,10 @@ ram.runtime = "50M"
[install.domain] [install.domain]
type = "domain" type = "domain"
[install.path]
type = "path"
default = "/"
[install.init_main_permission] [install.init_main_permission]
type = "group" type = "group"
default = "visitors" default = "visitors"

View file

@ -36,13 +36,29 @@ then
ynh_replace_string --match_string="NEXT_PUBLIC_SITE_DOMAIN=$old_domain" --replace_string="NEXT_PUBLIC_SITE_DOMAIN=$new_domain" --target_file="$install_dir/.env.local" ynh_replace_string --match_string="NEXT_PUBLIC_SITE_DOMAIN=$old_domain" --replace_string="NEXT_PUBLIC_SITE_DOMAIN=$new_domain" --target_file="$install_dir/.env.local"
fi fi
if [ $change_path -eq 1 ]
then
if [ "$old_path" = "/" ]; then
old_next_path=""
else
old_next_path=$old_path
fi
if [ "$new_path" = "/" ]; then
new_next_path=""
else
new_next_path=$new_path
fi
ynh_replace_string --match_string="module.exports = { basePath: '$old_path', };" --replace_string="module.exports = { basePath: '$new_path', };"
fi
#================================================= #=================================================
# REBUILDING AND INSTALL THE APP # REBUILDING AND INSTALL THE APP
#================================================= #=================================================
ynh_script_progression --message="Rebuilding the app..." --weight=1 ynh_script_progression --message="Rebuilding the app..." --weight=1
ynh_use_nodejs ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install --prefix="$install_dir"
npx next telemetry disable npx next telemetry disable
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm run build --prefix="$install_dir" ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm run build --prefix="$install_dir"

View file

@ -50,6 +50,18 @@ ynh_add_config --template=".env.local" --destination="$install_dir/.env.local"
chmod 400 "$install_dir/.env.local" chmod 400 "$install_dir/.env.local"
chown $app:$app "$install_dir/.env.local" chown $app:$app "$install_dir/.env.local"
#=================================================
# CONFIGURATION FOR SUBPATH
#=================================================
if [ "$path" = "/" ]; then
next_path=""
else
next_path=$path
fi
echo "module.exports = { basePath: '$next_path', };" >> "$install_dir/next.config.js"
#================================================= #=================================================
# BUILD AND INSTALL THE APP # BUILD AND INSTALL THE APP
#================================================= #=================================================

View file

@ -42,10 +42,6 @@ ynh_remove_systemd_config
ynh_remove_nginx_config ynh_remove_nginx_config
# Remove other various files specific to the app... such as :
ynh_secure_remove --file="/var/log/$app"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================