Fixed issue in _webTLVWrite. Updated web docs. The url param for webPageCreate is no longer optional.

This commit is contained in:
yellows8 2019-02-21 00:15:09 -05:00
parent 601c76b508
commit 0a230bae65
2 changed files with 7 additions and 7 deletions

View File

@ -77,9 +77,9 @@ void webWifiCreate(WebWifiConfig* config, const char* conntest_url, const char*
Result webWifiShow(WebWifiConfig* config, WebWifiReturnValue *out);
/**
* @brief Creates the config for WebApplet.
* @brief Creates the config for WebApplet. This applet uses an URL whitelist loaded from the user-process host title.
* @param config WebPageConfig object.
* @param url Optional initial URL navigated to by the applet, can be NULL.
* @param url Initial URL navigated to by the applet.
*/
void webPageCreate(WebPageConfig* config, const char* url);

View File

@ -90,6 +90,8 @@ static void _webTLVWrite(void* buffer, size_t size, u16 type, const void* argdat
if (size < offset + sizeof(WebArgTLV) + argdata_size) return;
tlv = (WebArgTLV*)&dataptr[offset];
if (tlv->type != type) {
tlv->type = type;
tlv->size = argdata_size;
@ -124,11 +126,9 @@ void webPageCreate(WebPageConfig* config, const char* url) {
u8 tmpval=1;
_webTLVWrite(config->arg, sizeof(config->arg), 0x12, &tmpval, sizeof(tmpval)); /// Type was changed to 0xD with a newer version.
if (url) {
memset(tmpurl, 0, sizeof(tmpurl));
strncpy(tmpurl, url, sizeof(tmpurl)-1);
_webTLVWrite(config->arg, sizeof(config->arg), 0x1, tmpurl, sizeof(tmpurl));
}
memset(tmpurl, 0, sizeof(tmpurl));
strncpy(tmpurl, url, sizeof(tmpurl)-1);
_webTLVWrite(config->arg, sizeof(config->arg), 0x1, tmpurl, sizeof(tmpurl));
}
Result webPageShow(WebPageConfig* config, WebPageReturnValue *out) {