Show More
@@ -53,6 +53,12 b' perms = {' | |||||
53 | 'pushkey': 'push', |
|
53 | 'pushkey': 'push', | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
|
56 | archivespecs = util.sortdict(( | |||
|
57 | ('zip', ('application/zip', 'zip', '.zip', None)), | |||
|
58 | ('gz', ('application/x-gzip', 'tgz', '.tar.gz', None)), | |||
|
59 | ('bz2', ('application/x-bzip2', 'tbz2', '.tar.bz2', None)), | |||
|
60 | )) | |||
|
61 | ||||
56 | def makebreadcrumb(url, prefix=''): |
|
62 | def makebreadcrumb(url, prefix=''): | |
57 | '''Return a 'URL breadcrumb' list |
|
63 | '''Return a 'URL breadcrumb' list | |
58 |
|
64 | |||
@@ -89,6 +95,8 b' class requestcontext(object):' | |||||
89 | self.repo = repo |
|
95 | self.repo = repo | |
90 | self.reponame = app.reponame |
|
96 | self.reponame = app.reponame | |
91 |
|
97 | |||
|
98 | self.archivespecs = archivespecs | |||
|
99 | ||||
92 | self.maxchanges = self.configint('web', 'maxchanges', 10) |
|
100 | self.maxchanges = self.configint('web', 'maxchanges', 10) | |
93 | self.stripecount = self.configint('web', 'stripes', 1) |
|
101 | self.stripecount = self.configint('web', 'stripes', 1) | |
94 | self.maxshortchanges = self.configint('web', 'maxshortchanges', 60) |
|
102 | self.maxshortchanges = self.configint('web', 'maxshortchanges', 60) | |
@@ -124,12 +132,6 b' class requestcontext(object):' | |||||
124 | return self.repo.ui.configlist(section, name, default, |
|
132 | return self.repo.ui.configlist(section, name, default, | |
125 | untrusted=untrusted) |
|
133 | untrusted=untrusted) | |
126 |
|
134 | |||
127 | archivespecs = util.sortdict(( |
|
|||
128 | ('zip', ('application/zip', 'zip', '.zip', None)), |
|
|||
129 | ('gz', ('application/x-gzip', 'tgz', '.tar.gz', None)), |
|
|||
130 | ('bz2', ('application/x-bzip2', 'tbz2', '.tar.bz2', None)), |
|
|||
131 | )) |
|
|||
132 |
|
||||
133 | def archivelist(self, nodeid): |
|
135 | def archivelist(self, nodeid): | |
134 | allowed = self.configlist('web', 'allow_archive') |
|
136 | allowed = self.configlist('web', 'allow_archive') | |
135 | for typ, spec in self.archivespecs.iteritems(): |
|
137 | for typ, spec in self.archivespecs.iteritems(): |
@@ -297,10 +297,10 b' class hgwebdir(object):' | |||||
297 | def archivelist(ui, nodeid, url): |
|
297 | def archivelist(ui, nodeid, url): | |
298 | allowed = ui.configlist("web", "allow_archive", untrusted=True) |
|
298 | allowed = ui.configlist("web", "allow_archive", untrusted=True) | |
299 | archives = [] |
|
299 | archives = [] | |
300 | for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]: |
|
300 | for typ, spec in hgweb_mod.archivespecs.iteritems(): | |
301 |
if |
|
301 | if typ in allowed or ui.configbool("web", "allow" + typ, | |
302 | untrusted=True): |
|
302 | untrusted=True): | |
303 |
archives.append({"type" : |
|
303 | archives.append({"type" : typ, "extension": spec[2], | |
304 | "node": nodeid, "url": url}) |
|
304 | "node": nodeid, "url": url}) | |
305 | return archives |
|
305 | return archives | |
306 |
|
306 |
General Comments 0
You need to be logged in to leave comments.
Login now