Skip to content

Commit

Permalink
Merge pull request #777 from welljsjs/master
Browse files Browse the repository at this point in the history
Added custom ssh port and fixed the base_path for cloning.
  • Loading branch information
klaussilveira authored May 21, 2018
2 parents 91be209 + b66692f commit eab6bc0
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion config.ini-example
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ 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_port = '' ; port to use for cloning via SSH (default: 22 => standard ssh port)
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']

Expand Down Expand Up @@ -54,4 +55,4 @@ http_user_dynamic = false ; when enabled, http_user is set to $_SERVER['PHP_AUTH
; custom avatar service
[avatar]
; url = '//gravatar.com/avatar/'
; query[] = 'd=identicon'
; query[] = 'd=identicon'
1 change: 1 addition & 0 deletions src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public function __construct(Config $config, $root = null)
$twig->addGlobal('ssh_user', $config->get('clone_button', 'ssh_user_dynamic') ? $_SERVER['PHP_AUTH_USER'] : $config->get('clone_button', 'ssh_user'));
$twig->addGlobal('ssh_url_subdir', $config->get('clone_button', 'ssh_url_subdir'));
$twig->addGlobal('ssh_host', $config->get('clone_button', 'ssh_host'));
$twig->addGlobal('ssh_port', $config->get('clone_button', 'ssh_port'));

return $twig;
}));
Expand Down
4 changes: 2 additions & 2 deletions themes/bootstrap3/twig/layout_page.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<div class="col-sm-12">
<div class="tab-border nav-tabs">
{% if page in ['commits', 'searchcommits'] %}
<form class="pull-right" action="{{ global.request.basepath }}/{{repo}}/commits/{{branch}}/search" method="POST">
<form class="pull-right" action="{{ app.request.basepath }}/{{repo}}/commits/{{branch}}/search" method="POST">
<input type="search" name="query" class="form-control input-sm" placeholder="Search commits...">
</form>
{% else %}
<form class="pull-right" action="{{ global.request.basepath }}/{{repo}}/tree/{{branch}}/search" method="POST">
<form class="pull-right" action="{{ app.request.basepath }}/{{repo}}/tree/{{branch}}/search" method="POST">
<input type="search" name="query" class="form-control input-sm" placeholder="Search tree...">
</form>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions themes/bootstrap3/twig/tree.twig
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
{% endif %}
</div><br />
{% if show_ssh_remote %}
<input type="text" class="form-control{{ show_ssh_remote ? ' visible' }}" id="clone-input-ssh" value="git clone {{ ssh_user }}{{ ssh_user ? '@' }}{{ ssh_host ? ssh_host : global.request.host }}:{{ ssh_url_subdir }}{{ repo }}">
<input type="text" class="form-control{{ show_ssh_remote ? ' visible' }}" id="clone-input-ssh" value="git clone {{ ssh_port ? 'ssh://' }}{{ ssh_user }}{{ ssh_user ? '@' }}{{ ssh_host ? ssh_host : app.request.host }}:{{ ssh_port ? ssh_port ~ '/' : '' }}{{ ssh_url_subdir }}{{ repo }}">
{% endif %}
{% if show_http_remote %}
<input type="text" class="form-control{{ show_ssh_remote is empty and show_http_remote ? ' visible' }}" id="clone-input-http" value="git clone http{{ use_https ? 's' }}://{{ http_user }}{{ http_user ? '@' }}{{ http_host ? http_host : global.request.host }}/{{ http_url_subdir }}{{ repo }}">
<input type="text" class="form-control{{ show_ssh_remote is empty and show_http_remote ? ' visible' }}" id="clone-input-http" value="git clone http{{ use_https ? 's' }}://{{ http_user }}{{ http_user ? '@' }}{{ http_host ? http_host : app.request.host }}/{{ http_url_subdir }}{{ repo }}">
{% endif %}
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions themes/default/twig/layout_page.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
<div class="row">
<div class="span12">
{% if page in ['commits', 'searchcommits'] %}
<form class="form-search pull-right" action="{{ global.request.basepath }}/{{repo}}/commits/{{branch}}/search" method="POST">
<form class="form-search pull-right" action="{{ app.request.basepath }}/{{repo}}/commits/{{branch}}/search" method="POST">
<input type="text" name="query" class="input-medium search-query" placeholder="Search commits..." value="{{ query | default("") }}">
</form>
{% else %}
<form class="form-search pull-right" action="{{ global.request.basepath }}/{{repo}}/tree/{{branch}}/search" method="POST">
<form class="form-search pull-right" action="{{ app.request.basepath }}/{{repo}}/tree/{{branch}}/search" method="POST">
<input type="text" name="query" class="input-medium search-query" placeholder="Search tree..." value="{{ query | default("") }}">
</form>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions themes/default/twig/tree.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
{% endif %}
</div><br />
{% if show_ssh_remote %}
<input type="text" class="form-control{{ show_ssh_remote ? ' visible' }}" id="clone-input-ssh" value="git clone {{ ssh_user }}{{ ssh_user ? '@' }}{{ ssh_host ? ssh_host : global.request.host }}:{{ ssh_url_subdir }}{{ repo }}">
<input type="text" class="form-control{{ show_ssh_remote ? ' visible' }}" id="clone-input-ssh" value="git clone {{ ssh_port ? 'ssh://' }}{{ ssh_user }}{{ ssh_user ? '@' }}{{ ssh_host ? ssh_host : app.request.host }}:{{ ssh_port ? ssh_port ~ '/' : '' }}{{ ssh_url_subdir }}{{ repo }}">
{% endif %}
{% if show_http_remote %}
<input type="text" class="form-control{{ show_ssh_remote is empty and show_http_remote ? ' visible' }}" id="clone-input-http" value="git clone http{{ use_https ? 's' }}://{{ http_user }}{{ http_user ? '@' }}{{ http_host ? http_host : global.request.host }}/{{ http_url_subdir }}{{ repo }}">
<input type="text" class="form-control{{ show_ssh_remote is empty and show_http_remote ? ' visible' }}" id="clone-input-http" value="git clone http{{ use_https ? 's' }}://{{ http_user }}{{ http_user ? '@' }}{{ http_host ? http_host : app.request.host }}/{{ http_url_subdir }}{{ repo }}">
{% endif %}
</div>
</div>
Expand Down

0 comments on commit eab6bc0

Please sign in to comment.