Browse Source

Added support for user specific clone urls

pull/24/head
Teknikode 8 years ago
parent
commit
a6885cd1db
  1. 4
      git/index.php
  2. 3
      git/src/GitList/Application.php
  3. 2
      git/views/tree.twig

4
git/index.php

@ -35,6 +35,7 @@ if (!is_writable(__DIR__ . DIRECTORY_SEPARATOR . 'cache')) { @@ -35,6 +35,7 @@ if (!is_writable(__DIR__ . DIRECTORY_SEPARATOR . 'cache')) {
require 'vendor/autoload.php';
$config = GitList\Config::fromFile('config.ini');
$config->set('app', 'clone_url', 'ssh://git@teknik.io:');
if ($_GET['user'])
{
if ($userTools->checkUsernameExists($_GET['user']))
@ -44,7 +45,8 @@ if ($_GET['user']) @@ -44,7 +45,8 @@ if ($_GET['user'])
$_SERVER['HTTP_X_ORIGINAL_URL'] = str_replace("/u/".$_GET['user'], "", $_SERVER['HTTP_X_ORIGINAL_URL']);
$config->set('git', 'repositories', array('G:\\Repositories\\u\\'.$_GET['user']));
$config->set('git', 'hidden', array(''));
$config->set('app', 'path_prefix', '/u/'.$_GET['user']);
$config->set('app', 'path_prefix', 'u/'.$_GET['user']);
$config->set('app', 'clone_url', 'ssh://git@teknik.io:u/'.$_GET['user'].'/');
$app = require 'boot.php';
$app->run();
}

3
git/src/GitList/Application.php

@ -32,7 +32,8 @@ class Application extends SilexApplication @@ -32,7 +32,8 @@ class Application extends SilexApplication
$this['debug'] = $config->get('app', 'debug');
$this['filetypes'] = $config->getSection('filetypes');
$this['cache.archives'] = $this->getCachePath() . 'archives';
$this['path_prefix'] = $config->get('app', 'path_prefix');
$this['path_prefix'] = '/'.$config->get('app', 'path_prefix');
$this['clone_url'] = $config->get('app', 'clone_url');
// Register services
$this->register(new TwigServiceProvider(), array(

2
git/views/tree.twig

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
{% block extra %}
<div class="pull-right">
<div class="btn-group download-buttons">
<a href="ssh://git@teknik.io:{{ repo }}" class="btn btn-default btn-xs" title="Clone '{{ repo }}'"><span class="fa fa-cloud-download"></span> Clone</a>
<a href="{{ app.clone_url }}{{ repo }}" class="btn btn-default btn-xs" title="Clone '{{ repo }}'"><span class="fa fa-cloud-download"></span> Clone</a>
<a href="{{ app.path_prefix }}{{ path('archive', {repo: repo, branch: branch, format: 'zip'}) }}" class="btn btn-default btn-xs" title="Download '{{ branch }}' as a ZIP archive">ZIP</a>
<a href="{{ app.path_prefix }}{{ path('archive', {repo: repo, branch: branch, format: 'tar'}) }}" class="btn btn-default btn-xs" title="Download '{{ branch }}' as a TAR archive">TAR</a>
</div>

Loading…
Cancel
Save