# HG changeset patch # User Alexis S. L. Carvalho # Date 1171536692 7200 # Node ID 51e52db6b40d4d4f459d36e2aa3e92eae986c625 # Parent 33c369afec947c67f69ae56b980a45929d166976 hgweb: allow static files to be served directly by the HTTP server diff -r 33c369afec94 -r 51e52db6b40d doc/hgrc.5.txt --- a/doc/hgrc.5.txt Wed Feb 14 15:20:06 2007 -0700 +++ b/doc/hgrc.5.txt Thu Feb 15 08:51:32 2007 -0200 @@ -507,6 +507,11 @@ push_ssl;; Whether to require that inbound pushes be transported over SSL to prevent password sniffing. Default is true. + staticurl;; + Base URL to use for static files. If unset, static files (e.g. + the hgicon.png favicon) will be served by the CGI script itself. + Use this setting to serve them directly with the HTTP server. + Example: "http://hgserver/static/" stripes;; How many lines a "zebra stripe" should span in multiline output. Default is 1; set to 0 to disable. diff -r 33c369afec94 -r 51e52db6b40d mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py Wed Feb 14 15:20:06 2007 -0700 +++ b/mercurial/hgweb/hgweb_mod.py Thu Feb 15 08:51:32 2007 -0200 @@ -772,6 +772,9 @@ port = req.env["SERVER_PORT"] port = port != "80" and (":" + port) or "" urlbase = 'http://%s%s' % (req.env['SERVER_NAME'], port) + staticurl = self.config("web", "staticurl") or req.url + 'static/' + if not staticurl.endswith('/'): + staticurl += '/' if not self.reponame: self.reponame = (self.config("web", "name") @@ -780,6 +783,7 @@ self.t = templater.templater(mapfile, templater.common_filters, defaults={"url": req.url, + "staticurl": staticurl, "urlbase": urlbase, "repo": self.reponame, "header": header, diff -r 33c369afec94 -r 51e52db6b40d mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py Wed Feb 14 15:20:06 2007 -0700 +++ b/mercurial/hgweb/hgwebdir_mod.py Thu Feb 15 08:51:32 2007 -0200 @@ -88,6 +88,10 @@ if not url.endswith('/'): url += '/' + staticurl = config('web', 'staticurl') or url + 'static/' + if not staticurl.endswith('/'): + staticurl += '/' + style = self.style if style is None: style = config('web', 'style', '') @@ -98,7 +102,8 @@ defaults={"header": header, "footer": footer, "motd": motd, - "url": url}) + "url": url, + "staticurl": staticurl}) def archivelist(ui, nodeid, url): allowed = ui.configlist("web", "allow_archive", untrusted=True) diff -r 33c369afec94 -r 51e52db6b40d templates/gitweb/header.tmpl --- a/templates/gitweb/header.tmpl Wed Feb 14 15:20:06 2007 -0700 +++ b/templates/gitweb/header.tmpl Thu Feb 15 08:51:32 2007 -0200 @@ -4,7 +4,7 @@ - + - + diff -r 33c369afec94 -r 51e52db6b40d templates/header.tmpl --- a/templates/header.tmpl Wed Feb 14 15:20:06 2007 -0700 +++ b/templates/header.tmpl Thu Feb 15 08:51:32 2007 -0200 @@ -3,6 +3,6 @@ - + - +