Add Coral logo, fonts, and initial css style.
Change-Id: If9af8459dc177931e575f48cfd21e4dcdc8992b9
diff --git a/edgetpuvision/streaming/assets/coral.css b/edgetpuvision/streaming/assets/coral.css
new file mode 100644
index 0000000..a4b2164
--- /dev/null
+++ b/edgetpuvision/streaming/assets/coral.css
@@ -0,0 +1,24 @@
+@font-face {
+ font-family: Lora-Regular;
+ src: url(fonts/Lora-Regular.ttf);
+}
+
+@font-face {
+ font-family: Roboto-Regular;
+ src: url(fonts/Roboto-Regular.ttf);
+}
+
+body {
+ padding-top:20px;
+ padding-left:20px;
+ font-family: Roboto-Regular;
+}
+
+h1 {
+ font-family: Lora-Regular;
+}
+
+a {
+ color:#006B68;
+ font-weight: bolder;
+}
diff --git a/edgetpuvision/streaming/assets/coral_logo.png b/edgetpuvision/streaming/assets/coral_logo.png
new file mode 100644
index 0000000..409640d
--- /dev/null
+++ b/edgetpuvision/streaming/assets/coral_logo.png
Binary files differ
diff --git a/edgetpuvision/streaming/assets/fonts/Lora-Regular.ttf b/edgetpuvision/streaming/assets/fonts/Lora-Regular.ttf
new file mode 100644
index 0000000..760d1ca
--- /dev/null
+++ b/edgetpuvision/streaming/assets/fonts/Lora-Regular.ttf
Binary files differ
diff --git a/edgetpuvision/streaming/assets/fonts/Roboto-Regular.ttf b/edgetpuvision/streaming/assets/fonts/Roboto-Regular.ttf
new file mode 100644
index 0000000..2c97eea
--- /dev/null
+++ b/edgetpuvision/streaming/assets/fonts/Roboto-Regular.ttf
Binary files differ
diff --git a/edgetpuvision/streaming/assets/index.html b/edgetpuvision/streaming/assets/index.html
index f727562..4d0c1d3 100644
--- a/edgetpuvision/streaming/assets/index.html
+++ b/edgetpuvision/streaming/assets/index.html
@@ -3,6 +3,7 @@
<head>
<title>Coral Web Panel</title>
<link rel="icon" type="image/png" sizes="16x16" href="favicon.png"/>
+ <link rel="stylesheet" type="text/css" href="coral.css">
<script type="text/javascript" src="protobuf.min.js"></script>
<script type="text/javascript" src="broadway/YUVCanvas.js"></script>
<script type="text/javascript" src="broadway/Decoder.js"></script>
@@ -10,6 +11,7 @@
<script type="text/javascript" src="ws_client.js"></script>
</head>
<body>
+ <img src="coral_logo.png" width="100em" style="padding-bottom:10px"/>
<div id="container"></div>
</body>
</html>
diff --git a/edgetpuvision/streaming/server.py b/edgetpuvision/streaming/server.py
index 00c6671..ff11517 100644
--- a/edgetpuvision/streaming/server.py
+++ b/edgetpuvision/streaming/server.py
@@ -62,6 +62,22 @@
except OSError:
pass
+def _file_content_type(path):
+ if path.endswith('.html'):
+ return 'text/html; charset=utf-8'
+ elif path.endswith('.js'):
+ return 'text/javascript; charset=utf-8'
+ elif path.endswith('.css'):
+ return 'text/css; charset=utf-8'
+ elif path.endswith('.png'):
+ return'image/png'
+ elif path.endswith('.jpg') or path.endswith('.jpeg'):
+ return'image/jpeg'
+ elif path.endswith('.wasm'):
+ return'application/wasm'
+ else:
+ return 'application/octet-stream'
+
def _read_asset(path):
if path == '/':
path = 'index.html'
@@ -74,18 +90,9 @@
if os.path.commonpath((base_path, asset_path)) != base_path:
return None, None
- if path.endswith('.html'):
- content_type = 'text/html; charset=utf-8'
- elif path.endswith('.js'):
- content_type = 'application/javascript; charset=utf-8'
- elif path.endswith('.wasm'):
- content_type = 'application/wasm'
- else:
- content_type = 'application/octet-stream'
-
try:
with open(asset_path, 'rb') as f:
- return f.read(), content_type
+ return f.read(), _file_content_type(path)
except Exception:
return None, None