mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-22 13:02:38 +02:00
Renamed webShow to webConfigShow. Added webConfigSetWhitelist.
This commit is contained in:
parent
7ccc29f397
commit
708ad83ead
@ -90,10 +90,18 @@ Result webWifiShow(WebWifiConfig* config, WebWifiReturnValue *out);
|
||||
*/
|
||||
void webPageCreate(WebCommonConfig* config, const char* url);
|
||||
|
||||
/**
|
||||
* @brief Sets the whitelist, only available with config created by \ref webPageCreate.
|
||||
* @note If the whitelist isn't formatted properly, the applet will exit briefly after the applet is launched.
|
||||
* @param config WebCommonConfig object.
|
||||
* @param whitelist Whitelist string, each line is a regex for each whitelisted URL.
|
||||
*/
|
||||
void webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist);
|
||||
|
||||
/**
|
||||
* @brief Launches the {web applet} with the specified config and waits for it to exit.
|
||||
* @param config WebCommonConfig object.
|
||||
* @param out Optional output applet reply data, can be NULL.
|
||||
*/
|
||||
Result webShow(WebCommonConfig* config, WebCommonReturnValue *out);
|
||||
Result webConfigShow(WebCommonConfig* config, WebCommonReturnValue *out);
|
||||
|
||||
|
@ -72,6 +72,11 @@ static void _webArgInitialize(WebCommonConfig* config, AppletId appletid, WebShi
|
||||
config->version = 0x20000; // [1.0.0+] version
|
||||
}
|
||||
|
||||
WebShimKind _webGetShimKind(WebCommonConfig* config) {
|
||||
WebArgHeader *hdr = (WebArgHeader*)config->arg.data;
|
||||
return hdr->shimKind;
|
||||
}
|
||||
|
||||
static void _webTLVWrite(WebCommonTLVStorage *storage, u16 type, const void* argdata, u16 argdata_size, u16 argdata_size_total) {
|
||||
size_t i, count, offset;
|
||||
u8 *dataptr = storage->data;
|
||||
@ -158,7 +163,12 @@ void webPageCreate(WebCommonConfig* config, const char* url) {
|
||||
_webConfigSetUrl(config, url);
|
||||
}
|
||||
|
||||
Result webShow(WebCommonConfig* config, WebCommonReturnValue *out) {
|
||||
void webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist) {
|
||||
if (_webGetShimKind(config) != WebShimKind_Web) return;
|
||||
_webConfigSetString(config, 0xA, whitelist, 0x1000);
|
||||
}
|
||||
|
||||
Result webConfigShow(WebCommonConfig* config, WebCommonReturnValue *out) {
|
||||
return _webShow(config->appletid, config->version, &config->arg, sizeof(config->arg), out, sizeof(*out));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user