mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
Added webConfigSetCallbackUrl, webConfigSetCallbackableUrl, and webConfigSetUserAgentAdditionalString. Improved web docs.
This commit is contained in:
parent
6aa2640e4a
commit
2cd9825074
@ -138,7 +138,24 @@ 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.
|
||||
* @brief Sets the CallbackUrl.
|
||||
* @note Only available with config created by \ref webPageCreate or with Share-applet.
|
||||
* @param config WebCommonConfig object.
|
||||
* @param url URL
|
||||
*/
|
||||
void webConfigSetCallbackUrl(WebCommonConfig* config, const char* url);
|
||||
|
||||
/**
|
||||
* @brief Sets the CallbackableUrl.
|
||||
* @note Only available with config created by \ref webPageCreate.
|
||||
* @param config WebCommonConfig object.
|
||||
* @param url URL
|
||||
*/
|
||||
void webConfigSetCallbackableUrl(WebCommonConfig* config, const char* url);
|
||||
|
||||
/**
|
||||
* @brief Sets the whitelist.
|
||||
* @note 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.
|
||||
@ -152,6 +169,14 @@ void webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist);
|
||||
*/
|
||||
void webConfigSetDisplayUrlKind(WebCommonConfig* config, bool kind);
|
||||
|
||||
/**
|
||||
* @brief Sets the UserAgentAdditionalString.
|
||||
* @note Only available with config created by \ref webPageCreate on [4.0.0+].
|
||||
* @param config WebCommonConfig object.
|
||||
* @param str String
|
||||
*/
|
||||
void webConfigSetUserAgentAdditionalString(WebCommonConfig* config, const char* str);
|
||||
|
||||
/**
|
||||
* @brief Launches the {web applet} with the specified config and waits for it to exit.
|
||||
* @param config WebCommonConfig object.
|
||||
|
@ -174,6 +174,17 @@ void webPageCreate(WebCommonConfig* config, const char* url) {
|
||||
_webConfigSetUrl(config, url);
|
||||
}
|
||||
|
||||
void webConfigSetCallbackUrl(WebCommonConfig* config, const char* url) {
|
||||
WebShimKind shim = _webGetShimKind(config);
|
||||
if (shim != WebShimKind_Web && shim != WebShimKind_Share) return;
|
||||
_webConfigSetString(config, WebArgType_CallbackUrl, url, 0x400);
|
||||
}
|
||||
|
||||
void webConfigSetCallbackableUrl(WebCommonConfig* config, const char* url) {
|
||||
if (_webGetShimKind(config) != WebShimKind_Web) return;
|
||||
_webConfigSetString(config, WebArgType_CallbackableUrl, url, 0x400);
|
||||
}
|
||||
|
||||
void webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist) {
|
||||
if (_webGetShimKind(config) != WebShimKind_Web) return;
|
||||
_webConfigSetString(config, WebArgType_Whitelist, whitelist, 0x1000);
|
||||
@ -183,6 +194,12 @@ void webConfigSetDisplayUrlKind(WebCommonConfig* config, bool kind) {
|
||||
_webConfigSetFlag(config, WebArgType_DisplayUrlKind, kind);
|
||||
}
|
||||
|
||||
void webConfigSetUserAgentAdditionalString(WebCommonConfig* config, const char* str) {
|
||||
if (_webGetShimKind(config) != WebShimKind_Web) return;
|
||||
if (hosversionBefore(4,0,0)) return;
|
||||
_webConfigSetString(config, WebArgType_UserAgentAdditionalString, str, 0x80);
|
||||
}
|
||||
|
||||
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