-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFSWebServer.h
76 lines (54 loc) · 1.38 KB
/
FSWebServer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// FSWebServer.h
#ifndef _FSWEBSERVER_h
#define _FSWEBSERVER_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
//#define HIDE_SECRET // Uncomment to avoid HTTP secret file downloading
#define HIDE_CONFIG // Uncomment to avoid HTTP config file downloading
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
//#include <ESP8266WebServer.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <FS.h>
//extern ESP8266WebServer server;
extern AsyncWebServer server;
extern AsyncEventSource events;
extern AsyncWebSocket ws;
//holds the current upload
extern File fsUploadFile;
extern String browserMD5;
String formatBytes(size_t bytes);
/**
* Gets content type from filename extension
* @param[in] File name with extension
* @param[out] MIME content type
*/
String getContentType(String filename);
/**
* Gets a file from SPIFFS and streams it to web browser
* @param[in] File name
* @param[out] true if file exists
*/
bool handleFileRead(String path);
/**
* Manages file upload from web browser
*/
void handleFileUpload();
/**
* Manages file deletion of a SPIFFS file, triggered from web browser
*/
void handleFileDelete();
/**
* Manages file creation of a SPIFFS file, triggered from web browser
*/
void handleFileCreate();
void handleFileList();
void serverInit();
void updateFirmware();
boolean checkAuth();
void setUpdateMD5();
#endif