##// END OF EJS Templates
hgweb: allow static files to be served directly by the HTTP server
Alexis S. L. Carvalho -
r4084:51e52db6 default
parent child Browse files
Show More
@@ -507,6 +507,11 b' web::'
507 507 push_ssl;;
508 508 Whether to require that inbound pushes be transported over SSL to
509 509 prevent password sniffing. Default is true.
510 staticurl;;
511 Base URL to use for static files. If unset, static files (e.g.
512 the hgicon.png favicon) will be served by the CGI script itself.
513 Use this setting to serve them directly with the HTTP server.
514 Example: "http://hgserver/static/"
510 515 stripes;;
511 516 How many lines a "zebra stripe" should span in multiline output.
512 517 Default is 1; set to 0 to disable.
@@ -772,6 +772,9 b' class hgweb(object):'
772 772 port = req.env["SERVER_PORT"]
773 773 port = port != "80" and (":" + port) or ""
774 774 urlbase = 'http://%s%s' % (req.env['SERVER_NAME'], port)
775 staticurl = self.config("web", "staticurl") or req.url + 'static/'
776 if not staticurl.endswith('/'):
777 staticurl += '/'
775 778
776 779 if not self.reponame:
777 780 self.reponame = (self.config("web", "name")
@@ -780,6 +783,7 b' class hgweb(object):'
780 783
781 784 self.t = templater.templater(mapfile, templater.common_filters,
782 785 defaults={"url": req.url,
786 "staticurl": staticurl,
783 787 "urlbase": urlbase,
784 788 "repo": self.reponame,
785 789 "header": header,
@@ -88,6 +88,10 b' class hgwebdir(object):'
88 88 if not url.endswith('/'):
89 89 url += '/'
90 90
91 staticurl = config('web', 'staticurl') or url + 'static/'
92 if not staticurl.endswith('/'):
93 staticurl += '/'
94
91 95 style = self.style
92 96 if style is None:
93 97 style = config('web', 'style', '')
@@ -98,7 +102,8 b' class hgwebdir(object):'
98 102 defaults={"header": header,
99 103 "footer": footer,
100 104 "motd": motd,
101 "url": url})
105 "url": url,
106 "staticurl": staticurl})
102 107
103 108 def archivelist(ui, nodeid, url):
104 109 allowed = ui.configlist("web", "allow_archive", untrusted=True)
@@ -4,7 +4,7 b' Content-type: text/html; charset={encodi'
4 4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5 5 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
6 6 <head>
7 <link rel="icon" href="{url}static/hgicon.png" type="image/png">
7 <link rel="icon" href="{staticurl}hgicon.png" type="image/png">
8 8 <meta name="robots" content="index, nofollow"/>
9 <link rel="stylesheet" href="{url}static/style-gitweb.css" type="text/css" />
9 <link rel="stylesheet" href="{staticurl}style-gitweb.css" type="text/css" />
10 10
@@ -3,6 +3,6 b' Content-type: text/html; charset={encodi'
3 3 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 4 <html>
5 5 <head>
6 <link rel="icon" href="#url#static/hgicon.png" type="image/png">
6 <link rel="icon" href="#staticurl#hgicon.png" type="image/png">
7 7 <meta name="robots" content="index, nofollow" />
8 <link rel="stylesheet" href="#url#static/style.css" type="text/css" />
8 <link rel="stylesheet" href="#staticurl#style.css" type="text/css" />
General Comments 0
You need to be logged in to leave comments. Login now