From a47fc107172e956ad8326081d5e96ee43fc66d4b Mon Sep 17 00:00:00 2001 From: Nicolas Da Mutten Date: Sat, 7 Jan 2017 10:28:03 +0100 Subject: [PATCH 1/2] Extends clone button options Specifically adds option to define host for ssh and http, and allows to set subdir and dynamic user for ssh --- config.ini-example | 7 ++++++- src/Application.php | 7 +++++-- themes/bootstrap3/twig/tree.twig | 4 ++-- themes/default/twig/tree.twig | 4 ++-- 4 files changed, 15 insertions(+), 7 deletions(-) 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..1dec57c 100644 --- a/themes/bootstrap3/twig/tree.twig +++ b/themes/bootstrap3/twig/tree.twig @@ -32,10 +32,10 @@ {% 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..efeb79e 100644 --- a/themes/default/twig/tree.twig +++ b/themes/default/twig/tree.twig @@ -30,10 +30,10 @@ {% endif %}
{% if app.show_ssh_remote %} - + {% endif %} {% if app.show_http_remote %} - + {% endif %} From f6d4bed4cd2f8f1c6e2b78f5061c091acc6f4613 Mon Sep 17 00:00:00 2001 From: Nicolas Da Mutten Date: Sun, 8 Jan 2017 18:14:24 +0100 Subject: [PATCH 2/2] Fixes HTTP(S) label to represent SSL status --- themes/bootstrap3/twig/tree.twig | 2 +- themes/default/twig/tree.twig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/bootstrap3/twig/tree.twig b/themes/bootstrap3/twig/tree.twig index 1dec57c..6d81bbf 100644 --- a/themes/bootstrap3/twig/tree.twig +++ b/themes/bootstrap3/twig/tree.twig @@ -28,7 +28,7 @@ {% endif %} {% if app.show_http_remote %} - + {% endif %}
{% if app.show_ssh_remote %} diff --git a/themes/default/twig/tree.twig b/themes/default/twig/tree.twig index efeb79e..c7b21fb 100644 --- a/themes/default/twig/tree.twig +++ b/themes/default/twig/tree.twig @@ -26,7 +26,7 @@ {% endif %} {% if app.show_http_remote %} - + {% endif %}
{% if app.show_ssh_remote %}