Compare commits
No commits in common. "1dc7434913b203f991f4a8a8fc183c3e7a90a8c1" and "fe274c7e5ea21e7d33ab055f5c11ec022096d925" have entirely different histories.
1dc7434913
...
fe274c7e5e
@ -1,3 +1,2 @@
|
||||
/*.gz
|
||||
/edit_gz
|
||||
/*.js.gz
|
||||
/.exclude.files
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -166,8 +166,7 @@ float t = 0;
|
||||
float h = 0;
|
||||
bool udht = false;
|
||||
bool heat_enabled_prev = false;
|
||||
bool ledState = LED_OFF;
|
||||
bool ledOut = LED_OFF;
|
||||
int ledState = LED_OFF;
|
||||
|
||||
struct EE_bl {
|
||||
byte memid; //here goes the EEMARK stamp
|
||||
@ -200,20 +199,6 @@ void readEE(){
|
||||
}
|
||||
}
|
||||
|
||||
void doOut(){
|
||||
if (ledOut != ledState){ // only if changed
|
||||
digitalWrite(ledPin, ledState); //consolidated here
|
||||
ledOut = ledState; //update
|
||||
if (ledState == LED_OFF){
|
||||
ws.textAll("led,ledoff");
|
||||
Serial.println(F("LED-OFF"));
|
||||
} else {
|
||||
ws.textAll("led,ledon");
|
||||
Serial.println(F("LED-ON"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void showTime()
|
||||
{
|
||||
byte tmpch = 0;
|
||||
@ -258,12 +243,14 @@ void showTime()
|
||||
}
|
||||
|
||||
if (heat_enabled_prev) { // smart control (delayed one cycle)
|
||||
if (((t + HYST) < ee.tempe)&&(ledState == LED_OFF)){ // OFF->ON once
|
||||
if (((t - HYST) < ee.tempe)&&(ledState == LED_OFF)) { // OFF->ON once
|
||||
ledState = LED_ON;
|
||||
digitalWrite(ledPin, ledState); // apply change
|
||||
ws.textAll("led,ledon");
|
||||
}
|
||||
if ((((t - HYST) > ee.tempe)&&(ledState == LED_ON))||(!heat_enabled)){ // ->OFF
|
||||
if ((((t + HYST) > ee.tempe)&&(ledState == LED_ON))||(!heat_enabled)) { // ON->OFF once, also turn off at end of period.
|
||||
ledState = LED_OFF;
|
||||
digitalWrite(ledPin, ledState); // apply change
|
||||
ws.textAll("led,ledoff");
|
||||
}
|
||||
|
||||
@ -295,6 +282,14 @@ void checkPhysicalButton()
|
||||
if (digitalRead(btnPin) == LOW) {
|
||||
if (btnState != LOW) { // btnState is used to avoid sequential toggles
|
||||
ledState = !ledState;
|
||||
digitalWrite(ledPin, ledState);
|
||||
if (ledState == LED_OFF) {
|
||||
ws.textAll("led,ledoff");
|
||||
Serial.println(F("LED-OFF"));
|
||||
} else {
|
||||
ws.textAll("led,ledon");
|
||||
Serial.println(F("LED-ON"));
|
||||
}
|
||||
}
|
||||
btnState = LOW;
|
||||
} else {
|
||||
@ -402,6 +397,7 @@ void onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventT
|
||||
ledState = LED_OFF;
|
||||
ws.textAll("led,ledoff");
|
||||
}
|
||||
digitalWrite(ledPin, ledState); // apply change
|
||||
|
||||
} else if(data[0] == 'T') { // timeset
|
||||
if (len > 11) {
|
||||
@ -492,7 +488,7 @@ void onWsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventT
|
||||
|
||||
void setup(){
|
||||
Serial.begin(115200);
|
||||
//Serial.setDebugOutput(true);
|
||||
Serial.setDebugOutput(true);
|
||||
|
||||
//Wifi
|
||||
#ifdef USE_WFM
|
||||
@ -549,6 +545,7 @@ void setup(){
|
||||
EEPROM.begin(EEALL);
|
||||
//EEPROM.get(EECH, memch); //current channel, no need
|
||||
readEE(); // populate structure if healthy
|
||||
digitalWrite(ledPin, ledState);
|
||||
Serial.printf("Timer set %02d:%02d - %02d:%02d\n", ee.hstart, ee.mstart, ee.hstop, ee.mstop);
|
||||
Serial.printf("Temp set %+2.1f\n", ee.tempe);
|
||||
|
||||
@ -676,22 +673,10 @@ void setup(){
|
||||
if(!request->authenticate(http_username, http_password)) return request->requestAuthentication();
|
||||
#endif
|
||||
request->onDisconnect([]() {
|
||||
WiFi.disconnect(true);
|
||||
#ifdef ESP32
|
||||
/*
|
||||
//https://github.com/espressif/arduino-esp32/issues/400#issuecomment-499631249
|
||||
//WiFi.disconnect(true); // doesn't work on esp32, below needs #include "esp_wifi.h"
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); //load the flash-saved configs
|
||||
esp_wifi_init(&cfg); //initiate and allocate wifi resources (does not matter if connection fails)
|
||||
if(esp_wifi_restore()!=ESP_OK){
|
||||
Serial.print(F("WiFi is not initialized by esp_wifi_init "));
|
||||
} else {
|
||||
Serial.print(F("WiFi Configurations Cleared!"));
|
||||
}
|
||||
*/
|
||||
WiFi.disconnect(true, true); // Works on esp32
|
||||
ESP.restart();
|
||||
#elif defined(ESP8266)
|
||||
WiFi.disconnect(true);
|
||||
ESP.reset();
|
||||
#endif
|
||||
});
|
||||
@ -745,6 +730,5 @@ void loop(){
|
||||
updateDHT();
|
||||
udht = false;
|
||||
}
|
||||
doOut();
|
||||
ArduinoOTA.handle();
|
||||
}
|
||||
|
@ -1,3 +1,2 @@
|
||||
/*.gz
|
||||
/edit_gz
|
||||
/.exclude.files
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -17,9 +17,6 @@ until a } is found on separate new line.
|
||||
``` npm install html-minifier-terser -g, npm install -g github-files-fetcher ```
|
||||
|
||||
### Batch files provided
|
||||
- **do_emb.bat:** Generates **edit.htm.gz.h** file for embedding to **SPIFFSEditor.cpp** as binary C array -
|
||||
You need to comment **#define EDFS** at **SPIFFSEditor.cpp** for this choice
|
||||
- **do_ed_fs.bat:** Alternatively, makes a gzip-ed **edit.htm** file for fs -
|
||||
uncomment **#define EDFS** for this choice. Saves about 4k of program flash storage.
|
||||
- **do.bat:** Generates **edit.htm.gz.h** file
|
||||
- **undo.bat:** Reverts **edit.htm** from C array header to file (still minified!)
|
||||
- **update_ace.bat:** Updates **acefull.js.gz** file from latest GitHub Ace sources
|
||||
|
@ -1,8 +1,6 @@
|
||||
copy ..\src\edit.htm edit_src.htm
|
||||
call html-minifier-terser --collapse-whitespace --remove-comments --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --minify-css true --minify-js true -o edit.htm edit_src.htm
|
||||
"C:\Program Files\7-Zip\7z.exe" a -tgzip -mx9 edit.htm.gz edit.htm
|
||||
del ..\examples\SmartSwitch\data\edit.htm
|
||||
del ..\examples\ESP_AsyncFSBrowser\data\edit.htm
|
||||
ehg edit.htm.gz PROGMEM
|
||||
copy edit.htm.gz.h ..\src\edit.htm.gz.h
|
||||
pause
|
@ -1,9 +0,0 @@
|
||||
copy ..\src\edit.htm edit_src.htm
|
||||
call html-minifier-terser --collapse-whitespace --remove-comments --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --minify-css true --minify-js true -o edit.htm edit_src.htm
|
||||
"C:\Program Files\7-Zip\7z.exe" a -tgzip -mx9 edit.htm.gz edit.htm
|
||||
copy edit.htm.gz ..\examples\SmartSwitch\data\edit_gz
|
||||
copy edit.htm.gz ..\examples\ESP_AsyncFSBrowser\data\edit_gz
|
||||
ehg edit.htm.gz PROGMEM
|
||||
copy edit.htm.gz.h ..\src\edit.htm.gz.h
|
||||
pause
|
||||
del edit.htm edit.htm.gz edit.htm.gz.h edit_src.htm
|
@ -4,7 +4,6 @@ REM fetcher --url=resource_url --out=output_directory
|
||||
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/ace.js" --out=tmp1
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/mode-html.js" --out=tmp1
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/mode-json.js" --out=tmp1
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/theme-monokai.js" --out=tmp1
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/ext-searchbox.js" --out=tmp1
|
||||
|
||||
@ -13,14 +12,12 @@ REM and do not take and include them below
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/worker-html.js" --out=tmp1
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/worker-css.js" --out=tmp1
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/worker-javascript.js" --out=tmp1
|
||||
call fetcher --url="https://github.com/ajaxorg/ace-builds/blob/master/src-min-noconflict/worker-json.js" --out=tmp1
|
||||
|
||||
cd tmp1
|
||||
type ace.js mode-html.js mode-json.js theme-monokai.js ext-searchbox.js > acefull.js
|
||||
type ace.js mode-html.js theme-monokai.js ext-searchbox.js > acefull.js
|
||||
"C:\Program Files\7-Zip\7z.exe" a -tgzip -mx9 acefull.js.gz acefull.js
|
||||
"C:\Program Files\7-Zip\7z.exe" a -tgzip -mx9 worker-html.js.gz worker-html.js
|
||||
"C:\Program Files\7-Zip\7z.exe" a -tgzip -mx9 worker-javascript.js.gz worker-javascript.js
|
||||
"C:\Program Files\7-Zip\7z.exe" a -tgzip -mx9 worker-json.js.gz worker-json.js
|
||||
"C:\Program Files\7-Zip\7z.exe" a -tgzip -mx9 worker-css.js.gz worker-css.js
|
||||
|
||||
REM update SmartSwitch /data:
|
||||
@ -28,7 +25,6 @@ pause
|
||||
copy acefull.js.gz ..\..\examples\SmartSwitch\data\acefull.js.gz
|
||||
copy worker-html.js.gz ..\..\examples\SmartSwitch\data\worker-html.js.gz
|
||||
copy worker-javascript.js.gz ..\..\examples\SmartSwitch\data\worker-javascript.js.gz
|
||||
copy worker-json.js.gz ..\..\examples\SmartSwitch\data\worker-json.js.gz
|
||||
copy worker-css.js.gz ..\..\examples\SmartSwitch\data\worker-css.js.gz
|
||||
|
||||
REM update ESP_AsyncFSBrowser /data:
|
||||
@ -36,7 +32,6 @@ pause
|
||||
copy acefull.js.gz ..\..\examples\ESP_AsyncFSBrowser\data\acefull.js.gz
|
||||
copy worker-html.js.gz ..\..\examples\ESP_AsyncFSBrowser\data\worker-html.js.gz
|
||||
copy worker-javascript.js.gz ..\..\examples\ESP_AsyncFSBrowser\data\worker-javascript.js.gz
|
||||
copy worker-json.js.gz ..\..\examples\ESP_AsyncFSBrowser\data\worker-json.js.gz
|
||||
copy worker-css.js.gz ..\..\examples\ESP_AsyncFSBrowser\data\worker-css.js.gz
|
||||
|
||||
REM delete temporary stuff
|
||||
|
@ -52,15 +52,11 @@ size_t webSocketSendFrameWindow(AsyncClient *client){
|
||||
}
|
||||
|
||||
size_t webSocketSendFrame(AsyncClient *client, bool final, uint8_t opcode, bool mask, uint8_t *data, size_t len){
|
||||
if(!client->canSend()) {
|
||||
// Serial.println("SF 1");
|
||||
if(!client->canSend())
|
||||
return 0;
|
||||
}
|
||||
size_t space = client->space();
|
||||
if(space < 2) {
|
||||
// Serial.println("SF 2");
|
||||
if(space < 2)
|
||||
return 0;
|
||||
}
|
||||
uint8_t mbuf[4] = {0,0,0,0};
|
||||
uint8_t headLen = 2;
|
||||
if(len && mask){
|
||||
@ -72,10 +68,8 @@ size_t webSocketSendFrame(AsyncClient *client, bool final, uint8_t opcode, bool
|
||||
}
|
||||
if(len > 125)
|
||||
headLen += 2;
|
||||
if(space < headLen) {
|
||||
// Serial.println("SF 2");
|
||||
if(space < headLen)
|
||||
return 0;
|
||||
}
|
||||
space -= headLen;
|
||||
|
||||
if(len > space) len = space;
|
||||
@ -83,7 +77,6 @@ size_t webSocketSendFrame(AsyncClient *client, bool final, uint8_t opcode, bool
|
||||
uint8_t *buf = (uint8_t*)malloc(headLen);
|
||||
if(buf == NULL){
|
||||
//os_printf("could not malloc %u bytes for frame header\n", headLen);
|
||||
// Serial.println("SF 3");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -104,7 +97,6 @@ size_t webSocketSendFrame(AsyncClient *client, bool final, uint8_t opcode, bool
|
||||
if(client->add((const char *)buf, headLen) != headLen){
|
||||
//os_printf("error adding %lu header bytes\n", headLen);
|
||||
free(buf);
|
||||
// Serial.println("SF 4");
|
||||
return 0;
|
||||
}
|
||||
free(buf);
|
||||
@ -117,16 +109,13 @@ size_t webSocketSendFrame(AsyncClient *client, bool final, uint8_t opcode, bool
|
||||
}
|
||||
if(client->add((const char *)data, len) != len){
|
||||
//os_printf("error adding %lu data bytes\n", len);
|
||||
// Serial.println("SF 5");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if(!client->send()){
|
||||
//os_printf("error sending frame: %lu\n", headLen+len);
|
||||
// Serial.println("SF 6");
|
||||
return 0;
|
||||
}
|
||||
// Serial.println("SF");
|
||||
return len;
|
||||
}
|
||||
|
||||
@ -160,7 +149,6 @@ AsyncWebSocketMessageBuffer::AsyncWebSocketMessageBuffer(uint8_t * data, size_t
|
||||
_data = new uint8_t[_len + 1];
|
||||
|
||||
if (_data) {
|
||||
// Serial.println("BUFF alloc");
|
||||
memcpy(_data, data, _len);
|
||||
_data[_len] = 0;
|
||||
}
|
||||
@ -176,7 +164,6 @@ AsyncWebSocketMessageBuffer::AsyncWebSocketMessageBuffer(size_t size)
|
||||
_data = new uint8_t[_len + 1];
|
||||
|
||||
if (_data) {
|
||||
// Serial.println("BUFF alloc");
|
||||
_data[_len] = 0;
|
||||
}
|
||||
|
||||
@ -198,7 +185,6 @@ AsyncWebSocketMessageBuffer::AsyncWebSocketMessageBuffer(const AsyncWebSocketMes
|
||||
}
|
||||
|
||||
if (_data) {
|
||||
// Serial.println("BUFF alloc");
|
||||
memcpy(_data, copy._data, _len);
|
||||
_data[_len] = 0;
|
||||
}
|
||||
@ -216,7 +202,6 @@ AsyncWebSocketMessageBuffer::AsyncWebSocketMessageBuffer(AsyncWebSocketMessageBu
|
||||
_count = 0;
|
||||
|
||||
if (copy._data) {
|
||||
// Serial.println("BUFF alloc");
|
||||
_data = copy._data;
|
||||
copy._data = nullptr;
|
||||
}
|
||||
@ -226,7 +211,6 @@ AsyncWebSocketMessageBuffer::AsyncWebSocketMessageBuffer(AsyncWebSocketMessageBu
|
||||
AsyncWebSocketMessageBuffer::~AsyncWebSocketMessageBuffer()
|
||||
{
|
||||
if (_data) {
|
||||
// Serial.println("BUFF free");
|
||||
delete[] _data;
|
||||
}
|
||||
}
|
||||
@ -309,7 +293,6 @@ AsyncWebSocketBasicMessage::AsyncWebSocketBasicMessage(const char * data, size_t
|
||||
_opcode = opcode & 0x07;
|
||||
_mask = mask;
|
||||
_data = (uint8_t*)malloc(_len+1);
|
||||
// Serial.println("MSG alloc");
|
||||
if(_data == NULL){
|
||||
_len = 0;
|
||||
_status = WS_MSG_ERROR;
|
||||
@ -333,43 +316,35 @@ AsyncWebSocketBasicMessage::AsyncWebSocketBasicMessage(uint8_t opcode, bool mask
|
||||
|
||||
|
||||
AsyncWebSocketBasicMessage::~AsyncWebSocketBasicMessage() {
|
||||
if(_data != NULL) {
|
||||
// Serial.println("MSG free");
|
||||
if(_data != NULL)
|
||||
free(_data);
|
||||
}
|
||||
}
|
||||
|
||||
void AsyncWebSocketBasicMessage::ack(size_t len, uint32_t time) {
|
||||
(void)time;
|
||||
_acked += len;
|
||||
// Serial.printf("ACK %u = %u | %u = %u\n", _sent, _len, _acked, _ack);
|
||||
if(_sent == _len && _acked == _ack){
|
||||
// Serial.println("ACK end");
|
||||
_status = WS_MSG_SENT;
|
||||
}
|
||||
}
|
||||
size_t AsyncWebSocketBasicMessage::send(AsyncClient *client) {
|
||||
if(_status != WS_MSG_SENDING){
|
||||
// Serial.println("MS 1");
|
||||
if(_status != WS_MSG_SENDING)
|
||||
return 0;
|
||||
}
|
||||
if(_acked < _ack){
|
||||
// Serial.println("MS 2");
|
||||
return 0;
|
||||
}
|
||||
if(_sent == _len){
|
||||
// Serial.println("MS 3");
|
||||
if(_acked == _ack)
|
||||
_status = WS_MSG_SENT;
|
||||
return 0;
|
||||
}
|
||||
if(_sent > _len){
|
||||
// Serial.println("MS 4");
|
||||
_status = WS_MSG_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t toSend = _len - _sent;
|
||||
size_t window = webSocketSendFrameWindow(client);
|
||||
// Serial.printf("Send %u %u %u\n", _len, _sent, toSend);
|
||||
|
||||
if(window < toSend) {
|
||||
toSend = window;
|
||||
@ -385,14 +360,8 @@ AsyncWebSocketBasicMessage::~AsyncWebSocketBasicMessage() {
|
||||
size_t sent = webSocketSendFrame(client, final, opCode, _mask, dPtr, toSend);
|
||||
_status = WS_MSG_SENDING;
|
||||
if(toSend && sent != toSend){
|
||||
size_t delta = (toSend - sent);
|
||||
// Serial.printf("\ns:%u a:%u d:%u\n", _sent, _ack, delta);
|
||||
_sent -= delta;
|
||||
_ack -= delta + ((delta < 126)?2:4) + (_mask * 4);
|
||||
// Serial.printf("s:%u a:%u\n", _sent, _ack);
|
||||
if (!sent) {
|
||||
_status = WS_MSG_ERROR;
|
||||
}
|
||||
_sent -= (toSend - sent);
|
||||
_ack -= (toSend - sent);
|
||||
}
|
||||
return sent;
|
||||
}
|
||||
@ -430,13 +399,11 @@ AsyncWebSocketMultiMessage::AsyncWebSocketMultiMessage(AsyncWebSocketMessageBuff
|
||||
if (buffer) {
|
||||
_WSbuffer = buffer;
|
||||
(*_WSbuffer)++;
|
||||
// Serial.printf("INC WSbuffer == %u\n", _WSbuffer->count());
|
||||
_data = buffer->get();
|
||||
_len = buffer->length();
|
||||
_status = WS_MSG_SENDING;
|
||||
//ets_printf("M: %u\n", _len);
|
||||
} else {
|
||||
// Serial.println("BUFF ERROR");
|
||||
_status = WS_MSG_ERROR;
|
||||
}
|
||||
|
||||
@ -446,48 +413,40 @@ AsyncWebSocketMultiMessage::AsyncWebSocketMultiMessage(AsyncWebSocketMessageBuff
|
||||
AsyncWebSocketMultiMessage::~AsyncWebSocketMultiMessage() {
|
||||
if (_WSbuffer) {
|
||||
(*_WSbuffer)--; // decreases the counter.
|
||||
// Serial.printf("DEC WSbuffer == %u\n", _WSbuffer->count());
|
||||
}
|
||||
}
|
||||
|
||||
void AsyncWebSocketMultiMessage::ack(size_t len, uint32_t time) {
|
||||
(void)time;
|
||||
_acked += len;
|
||||
// Serial.printf("ACK %u = %u | %u = %u\n", _sent, _len, _acked, _ack);
|
||||
if(_sent >= _len && _acked >= _ack){
|
||||
// Serial.println("ACK end");
|
||||
_status = WS_MSG_SENT;
|
||||
}
|
||||
//ets_printf("A: %u\n", len);
|
||||
}
|
||||
size_t AsyncWebSocketMultiMessage::send(AsyncClient *client) {
|
||||
if(_status != WS_MSG_SENDING) {
|
||||
// Serial.println("MS 1");
|
||||
if(_status != WS_MSG_SENDING)
|
||||
return 0;
|
||||
}
|
||||
if(_acked < _ack){
|
||||
// Serial.println("MS 2");
|
||||
return 0;
|
||||
}
|
||||
if(_sent == _len){
|
||||
// Serial.println("MS 3");
|
||||
_status = WS_MSG_SENT;
|
||||
return 0;
|
||||
}
|
||||
if(_sent > _len){
|
||||
// Serial.println("MS 4");
|
||||
_status = WS_MSG_ERROR;
|
||||
//ets_printf("E: %u > %u\n", _sent, _len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t toSend = _len - _sent;
|
||||
size_t window = webSocketSendFrameWindow(client);
|
||||
// Serial.printf("Send %u %u %u\n", _len, _sent, toSend);
|
||||
|
||||
if(window < toSend) {
|
||||
toSend = window;
|
||||
}
|
||||
// Serial.printf("s:%u a:%u t:%u\n", _sent, _ack, toSend);
|
||||
|
||||
_sent += toSend;
|
||||
_ack += toSend + ((toSend < 126)?2:4) + (_mask * 4);
|
||||
|
||||
@ -501,14 +460,8 @@ AsyncWebSocketMultiMessage::~AsyncWebSocketMultiMessage() {
|
||||
_status = WS_MSG_SENDING;
|
||||
if(toSend && sent != toSend){
|
||||
//ets_printf("E: %u != %u\n", toSend, sent);
|
||||
size_t delta = (toSend - sent);
|
||||
// Serial.printf("\ns:%u a:%u d:%u\n", _sent, _ack, delta);
|
||||
_sent -= delta;
|
||||
_ack -= delta + ((delta < 126)?2:4) + (_mask * 4);
|
||||
// Serial.printf("s:%u a:%u\n", _sent, _ack);
|
||||
if (!sent) {
|
||||
_status = WS_MSG_ERROR;
|
||||
}
|
||||
_sent -= (toSend - sent);
|
||||
_ack -= (toSend - sent);
|
||||
}
|
||||
//ets_printf("S: %u %u\n", _sent, sent);
|
||||
return sent;
|
||||
@ -543,25 +496,16 @@ AsyncWebSocketClient::AsyncWebSocketClient(AsyncWebServerRequest *request, Async
|
||||
_server->_addClient(this);
|
||||
_server->_handleEvent(this, WS_EVT_CONNECT, request, NULL, 0);
|
||||
delete request;
|
||||
memset(&_pinfo,0,sizeof(_pinfo));
|
||||
memset(&_pinfo,0,sizeof(_pinfo)); //
|
||||
}
|
||||
|
||||
AsyncWebSocketClient::~AsyncWebSocketClient(){
|
||||
// Serial.printf("%u FREE Q\n", id());
|
||||
_messageQueue.free();
|
||||
_controlQueue.free();
|
||||
_server->_cleanBuffers();
|
||||
_server->_handleEvent(this, WS_EVT_DISCONNECT, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
void AsyncWebSocketClient::_clearQueue(){
|
||||
while(!_messageQueue.isEmpty() && _messageQueue.front()->finished()){
|
||||
_messageQueue.remove(_messageQueue.front());
|
||||
}
|
||||
}
|
||||
|
||||
void AsyncWebSocketClient::_onAck(size_t len, uint32_t time){
|
||||
// Serial.printf("%u onAck\n", id());
|
||||
_lastMessageTime = millis();
|
||||
if(!_controlQueue.isEmpty()){
|
||||
auto head = _controlQueue.front();
|
||||
@ -576,21 +520,15 @@ void AsyncWebSocketClient::_onAck(size_t len, uint32_t time){
|
||||
_controlQueue.remove(head);
|
||||
}
|
||||
}
|
||||
|
||||
if(len && !_messageQueue.isEmpty()){
|
||||
_messageQueue.front()->ack(len, time);
|
||||
}
|
||||
|
||||
_clearQueue();
|
||||
|
||||
_server->_cleanBuffers();
|
||||
// Serial.println("RUN 1");
|
||||
_runQueue();
|
||||
}
|
||||
|
||||
void AsyncWebSocketClient::_onPoll(){
|
||||
if(_client->canSend() && (!_controlQueue.isEmpty() || !_messageQueue.isEmpty())){
|
||||
// Serial.println("RUN 2");
|
||||
_runQueue();
|
||||
} else if(_keepAlivePeriod > 0 && _controlQueue.isEmpty() && _messageQueue.isEmpty() && (millis() - _lastMessageTime) >= _keepAlivePeriod){
|
||||
ping((uint8_t *)AWSC_PING_PAYLOAD, AWSC_PING_PAYLOAD_LEN);
|
||||
@ -598,20 +536,15 @@ void AsyncWebSocketClient::_onPoll(){
|
||||
}
|
||||
|
||||
void AsyncWebSocketClient::_runQueue(){
|
||||
_clearQueue();
|
||||
|
||||
//size_t m0 = _messageQueue.isEmpty()? 0 : _messageQueue.length();
|
||||
//size_t m1 = _messageQueue.isEmpty()? 0 : _messageQueue.front()->betweenFrames();
|
||||
// Serial.printf("%u R C = %u %u\n", _clientId, m0, m1);
|
||||
if(!_controlQueue.isEmpty() && (_messageQueue.isEmpty() || _messageQueue.front()->betweenFrames()) && webSocketSendFrameWindow(_client) > (size_t)(_controlQueue.front()->len() - 1)){
|
||||
// Serial.printf("%u R S C\n", _clientId);
|
||||
_controlQueue.front()->send(_client);
|
||||
} else if(!_messageQueue.isEmpty() && _messageQueue.front()->betweenFrames() && webSocketSendFrameWindow(_client)){
|
||||
// Serial.printf("%u R S M = ", _clientId);
|
||||
_messageQueue.front()->send(_client);
|
||||
while(!_messageQueue.isEmpty() && _messageQueue.front()->finished()){
|
||||
_messageQueue.remove(_messageQueue.front());
|
||||
}
|
||||
|
||||
_clearQueue();
|
||||
if(!_controlQueue.isEmpty() && (_messageQueue.isEmpty() || _messageQueue.front()->betweenFrames()) && webSocketSendFrameWindow(_client) > (size_t)(_controlQueue.front()->len() - 1)){
|
||||
_controlQueue.front()->send(_client);
|
||||
} else if(!_messageQueue.isEmpty() && _messageQueue.front()->betweenFrames() && webSocketSendFrameWindow(_client)){
|
||||
_messageQueue.front()->send(_client);
|
||||
}
|
||||
}
|
||||
|
||||
bool AsyncWebSocketClient::queueIsFull(){
|
||||
@ -620,39 +553,29 @@ bool AsyncWebSocketClient::queueIsFull(){
|
||||
}
|
||||
|
||||
void AsyncWebSocketClient::_queueMessage(AsyncWebSocketMessage *dataMessage){
|
||||
if(dataMessage == NULL){
|
||||
// Serial.printf("%u Q1\n", _clientId);
|
||||
if(dataMessage == NULL)
|
||||
return;
|
||||
}
|
||||
if(_status != WS_CONNECTED){
|
||||
// Serial.printf("%u Q2\n", _clientId);
|
||||
delete dataMessage;
|
||||
return;
|
||||
}
|
||||
if(_messageQueue.length() >= WS_MAX_QUEUED_MESSAGES){
|
||||
ets_printf(String(F("ERROR: Too many messages queued\n")).c_str());
|
||||
// Serial.printf("%u Q3\n", _clientId);
|
||||
delete dataMessage;
|
||||
} else {
|
||||
_messageQueue.add(dataMessage);
|
||||
// Serial.printf("%u Q A %u\n", _clientId, _messageQueue.length());
|
||||
}
|
||||
if(_client->canSend()) {
|
||||
// Serial.printf("%u Q S\n", _clientId);
|
||||
// Serial.println("RUN 3");
|
||||
if(_client->canSend())
|
||||
_runQueue();
|
||||
}
|
||||
}
|
||||
|
||||
void AsyncWebSocketClient::_queueControl(AsyncWebSocketControl *controlMessage){
|
||||
if(controlMessage == NULL)
|
||||
return;
|
||||
_controlQueue.add(controlMessage);
|
||||
if(_client->canSend()) {
|
||||
// Serial.println("RUN 4");
|
||||
if(_client->canSend())
|
||||
_runQueue();
|
||||
}
|
||||
}
|
||||
|
||||
void AsyncWebSocketClient::close(uint16_t code, const char * message){
|
||||
if(_status != WS_CONNECTED)
|
||||
@ -684,24 +607,19 @@ void AsyncWebSocketClient::ping(uint8_t *data, size_t len){
|
||||
_queueControl(new AsyncWebSocketControl(WS_PING, data, len));
|
||||
}
|
||||
|
||||
void AsyncWebSocketClient::_onError(int8_t){
|
||||
//Serial.println("onErr");
|
||||
}
|
||||
void AsyncWebSocketClient::_onError(int8_t){}
|
||||
|
||||
void AsyncWebSocketClient::_onTimeout(uint32_t time){
|
||||
// Serial.println("onTime");
|
||||
(void)time;
|
||||
_client->close(true);
|
||||
}
|
||||
|
||||
void AsyncWebSocketClient::_onDisconnect(){
|
||||
// Serial.println("onDis");
|
||||
_client = NULL;
|
||||
_server->_handleDisconnect(this);
|
||||
}
|
||||
|
||||
void AsyncWebSocketClient::_onData(void *pbuf, size_t plen){
|
||||
// Serial.println("onData");
|
||||
_lastMessageTime = millis();
|
||||
uint8_t *data = (uint8_t*)pbuf;
|
||||
while(plen > 0){
|
||||
@ -746,9 +664,9 @@ void AsyncWebSocketClient::_onData(void *pbuf, size_t plen){
|
||||
if(_pinfo.opcode){
|
||||
_pinfo.message_opcode = _pinfo.opcode;
|
||||
_pinfo.num = 0;
|
||||
} else _pinfo.num += 1;
|
||||
}
|
||||
}
|
||||
if (datalen > 0) _server->_handleEvent(this, WS_EVT_DATA, (void *)&_pinfo, (uint8_t*)data, datalen);
|
||||
_server->_handleEvent(this, WS_EVT_DATA, (void *)&_pinfo, (uint8_t*)data, datalen);
|
||||
|
||||
_pinfo.index += datalen;
|
||||
} else if((datalen + _pinfo.index) == _pinfo.len){
|
||||
@ -776,8 +694,6 @@ void AsyncWebSocketClient::_onData(void *pbuf, size_t plen){
|
||||
_server->_handleEvent(this, WS_EVT_PONG, NULL, data, datalen);
|
||||
} else if(_pinfo.opcode < 8){//continuation or text/binary frame
|
||||
_server->_handleEvent(this, WS_EVT_DATA, (void *)&_pinfo, data, datalen);
|
||||
if (_pinfo.final) _pinfo.num = 0;
|
||||
else _pinfo.num += 1;
|
||||
}
|
||||
} else {
|
||||
//os_printf("frame error: len: %u, index: %llu, total: %llu\n", datalen, _pinfo.index, _pinfo.len);
|
||||
@ -1041,7 +957,6 @@ void AsyncWebSocket::textAll(AsyncWebSocketMessageBuffer * buffer){
|
||||
|
||||
|
||||
void AsyncWebSocket::textAll(const char * message, size_t len){
|
||||
//if (_buffers.length()) return;
|
||||
AsyncWebSocketMessageBuffer * WSBuffer = makeBuffer((uint8_t *)message, len);
|
||||
textAll(WSBuffer);
|
||||
}
|
||||
@ -1314,7 +1229,6 @@ AsyncWebSocketMessageBuffer * AsyncWebSocket::makeBuffer(uint8_t * data, size_t
|
||||
|
||||
if (buffer) {
|
||||
AsyncWebLockGuard l(_lock);
|
||||
// Serial.printf("Add to global buffers = %u\n", _buffers.length() + 1);
|
||||
_buffers.add(buffer);
|
||||
}
|
||||
|
||||
@ -1324,9 +1238,9 @@ AsyncWebSocketMessageBuffer * AsyncWebSocket::makeBuffer(uint8_t * data, size_t
|
||||
void AsyncWebSocket::_cleanBuffers()
|
||||
{
|
||||
AsyncWebLockGuard l(_lock);
|
||||
|
||||
for(AsyncWebSocketMessageBuffer * c: _buffers){
|
||||
if(c && c->canDelete()){
|
||||
// Serial.printf("Remove from global buffers = %u\n", _buffers.length() - 1);
|
||||
_buffers.remove(c);
|
||||
}
|
||||
}
|
||||
|
@ -173,7 +173,6 @@ class AsyncWebSocketClient {
|
||||
void _queueMessage(AsyncWebSocketMessage *dataMessage);
|
||||
void _queueControl(AsyncWebSocketControl *controlMessage);
|
||||
void _runQueue();
|
||||
void _clearQueue();
|
||||
|
||||
public:
|
||||
void *_tempObject;
|
||||
@ -206,7 +205,6 @@ class AsyncWebSocketClient {
|
||||
//data packets
|
||||
void message(AsyncWebSocketMessage *message){ _queueMessage(message); }
|
||||
bool queueIsFull();
|
||||
size_t queueLen() { return _messageQueue.length() + _controlQueue.length(); }
|
||||
|
||||
size_t printf(const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
#ifndef ESP32
|
||||
|
@ -1,18 +1,14 @@
|
||||
#include "SPIFFSEditor.h"
|
||||
#include <FS.h>
|
||||
|
||||
#define EDFS
|
||||
|
||||
#ifndef EDFS
|
||||
#include "edit.htm.gz.h"
|
||||
#endif
|
||||
|
||||
#ifdef ESP32
|
||||
#define fullName(x) name(x)
|
||||
#endif
|
||||
|
||||
#define SPIFFS_MAXLENGTH_FILEPATH 32
|
||||
static const char excludeListFile[] PROGMEM = "/.exclude.files";
|
||||
const char *excludeListFile = "/.exclude.files";
|
||||
|
||||
typedef struct ExcludeListS {
|
||||
char *item;
|
||||
@ -107,7 +103,7 @@ static void loadExcludeList(fs::FS &_fs, const char *filename){
|
||||
|
||||
static bool isExcluded(fs::FS &_fs, const char *filename) {
|
||||
if(excludes == NULL){
|
||||
loadExcludeList(_fs, String(FPSTR(excludeListFile)).c_str());
|
||||
loadExcludeList(_fs, excludeListFile);
|
||||
}
|
||||
ExcludeList *e = excludes;
|
||||
while(e){
|
||||
@ -134,12 +130,12 @@ SPIFFSEditor::SPIFFSEditor(const String& username, const String& password, const
|
||||
{}
|
||||
|
||||
bool SPIFFSEditor::canHandle(AsyncWebServerRequest *request){
|
||||
if(request->url().equalsIgnoreCase(F("/edit"))){
|
||||
if(request->url().equalsIgnoreCase("/edit")){
|
||||
if(request->method() == HTTP_GET){
|
||||
if(request->hasParam(F("list")))
|
||||
if(request->hasParam("list"))
|
||||
return true;
|
||||
if(request->hasParam(F("edit"))){
|
||||
request->_tempFile = _fs.open(request->arg(F("edit")), "r");
|
||||
if(request->hasParam("edit")){
|
||||
request->_tempFile = _fs.open(request->arg("edit"), "r");
|
||||
if(!request->_tempFile){
|
||||
return false;
|
||||
}
|
||||
@ -151,7 +147,7 @@ bool SPIFFSEditor::canHandle(AsyncWebServerRequest *request){
|
||||
#endif
|
||||
}
|
||||
if(request->hasParam("download")){
|
||||
request->_tempFile = _fs.open(request->arg(F("download")), "r");
|
||||
request->_tempFile = _fs.open(request->arg("download"), "r");
|
||||
if(!request->_tempFile){
|
||||
return false;
|
||||
}
|
||||
@ -162,7 +158,7 @@ bool SPIFFSEditor::canHandle(AsyncWebServerRequest *request){
|
||||
}
|
||||
#endif
|
||||
}
|
||||
request->addInterestingHeader(F("If-Modified-Since"));
|
||||
request->addInterestingHeader("If-Modified-Since");
|
||||
return true;
|
||||
}
|
||||
else if(request->method() == HTTP_POST)
|
||||
@ -182,8 +178,8 @@ void SPIFFSEditor::handleRequest(AsyncWebServerRequest *request){
|
||||
return request->requestAuthentication();
|
||||
|
||||
if(request->method() == HTTP_GET){
|
||||
if(request->hasParam(F("list"))){
|
||||
String path = request->getParam(F("list"))->value();
|
||||
if(request->hasParam("list")){
|
||||
String path = request->getParam("list")->value();
|
||||
#ifdef ESP32
|
||||
File dir = _fs.open(path);
|
||||
#else
|
||||
@ -208,11 +204,11 @@ void SPIFFSEditor::handleRequest(AsyncWebServerRequest *request){
|
||||
continue;
|
||||
}
|
||||
if (output != "[") output += ',';
|
||||
output += F("{\"type\":\"");
|
||||
output += F("file");
|
||||
output += F("\",\"name\":\"");
|
||||
output += "{\"type\":\"";
|
||||
output += "file";
|
||||
output += "\",\"name\":\"";
|
||||
output += String(fname);
|
||||
output += F("\",\"size\":");
|
||||
output += "\",\"size\":";
|
||||
output += String(entry.size());
|
||||
output += "}";
|
||||
#ifdef ESP32
|
||||
@ -225,44 +221,41 @@ void SPIFFSEditor::handleRequest(AsyncWebServerRequest *request){
|
||||
dir.close();
|
||||
#endif
|
||||
output += "]";
|
||||
request->send(200, F("application/json"), output);
|
||||
request->send(200, "application/json", output);
|
||||
output = String();
|
||||
}
|
||||
else if(request->hasParam(F("edit")) || request->hasParam(F("download"))){
|
||||
request->send(request->_tempFile, request->_tempFile.fullName(), String(), request->hasParam(F("download")));
|
||||
else if(request->hasParam("edit") || request->hasParam("download")){
|
||||
request->send(request->_tempFile, request->_tempFile.fullName(), String(), request->hasParam("download"));
|
||||
}
|
||||
else {
|
||||
const char * buildTime = __DATE__ " " __TIME__ " GMT";
|
||||
if (request->header(F("If-Modified-Since")).equals(buildTime)) {
|
||||
if (request->header("If-Modified-Since").equals(buildTime)) {
|
||||
request->send(304);
|
||||
} else {
|
||||
#ifdef EDFS
|
||||
AsyncWebServerResponse *response = request->beginResponse(_fs, F("/edit_gz"), F("text/html"), false);
|
||||
#else
|
||||
AsyncWebServerResponse *response = request->beginResponse_P(200, F("text/html"), edit_htm_gz, edit_htm_gz_len);
|
||||
#endif
|
||||
response->addHeader(F("Content-Encoding"), F("gzip"));
|
||||
response->addHeader(F("Last-Modified"), buildTime);
|
||||
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", edit_htm_gz, edit_htm_gz_len);
|
||||
response->addHeader("Content-Encoding", "gzip");
|
||||
response->addHeader("Last-Modified", buildTime);
|
||||
request->send(response);
|
||||
}
|
||||
}
|
||||
} else if(request->method() == HTTP_DELETE){
|
||||
if(request->hasParam(F("path"), true)){
|
||||
if(!(_fs.remove(request->getParam(F("path"), true)->value()))){
|
||||
if(request->hasParam("path", true)){
|
||||
|
||||
if(!(_fs.remove(request->getParam("path", true)->value()))){
|
||||
#ifdef ESP32
|
||||
_fs.rmdir(request->getParam(F("path"), true)->value()); // try rmdir for littlefs
|
||||
_fs.rmdir(request->getParam("path", true)->value()); // try rmdir for littlefs
|
||||
#endif
|
||||
}
|
||||
|
||||
request->send(200, "", String(F("DELETE: "))+request->getParam(F("path"), true)->value());
|
||||
request->send(200, "", "DELETE: "+request->getParam("path", true)->value());
|
||||
} else
|
||||
request->send(404);
|
||||
} else if(request->method() == HTTP_POST){
|
||||
if(request->hasParam(F("data"), true, true) && _fs.exists(request->getParam(F("data"), true, true)->value()))
|
||||
request->send(200, "", String(F("UPLOADED: "))+request->getParam(F("data"), true, true)->value());
|
||||
if(request->hasParam("data", true, true) && _fs.exists(request->getParam("data", true, true)->value()))
|
||||
request->send(200, "", "UPLOADED: "+request->getParam("data", true, true)->value());
|
||||
|
||||
else if(request->hasParam(F("rawname"), true) && request->hasParam(F("raw0"), true)){
|
||||
String rawnam = request->getParam(F("rawname"), true)->value();
|
||||
else if(request->hasParam("rawname", true) && request->hasParam("raw0", true)){
|
||||
String rawnam = request->getParam("rawname", true)->value();
|
||||
|
||||
if (_fs.exists(rawnam)) _fs.remove(rawnam); // delete it to allow a mode
|
||||
|
||||
@ -270,22 +263,22 @@ void SPIFFSEditor::handleRequest(AsyncWebServerRequest *request){
|
||||
uint16_t i = 0;
|
||||
fs::File f = _fs.open(rawnam, "a");
|
||||
|
||||
while (request->hasParam(String(F("raw")) + String(k), true)) { //raw0 .. raw1
|
||||
while (request->hasParam("raw" + String(k), true)) { //raw0 .. raw1
|
||||
if(f){
|
||||
i += f.print(request->getParam(String(F("raw")) + String(k), true)->value());
|
||||
i += f.print(request->getParam("raw" + String(k), true)->value());
|
||||
}
|
||||
k++;
|
||||
}
|
||||
f.close();
|
||||
request->send(200, "", String(F("IPADWRITE: ")) + rawnam + ":" + String(i));
|
||||
request->send(200, "", "IPADWRITE: " + rawnam + ":" + String(i));
|
||||
|
||||
} else {
|
||||
request->send(500);
|
||||
}
|
||||
|
||||
} else if(request->method() == HTTP_PUT){
|
||||
if(request->hasParam(F("path"), true)){
|
||||
String filename = request->getParam(F("path"), true)->value();
|
||||
if(request->hasParam("path", true)){
|
||||
String filename = request->getParam("path", true)->value();
|
||||
if(_fs.exists(filename)){
|
||||
request->send(200);
|
||||
} else {
|
||||
@ -313,7 +306,7 @@ void SPIFFSEditor::handleRequest(AsyncWebServerRequest *request){
|
||||
if(f){
|
||||
f.write((uint8_t)0x00);
|
||||
f.close();
|
||||
request->send(200, "", String(F("CREATE: "))+filename);
|
||||
request->send(200, "", "CREATE: "+filename);
|
||||
} else {
|
||||
request->send(500);
|
||||
}
|
||||
|
@ -105,13 +105,6 @@ class AsyncCallbackWebHandler: public AsyncWebHandler {
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
if (_uri.length() && _uri.startsWith("/*.")) {
|
||||
String uriTemplate = String (_uri);
|
||||
uriTemplate = uriTemplate.substring(uriTemplate.lastIndexOf("."));
|
||||
if (!request->url().endsWith(uriTemplate))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
if (_uri.length() && _uri.endsWith("*")) {
|
||||
String uriTemplate = String(_uri);
|
||||
uriTemplate = uriTemplate.substring(0, uriTemplate.length() - 1);
|
||||
@ -126,22 +119,16 @@ class AsyncCallbackWebHandler: public AsyncWebHandler {
|
||||
}
|
||||
|
||||
virtual void handleRequest(AsyncWebServerRequest *request) override final {
|
||||
if((_username != "" && _password != "") && !request->authenticate(_username.c_str(), _password.c_str()))
|
||||
return request->requestAuthentication();
|
||||
if(_onRequest)
|
||||
_onRequest(request);
|
||||
else
|
||||
request->send(500);
|
||||
}
|
||||
virtual void handleUpload(AsyncWebServerRequest *request, const String& filename, size_t index, uint8_t *data, size_t len, bool final) override final {
|
||||
if((_username != "" && _password != "") && !request->authenticate(_username.c_str(), _password.c_str()))
|
||||
return request->requestAuthentication();
|
||||
if(_onUpload)
|
||||
_onUpload(request, filename, index, data, len, final);
|
||||
}
|
||||
virtual void handleBody(AsyncWebServerRequest *request, uint8_t *data, size_t len, size_t index, size_t total) override final {
|
||||
if((_username != "" && _password != "") && !request->authenticate(_username.c_str(), _password.c_str()))
|
||||
return request->requestAuthentication();
|
||||
if(_onBody)
|
||||
_onBody(request, data, len, index, total);
|
||||
}
|
||||
|
@ -192,16 +192,8 @@ void AsyncWebServerRequest::_removeNotInterestingHeaders(){
|
||||
|
||||
void AsyncWebServerRequest::_onPoll(){
|
||||
//os_printf("p\n");
|
||||
if(_response != NULL && _client != NULL && _client->canSend()){
|
||||
if(!_response->_finished()){
|
||||
if(_response != NULL && _client != NULL && _client->canSend() && !_response->_finished()){
|
||||
_response->_ack(this, 0, 0);
|
||||
} else {
|
||||
AsyncWebServerResponse* r = _response;
|
||||
_response = NULL;
|
||||
delete r;
|
||||
|
||||
_client->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,12 +202,10 @@ void AsyncWebServerRequest::_onAck(size_t len, uint32_t time){
|
||||
if(_response != NULL){
|
||||
if(!_response->_finished()){
|
||||
_response->_ack(this, len, time);
|
||||
} else if(_response->_finished()){
|
||||
} else {
|
||||
AsyncWebServerResponse* r = _response;
|
||||
_response = NULL;
|
||||
delete r;
|
||||
|
||||
_client->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
64
src/edit.htm
64
src/edit.htm
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
|
||||
<title>ESP Editor</title>
|
||||
<link rel="apple-touch-icon" href="/ace.ico" type="image/x-icon" />
|
||||
<link rel="shortcut icon" href="/ace.ico" type="image/x-icon" />
|
||||
@ -9,7 +9,7 @@
|
||||
<style type="text/css" media="screen">
|
||||
label {
|
||||
font-size: 12px;
|
||||
font-family: sans-serif;
|
||||
font-family: sans-serif
|
||||
}
|
||||
|
||||
.cm {
|
||||
@ -17,12 +17,12 @@
|
||||
position: absolute;
|
||||
left: 5px;
|
||||
border: 1px solid #444;
|
||||
background-color: #f5f5f5;
|
||||
background-color: #F5F5F5;
|
||||
display: none;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, .4);
|
||||
font-size: 12px;
|
||||
font-family: sans-serif;
|
||||
font-weight: 700;
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
.cm ul {
|
||||
@ -30,39 +30,39 @@
|
||||
top: 0;
|
||||
left: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
padding: 0
|
||||
}
|
||||
|
||||
.cm li {
|
||||
position: relative;
|
||||
min-width: 60px;
|
||||
cursor: pointer;
|
||||
cursor: pointer
|
||||
}
|
||||
|
||||
.cm span {
|
||||
color: #444;
|
||||
display: inline-block;
|
||||
padding: 6px;
|
||||
padding: 6px
|
||||
}
|
||||
|
||||
.cm li:hover {
|
||||
background: #444;
|
||||
background: #444
|
||||
}
|
||||
|
||||
.cm li:hover span {
|
||||
color: #eee;
|
||||
color: #EEE
|
||||
}
|
||||
|
||||
.tvu li,
|
||||
.tvu ul {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
list-style: none
|
||||
}
|
||||
|
||||
.tvu input {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
.tvu {
|
||||
@ -71,7 +71,7 @@
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
color: #444;
|
||||
line-height: 16px;
|
||||
line-height: 16px
|
||||
}
|
||||
|
||||
.tvu span {
|
||||
@ -81,25 +81,24 @@
|
||||
display: inline-block;
|
||||
height: 16px;
|
||||
vertical-align: middle;
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAADoSURBVBgZBcExblNBGAbA2ceegTRBuIKOgiihSZNTcC5LUHAihNJR0kGKCDcYJY6D3/77MdOinTvzAgCw8ysThIvn/VojIyMjIyPP+bS1sUQIV2s95pBDDvmbP/mdkft83tpYguZq5Jh/OeaYh+yzy8hTHvNlaxNNczm+la9OTlar1UdA/+C2A4trRCnD3jS8BB1obq2Gk6GU6QbQAS4BUaYSQAf4bhhKKTFdAzrAOwAxEUAH+KEM01SY3gM6wBsEAQB0gJ+maZoC3gI6iPYaAIBJsiRmHU0AALOeFC3aK2cWAACUXe7+AwO0lc9eTHYTAAAAAElFTkSuQmCC)
|
||||
no-repeat;
|
||||
background-position: 0 0;
|
||||
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAADoSURBVBgZBcExblNBGAbA2ceegTRBuIKOgiihSZNTcC5LUHAihNJR0kGKCDcYJY6D3/77MdOinTvzAgCw8ysThIvn/VojIyMjIyPP+bS1sUQIV2s95pBDDvmbP/mdkft83tpYguZq5Jh/OeaYh+yzy8hTHvNlaxNNczm+la9OTlar1UdA/+C2A4trRCnD3jS8BB1obq2Gk6GU6QbQAS4BUaYSQAf4bhhKKTFdAzrAOwAxEUAH+KEM01SY3gM6wBsEAQB0gJ+maZoC3gI6iPYaAIBJsiRmHU0AALOeFC3aK2cWAACUXe7+AwO0lc9eTHYTAAAAAElFTkSuQmCC) no-repeat;
|
||||
background-position: 0 0
|
||||
}
|
||||
|
||||
.tvu span:hover {
|
||||
text-decoration: underline;
|
||||
text-decoration: underline
|
||||
}
|
||||
|
||||
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
||||
.tvu {
|
||||
-webkit-animation: webkit-adjacent-element-selector-bugfix infinite 1s;
|
||||
-webkit-animation: webkit-adjacent-element-selector-bugfix infinite 1s
|
||||
}
|
||||
@-webkit-keyframes webkit-adjacent-element-selector-bugfix {
|
||||
from {
|
||||
padding: 0;
|
||||
padding: 0
|
||||
}
|
||||
to {
|
||||
padding: 0;
|
||||
padding: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -113,7 +112,7 @@
|
||||
line-height: 24px;
|
||||
padding-left: 10px;
|
||||
background-color: #444;
|
||||
color: #eee;
|
||||
color: #EEE
|
||||
}
|
||||
|
||||
#tree {
|
||||
@ -122,7 +121,7 @@
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 160px;
|
||||
padding: 8px;
|
||||
padding: 8px
|
||||
}
|
||||
|
||||
#editor,
|
||||
@ -132,18 +131,18 @@
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 160px;
|
||||
border-left: 1px solid #eee;
|
||||
border-left: 1px solid #EEE
|
||||
}
|
||||
|
||||
#preview {
|
||||
background-color: #eee;
|
||||
padding: 5px;
|
||||
background-color: #EEE;
|
||||
padding: 5px
|
||||
}
|
||||
|
||||
#loader {
|
||||
position: absolute;
|
||||
top: 36%;
|
||||
right: 40%;
|
||||
right: 40%
|
||||
}
|
||||
|
||||
.loader {
|
||||
@ -155,15 +154,15 @@
|
||||
width: 240px;
|
||||
height: 240px;
|
||||
animation: spin 2s linear infinite;
|
||||
display: none;
|
||||
display: none
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0);
|
||||
transform: rotate(0)
|
||||
}
|
||||
100% {
|
||||
transform: rotate(360deg);
|
||||
transform: rotate(360deg)
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -565,7 +564,7 @@
|
||||
<script>
|
||||
if ("undefined" == typeof ace.edit) {
|
||||
var script = document.createElement("script");
|
||||
(script.src = "/ace.js"), (script.async = !1), document.head.appendChild(script);
|
||||
script.src = "/ace.js", script.async = !1, document.head.appendChild(script)
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
@ -575,7 +574,8 @@
|
||||
<div id="uploader"></div>
|
||||
<div id="tree"></div>
|
||||
<div id="editor"></div>
|
||||
<div id="preview" style="display: none;"></div>
|
||||
<iframe id="download-frame" style="display: none;"></iframe>
|
||||
<div id="preview" style="display:none"></div>
|
||||
<iframe id="download-frame" style="display:none"></iframe>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -2,7 +2,7 @@
|
||||
//File: edit.htm.gz, Size: 4503
|
||||
#define edit_htm_gz_len 4503
|
||||
const uint8_t edit_htm_gz[] PROGMEM = {
|
||||
0x1F,0x8B,0x08,0x08,0x5A,0xE6,0xAE,0x5F,0x02,0x00,0x65,0x64,0x69,0x74,0x2E,0x68,0x74,0x6D,0x00,0xB5,
|
||||
0x1F,0x8B,0x08,0x08,0x9B,0xC8,0x22,0x5F,0x02,0x00,0x65,0x64,0x69,0x74,0x2E,0x68,0x74,0x6D,0x00,0xB5,
|
||||
0x1A,0x0B,0x5B,0xDB,0x36,0xF0,0xAF,0x18,0x6F,0x63,0xF6,0xE2,0x38,0x0E,0x50,0xD6,0x3A,0x18,0x16,0x1E,
|
||||
0xEB,0xBB,0x50,0x12,0xDA,0xD1,0x8E,0xED,0x53,0x6C,0x25,0x56,0xB1,0x25,0xCF,0x96,0x09,0x34,0xCD,0x7F,
|
||||
0xDF,0x49,0xF2,0x93,0x84,0xEE,0xF1,0x6D,0xA5,0x60,0x49,0xA7,0x3B,0xDD,0x9D,0xEE,0x25,0xD9,0x7B,0x1B,
|
||||
|
Loading…
Reference in New Issue
Block a user