增加高压空闲调节

This commit is contained in:
2026-06-10 11:23:24 +08:00
parent ee45729b5b
commit d44140d999
123 changed files with 22413 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

+43
View File
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang=fr>
<head>
<meta charset="UTF-8" />
<title>MicroWebSrv2</title>
<link rel="stylesheet" href="style.css" />
</head>
<body style="padding: 0 70px;">
<h1>&lt; MicroWebSrv2 /&gt;</h1>
<h2>About</h2>
<p>
This project follows the embedded <a href="https://github.com/jczic/MicroWebSrv">MicroWebSrv</a>,
which is mainly used on microcontrollers such as Pycom, ESP32 and STM32 on Pyboards.<br />
<br />
In a need for scalability and to meet the IoT universe, <b>microWebSrv2</b> was developed as a new project
and has been completely redesigned to be much more robust and efficient that its predecessor.<br />
<br />
Internal mechanisms works <b>directly at I/O level</b>, are fully asynchronous from end to end, and manages the memory in a highly optimized way.
Also, architecture makes its integration very easy and the source code, <b>MIT licensed</b>, remains really small.<br />
<br />
</p>
<ul>
<li><a href="test-redir">Test a redirection</a></li>
<li><a href="test-post">Test a POST form</a></li>
<li><a href="wstest.html">Test the WebSockets page</a></li>
<li><a href="wschat.html">Test the multi-users chat page</a></li>
<li><a href="test.pyhtml">Test a pyhtml template page</a></li>
</ul>
<br />
<hr />
<br />
<div style="text-align: center">
<img src="pdf.png" />
<p>
View a « <a href="test.pdf">PDF file</a> »
</p>
</div>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

+44
View File
@@ -0,0 +1,44 @@
html, body {
margin: 0;
padding: 0;
}
body {
margin: 30px;
background-color: white;
font-family: "Trebuchet MS", Verdana, sans-serif;
letter-spacing: 2px;
}
h1 {
color: #D35F8D;
text-align: center;
}
h2 {
color: #5FA3D3;
padding-left: 15px;
}
p, ul, li, td {
color: black;
}
a:link {
color: green;
text-decoration: underline;
}
a:visited {
color: gray;
}
a:hover {
color: red;
text-decoration: none;
}
a:active, a:focus {
color: red;
}
.sep {
margin: 15px 0;
height: 3px;
background-color: #5FA3D3;
}
.label {
color: #D35F8D;
font-weight: bold;
}
Binary file not shown.
+133
View File
@@ -0,0 +1,133 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>MicroWebSrv2 - PyhtmlTemplate Module</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
{{ py }}
import sys
global Toto
try :
Toto += 1
except :
Toto = 1
{{ end }}
<h1>MicroWebSrv2 - PyhtmlTemplate Module</h1>
<div class="sep"></div>
Platform: {{ sys.platform }} <br />
Version: {{ sys.version }} <br />
<div class="sep"></div>
Global var "TestVar" : <span class="label">{{ TestVar }}</span><br />
* Set from the main program.
<div class="sep"></div>
Global var "Toto" : <span class="label">{{ Toto }}</span><br />
* Refresh this page to see this variable changing.
<div class="sep"></div>
{{ py }}
print('Unescaped HTML: <strong><u>Okay</u></strong>')
{{ end }}
<div class="sep"></div>
Your address:<br />
<ul>
<li> IP = {{ Request.UserAddress[0] }} </li>
<li> Port = {{ Request.UserAddress[1] }} </li>
</ul>
<div class="sep"></div>
{{ if 'CHROME' in Request.UserAgent.upper() }}
You are on <span class="label">Chrome</span> browser.
{{ elif 'FIREFOX' in Request.UserAgent.upper() }}
You are on <span class="label">Firefox</span> browser.
{{ else }}
You are not on Chrome or Firefox browser.
{{ end }}
<div class="sep"></div>
You are in SSL: {{ Request.IsSSL }}<br />
<div class="sep"></div>
Your host: {{ Request.Host }}<br />
<div class="sep"></div>
Requested path: {{ Request.Path }}<br />
<div class="sep"></div>
Your query params:
{{ if not Request.QueryParams }}
<a href="?question=How are you?&answer=I'm fine!">
Test query string on this page.
</a>
{{ else }}
<ul>
{{ for param in Request.QueryParams }}
<li>Param "{{ param }}" = "{{ Request.QueryParams[param] }}"</li>
{{ end }}
</ul>
{{ end }}
<div class="sep"></div>
Accepted content types:
<ul>
{{ for accept in Request.Accept }}
<li>{{ accept }}</li>
{{ end }}
</ul>
<div class="sep"></div>
Accepted encodings:
<ul>
{{ for encoding in Request.AcceptEncodings }}
<li>{{ encoding }}</li>
{{ end }}
</ul>
<div class="sep"></div>
Accepted languages:
<ul>
{{ for language in Request.AcceptLanguages }}
<li>{{ language }}</li>
{{ end }}
</ul>
<div class="sep"></div>
Your request is keep-alive: {{ Request.IsKeepAlive }}<br />
<div class="sep"></div>
Your user agent:<br />
{{ Request.UserAgent }}
<div class="sep"></div>
</body>
</html>
+124
View File
@@ -0,0 +1,124 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>MicroWebSrv2 - WS Chat</title>
<link rel="stylesheet" href="style.css" />
</head>
<style>
.chat-zone {
height : 350px;
padding: 10px;
background-color: #304050;
font: 15px monospace;
color: white;
overflow: scroll;
}
#input-chat {
height: 40px;
border: 0px;
padding: 0px 10px;
outline: none;
border-top: 1px solid white;
background-color: #304050;
font: 15px monospace;
letter-spacing: 2px;
color: white;
}
input {
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
width: 100%;
margin-top: 3px;
border: 2px solid #5FA3D3;
}
</style>
<script language="javascript">
function init()
{
var scheme
if (window.location.protocol == 'https:')
scheme = 'wss:';
else
scheme = 'ws:';
var wsUri = scheme + '//' + window.location.hostname + '/wschat';
writeLineToChat("Connection to " + wsUri + "...")
websocket = new WebSocket(wsUri);
websocket.onopen = function(evt) { onOpen (evt) };
websocket.onclose = function(evt) { onClose (evt) };
websocket.onmessage = function(evt) { onMessage (evt) };
websocket.onerror = function(evt) { onError (evt) };
getElmById("input-chat").addEventListener("keyup", onChatLine);
getElmById("input-chat").focus()
}
function getElmById(id) {
return document.getElementById(id);
}
function writeLineToChat(line)
{
var elm = getElmById('chat');
if (elm)
{
var lineElm = document.createElement('div');
if (line) {
var time = new Date().toLocaleTimeString();
lineElm.innerText = "[" + time + "] " + line;
}
else
lineElm.innerHTML = '&nbsp;';
elm.appendChild(lineElm);
elm.scrollTop = elm.scrollHeight;
}
}
function onOpen(evt)
{
writeLineToChat("[CONNECTED]")
}
function onClose(evt)
{
writeLineToChat("[CONNECTION CLOSED]")
}
function onMessage(evt)
{
writeLineToChat(evt.data)
}
function onError(evt)
{
writeLineToChat("[CONNECTION ERROR]")
}
function onChatLine(e) {
key = (e.key || e.keyCode);
if (key === 13 || key.toUpperCase() === "ENTER") {
input = getElmById("input-chat");
line = input.value.trim();
input.value = "";
if (line.length > 0)
websocket.send(line);
}
}
window.addEventListener("load", init, false);
</script>
<body>
<h1>MicroWebSrv2 - WS Chat</h1>
<div id="chat" class="chat-zone">
</div>
<input id="input-chat" type="text" />
</body>
</html>
+92
View File
@@ -0,0 +1,92 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>MicroWebSrv2 - WebSockets Module</title>
<link rel="stylesheet" href="style.css" />
</head>
<script language="javascript">
var output;
function init()
{
output = document.getElementById("output");
testWebSocket();
}
function testWebSocket()
{
var scheme, defaultPort
if (window.location.protocol == 'https:')
{
scheme = 'wss:';
defaultPort = 443;
}
else
{
scheme = 'ws:';
defaultPort = 80;
}
var wsUri = scheme + '//' + window.location.hostname;
if (window.location.port !== defaultPort)
wsUri += ':' + window.location.port;
writeToScreen("Connecting to " + wsUri + "...")
websocket = new WebSocket(wsUri);
websocket.onopen = function(evt) { onOpen (evt) };
websocket.onclose = function(evt) { onClose (evt) };
websocket.onmessage = function(evt) { onMessage (evt) };
websocket.onerror = function(evt) { onError (evt) };
}
function onOpen(evt)
{
writeToScreen("<strong>-- CONNECTED --</strong>");
SendMsg("Hello world :)");
SendMsg("This is a WebSocket test");
SendMsg("(with a text frame encoded in UTF-8)");
setTimeout( function() { websocket.close() }, 3000 )
}
function onClose(evt)
{
writeToScreen("<strong>-- DISCONNECTED --</strong>");
}
function onMessage(evt)
{
writeToScreen('MSG FROM SERVER : <span style="color: blue;">' + evt.data + '</span>');
}
function onError(evt)
{
writeToScreen('ERROR : <span style="color: red;">' + evt.data + '</span>');
}
function SendMsg(msg)
{
writeToScreen('MSG TO SERVER : <span style="color: green;">' + msg + '</span>');
websocket.send(msg);
}
function writeToScreen(s)
{
var pre = document.createElement("p");
pre.style.wordWrap = "break-word";
pre.innerHTML = s;
output.appendChild(pre);
}
window.addEventListener("load", init, false);
</script>
<body>
<h1>MicroWebSrv2 - WebSockets Module</h1>
<div id="output"></div>
</body>
</html>