mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-17 19:20:56 +01:00
Merge pull request #710 from cleverer/clone-button
Extends clone button options
This commit is contained in:
@@ -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']
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -28,14 +28,14 @@
|
||||
<button type="button" class="btn btn-default{{ app.show_ssh_remote and app.show_http_remote ? ' active' }}" id="clone-button-ssh">SSH</button>
|
||||
{% endif %}
|
||||
{% if app.show_http_remote %}
|
||||
<button type="button" class="btn btn-default" id="clone-button-http">HTTPS</button>
|
||||
<button type="button" class="btn btn-default" id="clone-button-http">HTTP{{ app.use_https ? 'S' }}</button>
|
||||
{% endif %}
|
||||
</div><br />
|
||||
{% if app.show_ssh_remote %}
|
||||
<input type="text" class="form-control{{ app.show_ssh_remote ? ' visible' }}" id="clone-input-ssh" value="git clone {{ app.ssh_user }}@{{ app.request.host }}:{{ repo }}">
|
||||
<input type="text" class="form-control{{ app.show_ssh_remote ? ' visible' }}" id="clone-input-ssh" value="git clone {{ app.ssh_user }}{{ app.ssh_user ? '@' }}{{ app.ssh_host ? app.ssh_host : app.request.host }}:{{ app.ssh_url_subdir }}{{ repo }}">
|
||||
{% endif %}
|
||||
{% if app.show_http_remote %}
|
||||
<input type="text" class="form-control{{ app.show_ssh_remote is empty and app.show_http_remote ? ' visible' }}" id="clone-input-http" value="git clone http{{ app.use_https ? 's' }}://{{ app.http_user }}{{ app.http_user ? '@' }}{{ app.request.host }}/{{ app.url_subdir }}{{ repo }}">
|
||||
<input type="text" class="form-control{{ app.show_ssh_remote is empty and app.show_http_remote ? ' visible' }}" id="clone-input-http" value="git clone http{{ app.use_https ? 's' }}://{{ app.http_user }}{{ app.http_user ? '@' }}{{ app.http_host ? app.http_host : app.request.host }}/{{ app.http_url_subdir }}{{ repo }}">
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -26,14 +26,14 @@
|
||||
<button class="btn{{ app.show_ssh_remote and app.show_http_remote ? ' active' }}" id="clone-button-ssh">SSH</button>
|
||||
{% endif %}
|
||||
{% if app.show_http_remote %}
|
||||
<button class="btn" id="clone-button-http">HTTPS</button>
|
||||
<button class="btn" id="clone-button-http">HTTP{{ app.use_https ? 'S' }}</button>
|
||||
{% endif %}
|
||||
</div><br />
|
||||
{% if app.show_ssh_remote %}
|
||||
<input type="text" class="form-control{{ app.show_ssh_remote ? ' visible' }}" id="clone-input-ssh" value="git clone {{ app.ssh_user }}@{{ app.request.host }}:{{ repo }}">
|
||||
<input type="text" class="form-control{{ app.show_ssh_remote ? ' visible' }}" id="clone-input-ssh" value="git clone {{ app.ssh_user }}{{ app.ssh_user ? '@' }}{{ app.ssh_host ? app.ssh_host : app.request.host }}:{{ app.ssh_url_subdir }}{{ repo }}">
|
||||
{% endif %}
|
||||
{% if app.show_http_remote %}
|
||||
<input type="text" class="form-control{{ app.show_ssh_remote is empty and app.show_http_remote ? ' visible' }}" id="clone-input-http" value="git clone http{{ app.use_https ? 's' }}://{{ app.http_user }}{{ app.http_user ? '@' }}{{ app.request.host }}/{{ app.url_subdir }}{{ repo }}">
|
||||
<input type="text" class="form-control{{ app.show_ssh_remote is empty and app.show_http_remote ? ' visible' }}" id="clone-input-http" value="git clone http{{ app.use_https ? 's' }}://{{ app.http_user }}{{ app.http_user ? '@' }}{{ app.http_host ? app.http_host : app.request.host }}/{{ app.http_url_subdir }}{{ repo }}">
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user