mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-22 16:56:57 +00:00
Change repo download url
This commit is contained in:
parent
83e50e29bc
commit
ecafd91884
@ -23,7 +23,7 @@
|
|||||||
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/">{{ repo.props.name }}</a></td>
|
<td><a href="{{ SITE_ROOT }}repo/{{ repo.props.id }}/">{{ repo.props.name }}</a></td>
|
||||||
<td>{{ repo.props.desc }}</td>
|
<td>{{ repo.props.desc }}</td>
|
||||||
<td>
|
<td>
|
||||||
<button data="{{ SITE_ROOT }}repo/download/{{ repo.props.id }}/" class="repo-download-btn">下载</button>
|
<button data="{{ SITE_ROOT }}repo/download/{{ repo.props.id }}/?repo_name={{ repo.props.name}}&enc={{ repo.props.encrypted}}" class="repo-download-btn">下载</button>
|
||||||
<button data="{{ repo.props.id }}" class="repo-share-btn">共享</button>
|
<button data="{{ repo.props.id }}" class="repo-share-btn">共享</button>
|
||||||
<button data="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/" class="repo-delete-btn">删除</button>
|
<button data="{{ SITE_ROOT }}repo/remove/{{ repo.props.id }}/" class="repo-delete-btn">删除</button>
|
||||||
</td>
|
</td>
|
||||||
|
14
views.py
14
views.py
@ -8,6 +8,7 @@ from auth.models import User
|
|||||||
from django.views.decorators.csrf import csrf_protect
|
from django.views.decorators.csrf import csrf_protect
|
||||||
from auth.forms import AuthenticationForm, PasswordResetForm, SetPasswordForm, PasswordChangeForm
|
from auth.forms import AuthenticationForm, PasswordResetForm, SetPasswordForm, PasswordChangeForm
|
||||||
from auth.tokens import default_token_generator
|
from auth.tokens import default_token_generator
|
||||||
|
from django.utils.http import urlquote
|
||||||
|
|
||||||
from seaserv import cclient, ccnet_rpc, get_groups, get_users, get_repos, \
|
from seaserv import cclient, ccnet_rpc, get_groups, get_users, get_repos, \
|
||||||
get_repo, get_commits, get_branches, \
|
get_repo, get_commits, get_branches, \
|
||||||
@ -382,11 +383,16 @@ def repo_list_share(request):
|
|||||||
@login_required
|
@login_required
|
||||||
def repo_download(request, repo_id):
|
def repo_download(request, repo_id):
|
||||||
relay_id = cclient.props.id
|
relay_id = cclient.props.id
|
||||||
token = 'default'
|
repo_name = request.GET.get('repo_name')
|
||||||
|
quote_repo_name = urlquote(repo_name)
|
||||||
|
encrypted = request.GET.get('enc')
|
||||||
|
enc = '1'
|
||||||
|
if cmp(encrypted,'False') == 0:
|
||||||
|
enc = ''
|
||||||
|
|
||||||
ccnet_applet_root = get_ccnetapplet_root()
|
ccnet_applet_root = get_ccnetapplet_root()
|
||||||
redirect_url = "%s/repo/download/?repo_id=%s&token=%s&relay_id=%s" % (
|
redirect_url = "%s/repo/download/?repo_id=%s&relay_id=%s&repo_name=%s&encrypted=%s" % (
|
||||||
ccnet_applet_root, repo_id, token, relay_id)
|
ccnet_applet_root, repo_id, relay_id, quote_repo_name, enc)
|
||||||
|
|
||||||
return HttpResponseRedirect(redirect_url)
|
return HttpResponseRedirect(redirect_url)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user