Skip to content

Commit

Permalink
Add a favicon to the web ui. I went with the one from www.ampproject.org
Browse files Browse the repository at this point in the history
. (#3238)

Also very slightly simplified the location for webcomponents-lite.js in
  the appengine app.
  • Loading branch information
powdercloud committed May 17, 2016
1 parent 1dd0d74 commit a382ca8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
4 changes: 1 addition & 3 deletions validator/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,8 @@ def CreateWebuiAppengineDist(out_dir):
f for f in files
if not os.path.isdir(os.path.join(d, f)) and
os.path.splitext(f)[1] != '.html'])
webcomponents_out = os.path.join(out_dir, 'webcomponents-lite')
os.mkdir(webcomponents_out)
shutil.copyfile('node_modules/webcomponents-lite/webcomponents-lite.js',
os.path.join(webcomponents_out, 'webcomponents-lite.js'))
os.path.join(webui_out, 'webcomponents-lite.js'))
logging.info('... success')


Expand Down
10 changes: 10 additions & 0 deletions validator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,16 @@ function serve(port, validatorScript) {
return;
}
//
// Handle '/amp_favicon.png'
//
if (request.url == '/amp_favicon.png') {
const contents = fs.readFileSync(
path.join(__dirname, 'webui/amp_favicon.png'), 'binary');
response.writeHead(200, {'Content-Type': 'image/png'});
response.end(contents, 'binary');
return;
}
//
// Handle fetch?, a request to fetch an arbitrary doc from the
// internet. It presents the results as JSON.
//
Expand Down
Binary file added validator/webui/amp_favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions validator/webui/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,9 @@ handlers:
upload: polymer/.*\.html$

- url: /webcomponents-lite.js$
static_files: webcomponents-lite/webcomponents-lite.js
upload: webcomponents-lite/webcomponents-lite\.js$
static_files: webcomponents-lite.js
upload: webcomponents-lite\.js$

- url: /amp_favicon.png$
static_files: amp_favicon.png
upload: amp_favicon\.png$
1 change: 1 addition & 0 deletions validator/webui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<title>The AMP Validator</title>
<meta charset="utf-8"/>
<link rel="shortcut icon" href="/amp_favicon.png">
<script src="webcomponents-lite.js"></script>
<link rel="import" href="/pm/iron-collapse/iron-collapse.html">
<link rel="import" href="/pm/iron-flex-layout/iron-flex-layout.html">
Expand Down

0 comments on commit a382ca8

Please sign in to comment.