PsychicHTTP
This commit is contained in:
@@ -325,11 +325,19 @@ const std::list<PsychicClient*>& PsychicHttpServer::getClientList() {
|
||||
}
|
||||
|
||||
bool ON_STA_FILTER(PsychicRequest *request) {
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32H2
|
||||
return WiFi.localIP() == request->client()->localIP();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ON_AP_FILTER(PsychicRequest *request) {
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32H2
|
||||
return WiFi.softAPIP() == request->client()->localIP();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
String urlDecode(const char* encoded)
|
||||
|
||||
@@ -318,6 +318,11 @@ PsychicWebParameter * PsychicRequest::addParam(PsychicWebParameter *param) {
|
||||
return param;
|
||||
}
|
||||
|
||||
int PsychicRequest::params()
|
||||
{
|
||||
return _params.size();
|
||||
}
|
||||
|
||||
bool PsychicRequest::hasParam(const char *key)
|
||||
{
|
||||
return getParam(key) != NULL;
|
||||
@@ -332,6 +337,18 @@ PsychicWebParameter * PsychicRequest::getParam(const char *key)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PsychicWebParameter * PsychicRequest::getParam(int index)
|
||||
{
|
||||
if (_params.size() > index){
|
||||
std::list<PsychicWebParameter*>::iterator it = _params.begin();
|
||||
for(int i=0; i<index; i++){
|
||||
++it;
|
||||
}
|
||||
return *it;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool PsychicRequest::hasSessionKey(const String& key)
|
||||
{
|
||||
return this->_session->find(key) != this->_session->end();
|
||||
|
||||
@@ -81,9 +81,11 @@ class PsychicRequest {
|
||||
void loadParams();
|
||||
PsychicWebParameter * addParam(PsychicWebParameter *param);
|
||||
PsychicWebParameter * addParam(const String &name, const String &value, bool decode = true, bool post = false);
|
||||
int params();
|
||||
bool hasParam(const char *key);
|
||||
PsychicWebParameter * getParam(const char *name);
|
||||
|
||||
PsychicWebParameter * getParam(int index);
|
||||
|
||||
const String getFilename();
|
||||
|
||||
bool authenticate(const char * username, const char * password);
|
||||
|
||||
Reference in New Issue
Block a user