diff --git a/config.ini-example b/config.ini-example index ebc306c..2c0c921 100644 --- a/config.ini-example +++ b/config.ini-example @@ -20,12 +20,17 @@ title = "" [clone_button] ; ssh remote show_ssh_remote = false ; display remote URL for SSH +ssh_host = '' ; host to use for cloning via HTTP (default: none => uses gitlist web host) +ssh_url_subdir = '' ; if cloning via SSH is triggered using special dir (e.g. ssh://example.com/git/repo.git) + ; has to end with trailing slash ssh_user = 'git' ; user to use for cloning via SSH +ssh_user_dynamic = false ; when enabled, ssh_user is set to $_SERVER['PHP_AUTH_USER'] ; http remote show_http_remote = false ; display remote URL for HTTP +http_host = '' ; host to use for cloning via HTTP (default: none => uses gitlist web host) use_https = true ; generate URL with https:// -url_subdir = 'git/' ; if cloning via HTTP is triggered using virtual dir (e.g. https://example.com/git/repo.git) +http_url_subdir = 'git/' ; if cloning via HTTP is triggered using virtual dir (e.g. https://example.com/git/repo.git) ; has to end with trailing slash http_user = '' ; user to use for cloning via HTTP (default: none) http_user_dynamic = false ; when enabled, http_user is set to $_SERVER['PHP_AUTH_USER'] diff --git a/src/Application.php b/src/Application.php index f7f9e5d..664c01c 100644 --- a/src/Application.php +++ b/src/Application.php @@ -41,10 +41,13 @@ class Application extends SilexApplication $this['avatar.query'] = $config->get('avatar', 'query'); $this['show_http_remote'] = $config->get('clone_button', 'show_http_remote'); $this['use_https'] = $config->get('clone_button', 'use_https'); - $this['url_subdir'] = $config->get('clone_button', 'url_subdir'); + $this['http_url_subdir'] = $config->get('clone_button', 'http_url_subdir'); $this['http_user'] = $config->get('clone_button', 'http_user_dynamic') ? $_SERVER['PHP_AUTH_USER'] : $config->get('clone_button', 'http_user'); + $this['http_host'] = $config->get('clone_button', 'http_host'); $this['show_ssh_remote'] = $config->get('clone_button', 'show_ssh_remote'); - $this['ssh_user'] = $config->get('clone_button', 'ssh_user'); + $this['ssh_user'] = $config->get('clone_button', 'ssh_user_dynamic') ? $_SERVER['PHP_AUTH_USER'] : $config->get('clone_button', 'ssh_user'); + $this['ssh_url_subdir'] = $config->get('clone_button', 'ssh_url_subdir'); + $this['ssh_host'] = $config->get('clone_button', 'ssh_host'); // Register services $this->register(new TwigServiceProvider(), array( diff --git a/themes/bootstrap3/twig/tree.twig b/themes/bootstrap3/twig/tree.twig index b0debfb..6d81bbf 100644 --- a/themes/bootstrap3/twig/tree.twig +++ b/themes/bootstrap3/twig/tree.twig @@ -28,14 +28,14 @@ {% endif %} {% if app.show_http_remote %} - + {% endif %}
{% if app.show_ssh_remote %} - + {% endif %} {% if app.show_http_remote %} - + {% endif %} diff --git a/themes/default/twig/tree.twig b/themes/default/twig/tree.twig index 2428cd2..c7b21fb 100644 --- a/themes/default/twig/tree.twig +++ b/themes/default/twig/tree.twig @@ -26,14 +26,14 @@ {% endif %} {% if app.show_http_remote %} - + {% endif %}
{% if app.show_ssh_remote %} - + {% endif %} {% if app.show_http_remote %} - + {% endif %}