]>
vault307.fbx.one Git - esp32Cam.git/blob - html.py
1 # The MIT License (MIT)
3 # Copyright (c) Sharil Tumin
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to deal
7 # in the Software without restriction, including without limitation the rights
8 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 # copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
12 # The above copyright notice and this permission notice shall be included in
13 # all copies or substantial portions of the Software.
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 #-----------------------------------------------------------------------------
24 # html.py MVC - This is the view V of MVC
27 # URL: /webcam -> /live, /snap -> /foto, /blitz -> /boto
28 'foto':'''<!DOCTYPE html>
31 <title>ESP32 Camera</title>
32 <link rel="icon" href="data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAA=">
35 <div style="display:flex; margin-top: 15%%; justify-content:center; align-items:center; height:600px;">
36 <img src="%s" style="height:100%%; transform:rotate(%sdeg);"/>
41 'favicon':'''<!DOCTYPE html>
44 <link rel="icon" href="data:image/gif;base64,R0lGODlhAQABAAAAACwAAAAAAQABAAA=">
50 'err':'''Sorry, I can not do that.
52 'none':'''Sorry, nothing there.
54 'no': '''Sorry, unauthorized.
61 # start page for streaming
62 # URL: /webcam, /snap, /blitz
63 'foto': """HTTP/1.1 200 OK
64 Content-Type: text/html; charset=utf-8
66 Content-Length: %d""",
69 'stream': """HTTP/1.1 200 OK
70 Content-Type: multipart/x-mixed-replace; boundary=frame
71 Connection: keep-alive
72 Cache-Control: no-cache, no-store, max-age=0, must-revalidate
73 Expires: Thu, Jan 01 1970 00:00:00 GMT
78 Content-Type: image/jpeg""",
81 'pix': """HTTP/1.1 200 OK
82 Content-Type: image/jpeg
83 Content-Length: %d""",
85 'pic': """HTTP/1.1 200 OK
86 Content-Type: image/jpeg""",
89 'none': """HTTP/1.1 400 Bad Request
90 Content-Type: text/plain; charset=utf-8
92 Content-Length: %d""",
94 'favicon': """HTTP/1.1 200 OK
95 Content-Type: text/html; charset=utf-8
97 Cache-Control: max-age=2592000, public
98 Content-Length: %d""",
101 'err': """HTTP/1.1 400 Bad Request
102 Content-Type: text/plain; charset=utf-8
104 Content-Length: %d""",
107 'OK': """HTTP/1.1 200 OK
108 Content-Type: text/plain; charset=utf-8
110 Content-Length: %d""",
112 # URL: not authenticated
113 'NO': """HTTP/1.1 401 Unauthorized
114 Content-Type: text/plain; charset=utf-8
116 Content-Length: %d""",