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

Fix git http access

This commit is contained in:
Josué Tille 2018-04-25 10:52:42 +02:00
parent 8c924f6df9
commit 2005aba8cf
3 changed files with 22 additions and 4 deletions

View file

@ -77,3 +77,21 @@ set_permission() {
chmod u=rwX,g=rX,o= "/home/$app"
chmod u=rwX,g=rX,o= "/var/log/$app"
}
set_access_settings() {
if [ "$is_public" = '1' ]
then
ynh_app_setting_set $app unprotected_uris "/"
else
# For an access to the git server by https in private mode we need to allow the access to theses URL :
# - "DOMAIN/PATH/USER/REPOSITORY/info/refs"
# - "DOMAIN/PATH/USER/REPOSITORY/git-upload-pack"
# - "DOMAIN/PATH/USER/REPOSITORY/git-receive-pack"
excaped_domain=${domain//'.'/'%.'}
excaped_domain=${excaped_domain//'-'/'%-'}
excaped_path=${path_url//'.'/'%.'}
excaped_path=${excaped_path//'-'/'%-'}
ynh_app_setting_set $app skipped_regex "$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/git%-receive%-pack,$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/git%-upload%-pack,$excaped_domain$excaped_path/[%w-.]*/[%w-.]*/info/refs"
fi
}

View file

@ -95,10 +95,7 @@ ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ../conf/login_source.sql
#=================================================
# Unprotect root from SSO if public
if [ "$is_public" = '1' ]
then
ynh_app_setting_set $app unprotected_uris "/"
fi
set_access_settings
# Add Gogs to YunoHost's monitored services
yunohost service add "$app" --log "/var/log/$app/$app.log"

View file

@ -103,6 +103,9 @@ config_nginx
# GENERIC FINALIZATION
#=================================================
# Unprotect root from SSO if public
set_access_settings
# Set permissions
set_permission