mirror of https://github.com/jeelabs/esp-link.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.4 KiB
50 lines
1.4 KiB
|
|
|
|
/*
|
|
* ----------------------------------------------------------------------------
|
|
* "THE BEER-WARE LICENSE" (Revision 42):
|
|
* Jeroen Domburg <jeroen@spritesmods.com> wrote this file. As long as you retain
|
|
* this notice you can do whatever you want with this stuff. If we meet some day,
|
|
* and you think this stuff is worth it, you can buy me a beer in return.
|
|
* ----------------------------------------------------------------------------
|
|
*/
|
|
|
|
|
|
#include "espmissingincludes.h"
|
|
#include "ets_sys.h"
|
|
#include "osapi.h"
|
|
#include "httpd.h"
|
|
#include "io.h"
|
|
#include "httpdespfs.h"
|
|
#include "cgi.h"
|
|
#include "cgiwifi.h"
|
|
#include "stdout.h"
|
|
|
|
HttpdBuiltInUrl builtInUrls[]={
|
|
{"/", cgiRedirect, "/index.tpl"},
|
|
{"/flash.bin", cgiReadFlash, NULL},
|
|
{"/led.tpl", cgiEspFsTemplate, tplLed},
|
|
{"/index.tpl", cgiEspFsTemplate, tplCounter},
|
|
{"/led.cgi", cgiLed, NULL},
|
|
|
|
//Routines to make the /wifi URL and everything beneath it work.
|
|
{"/wifi", cgiRedirect, "/wifi/wifi.tpl"},
|
|
{"/wifi/", cgiRedirect, "/wifi/wifi.tpl"},
|
|
{"/wifi/wifiscan.cgi", cgiWiFiScan, NULL},
|
|
{"/wifi/wifi.tpl", cgiEspFsTemplate, tplWlan},
|
|
{"/wifi/connect.cgi", cgiWiFiConnect, NULL},
|
|
{"/wifi/setmode.cgi", cgiWifiSetMode, NULL},
|
|
|
|
|
|
{"*", cgiEspFsHook, NULL}, //Catch-all cgi function for the filesystem
|
|
{NULL, NULL, NULL}
|
|
};
|
|
|
|
|
|
void user_init(void) {
|
|
stdoutInit();
|
|
os_printf("HTTPD EXAMPLE START\n");
|
|
ioInit();
|
|
httpdInit(builtInUrls, 80);
|
|
os_printf("\nReady\n");
|
|
}
|
|
|