##// 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 push_ssl;;
507 push_ssl;;
508 Whether to require that inbound pushes be transported over SSL to
508 Whether to require that inbound pushes be transported over SSL to
509 prevent password sniffing. Default is true.
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 stripes;;
515 stripes;;
511 How many lines a "zebra stripe" should span in multiline output.
516 How many lines a "zebra stripe" should span in multiline output.
512 Default is 1; set to 0 to disable.
517 Default is 1; set to 0 to disable.
@@ -772,6 +772,9 b' class hgweb(object):'
772 port = req.env["SERVER_PORT"]
772 port = req.env["SERVER_PORT"]
773 port = port != "80" and (":" + port) or ""
773 port = port != "80" and (":" + port) or ""
774 urlbase = 'http://%s%s' % (req.env['SERVER_NAME'], port)
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 if not self.reponame:
779 if not self.reponame:
777 self.reponame = (self.config("web", "name")
780 self.reponame = (self.config("web", "name")
@@ -780,6 +783,7 b' class hgweb(object):'
780
783
781 self.t = templater.templater(mapfile, templater.common_filters,
784 self.t = templater.templater(mapfile, templater.common_filters,
782 defaults={"url": req.url,
785 defaults={"url": req.url,
786 "staticurl": staticurl,
783 "urlbase": urlbase,
787 "urlbase": urlbase,
784 "repo": self.reponame,
788 "repo": self.reponame,
785 "header": header,
789 "header": header,
@@ -88,6 +88,10 b' class hgwebdir(object):'
88 if not url.endswith('/'):
88 if not url.endswith('/'):
89 url += '/'
89 url += '/'
90
90
91 staticurl = config('web', 'staticurl') or url + 'static/'
92 if not staticurl.endswith('/'):
93 staticurl += '/'
94
91 style = self.style
95 style = self.style
92 if style is None:
96 if style is None:
93 style = config('web', 'style', '')
97 style = config('web', 'style', '')
@@ -98,7 +102,8 b' class hgwebdir(object):'
98 defaults={"header": header,
102 defaults={"header": header,
99 "footer": footer,
103 "footer": footer,
100 "motd": motd,
104 "motd": motd,
101 "url": url})
105 "url": url,
106 "staticurl": staticurl})
102
107
103 def archivelist(ui, nodeid, url):
108 def archivelist(ui, nodeid, url):
104 allowed = ui.configlist("web", "allow_archive", untrusted=True)
109 allowed = ui.configlist("web", "allow_archive", untrusted=True)
@@ -4,7 +4,7 b' Content-type: text/html; charset={encodi'
4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
5 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
6 <head>
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 <meta name="robots" content="index, nofollow"/>
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 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <html>
4 <html>
5 <head>
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 <meta name="robots" content="index, nofollow" />
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