mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-15 23:00:57 +00:00
View File History
This commit is contained in:
@@ -20,6 +20,7 @@ urlpatterns = patterns('',
|
||||
url(r'^repos/(?P<repo_id>[-0-9a-f]{36})/upload-blks-link/$', UploadBlksLinkView.as_view()),
|
||||
url(r'^repos/(?P<repo_id>[-0-9a-f]{36})/update-blks-link/$', UpdateBlksLinkView.as_view()),
|
||||
url(r'^repos/(?P<repo_id>[-0-9-a-f]{36})/file/$', FileView.as_view(), name='FileView'),
|
||||
url(r'^repos/(?P<repo_id>[-0-9-a-f]{36})/file/history/$', FileHistory.as_view()),
|
||||
url(r'^repos/(?P<repo_id>[-0-9-a-f]{36})/file/shared-link/$', FileSharedLinkView.as_view()),
|
||||
url(r'^repos/(?P<repo_id>[-0-9-a-f]{36})/dir/$', DirView.as_view(), name='DirView'),
|
||||
url(r'^starredfiles/', StarredFileView.as_view(), name='starredfiles'),
|
||||
|
@@ -1127,6 +1127,26 @@ class FileView(APIView):
|
||||
|
||||
return reloaddir_if_neccessary(request, repo_id, parent_dir)
|
||||
|
||||
class FileHistory(APIView):
|
||||
authentication_classes = (TokenAuthentication, )
|
||||
permission_classes = (IsAuthenticated,)
|
||||
throttle_classes = (UserRateThrottle, )
|
||||
|
||||
def get(self, request, repo_id, format=None):
|
||||
path = request.GET.get('p', None)
|
||||
assert path, 'path must be passed in the url'
|
||||
|
||||
try:
|
||||
commits = seafserv_threaded_rpc.list_file_revisions(repo_id, path,
|
||||
-1, -1)
|
||||
except SearpcError, e:
|
||||
return api_error(status.HTTP_400_BAD_REQUEST, 'Server error')
|
||||
|
||||
if not commits:
|
||||
return api_error(status.HTTP_404_NOT_FOUND, 'File not found.')
|
||||
|
||||
return HttpResponse(json.dumps({"commits": commits}, cls=SearpcObjEncoder), status=200, content_type=json_content_type)
|
||||
|
||||
class FileSharedLinkView(APIView):
|
||||
"""
|
||||
Support uniform interface for file shared link.
|
||||
|
Reference in New Issue
Block a user