mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-24 03:02:13 +02:00
Added webNewsCreate, webConfigSetEcClientCert, and webConfigSetShopJump. Improved web docs.
This commit is contained in:
parent
ad5b8c019f
commit
eb750b641b
@ -90,7 +90,7 @@ typedef enum {
|
|||||||
WebArgType_LeftStickMode = 0x1B, ///< [1.0.0+] u32 enum *LeftStickMode
|
WebArgType_LeftStickMode = 0x1B, ///< [1.0.0+] u32 enum *LeftStickMode
|
||||||
WebArgType_KeyRepeatFrame0 = 0x1C, ///< [1.0.0+] s32 KeyRepeatFrame, first param
|
WebArgType_KeyRepeatFrame0 = 0x1C, ///< [1.0.0+] s32 KeyRepeatFrame, first param
|
||||||
WebArgType_KeyRepeatFrame1 = 0x1D, ///< [1.0.0+] s32 KeyRepeatFrame, second param
|
WebArgType_KeyRepeatFrame1 = 0x1D, ///< [1.0.0+] s32 KeyRepeatFrame, second param
|
||||||
WebArgType_BootAsMediaPlayerInverted = 0x1E, ///< [1.0.0+] u8 bool, set after BootAsMediaPlayer with the value inverted.
|
WebArgType_BootAsMediaPlayerInverted = 0x1E, ///< [1.0.0+] u8 bool. With News this is set after BootAsMediaPlayer with the value inverted.
|
||||||
WebArgType_DisplayUrlKind = 0x1F, ///< [1.0.0+] u8 bool, DisplayUrlKind (value = (input_enumval==0x1)).
|
WebArgType_DisplayUrlKind = 0x1F, ///< [1.0.0+] u8 bool, DisplayUrlKind (value = (input_enumval==0x1)).
|
||||||
WebArgType_BootAsMediaPlayer = 0x21, ///< [2.0.0+] u8 bool
|
WebArgType_BootAsMediaPlayer = 0x21, ///< [2.0.0+] u8 bool
|
||||||
WebArgType_ShopJump = 0x22, ///< [2.0.0+] u8 bool
|
WebArgType_ShopJump = 0x22, ///< [2.0.0+] u8 bool
|
||||||
@ -142,11 +142,21 @@ Result webWifiShow(WebWifiConfig* config, WebWifiReturnValue *out);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates the config for WebApplet. This applet uses an URL whitelist loaded from the user-process host title.
|
* @brief Creates the config for WebApplet. This applet uses an URL whitelist loaded from the user-process host title.
|
||||||
|
* @note Sets WebArgType_UnknownD, and WebArgType_Unknown12 on pre-3.0.0, to value 1.
|
||||||
* @param config WebCommonConfig object.
|
* @param config WebCommonConfig object.
|
||||||
* @param url Initial URL navigated to by the applet.
|
* @param url Initial URL navigated to by the applet.
|
||||||
*/
|
*/
|
||||||
Result webPageCreate(WebCommonConfig* config, const char* url);
|
Result webPageCreate(WebCommonConfig* config, const char* url);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Creates the config for WebApplet. This is based on \ref webPageCreate, for News. Hence other functions referencing \ref webPageCreate also apply to this.
|
||||||
|
* @note Sets WebArgType_UnknownD to value 1, and sets WebArgType_NewsFlag to true. Also uses \ref webConfigSetEcClientCert and \ref webConfigSetShopJump with flag=true.
|
||||||
|
* @note The domain from the input URL is automatically whitelisted, in addition to any already loaded whitelist.
|
||||||
|
* @param config WebCommonConfig object.
|
||||||
|
* @param url Initial URL navigated to by the applet.
|
||||||
|
*/
|
||||||
|
Result webNewsCreate(WebCommonConfig* config, const char* url);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the CallbackUrl.
|
* @brief Sets the CallbackUrl.
|
||||||
* @note Only available with config created by \ref webPageCreate or with Share-applet.
|
* @note Only available with config created by \ref webPageCreate or with Share-applet.
|
||||||
@ -172,6 +182,15 @@ Result webConfigSetCallbackableUrl(WebCommonConfig* config, const char* url);
|
|||||||
*/
|
*/
|
||||||
Result webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist);
|
Result webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the EcClientCert flag.
|
||||||
|
* @note Only available with config created by \ref webPageCreate or with Offline-applet.
|
||||||
|
* @note Used automatically by \ref webNewsCreate with flag=true.
|
||||||
|
* @param config WebCommonConfig object.
|
||||||
|
* @param flag Flag
|
||||||
|
*/
|
||||||
|
Result webConfigSetEcClientCert(WebCommonConfig* config, bool flag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the BootDisplayKind.
|
* @brief Sets the BootDisplayKind.
|
||||||
* @note Only available with config created by \ref webPageCreate or with Offline-applet.
|
* @note Only available with config created by \ref webPageCreate or with Offline-applet.
|
||||||
@ -195,6 +214,15 @@ Result webConfigSetDisplayUrlKind(WebCommonConfig* config, bool kind);
|
|||||||
*/
|
*/
|
||||||
Result webConfigSetBootAsMediaPlayer(WebCommonConfig* config, bool flag);
|
Result webConfigSetBootAsMediaPlayer(WebCommonConfig* config, bool flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the ShopJump flag.
|
||||||
|
* @note Only available with config created by \ref webPageCreate on [2.0.0+].
|
||||||
|
* @note Used automatically by \ref webNewsCreate with flag=true.
|
||||||
|
* @param config WebCommonConfig object.
|
||||||
|
* @param flag Flag
|
||||||
|
*/
|
||||||
|
Result webConfigSetShopJump(WebCommonConfig* config, bool flag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the UserAgentAdditionalString.
|
* @brief Sets the UserAgentAdditionalString.
|
||||||
* @note Only available with config created by \ref webPageCreate on [4.0.0+].
|
* @note Only available with config created by \ref webPageCreate on [4.0.0+].
|
||||||
|
@ -180,6 +180,20 @@ Result webPageCreate(WebCommonConfig* config, const char* url) {
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result webNewsCreate(WebCommonConfig* config, const char* url) {
|
||||||
|
Result rc=0;
|
||||||
|
_webArgInitialize(config, AppletId_web, WebShimKind_Web);
|
||||||
|
|
||||||
|
rc = _webConfigSetU8(config, WebArgType_UnknownD, 1);
|
||||||
|
if (R_SUCCEEDED(rc)) rc = _webConfigSetFlag(config, WebArgType_NewsFlag, true);
|
||||||
|
if (R_SUCCEEDED(rc)) rc = webConfigSetEcClientCert(config, true);
|
||||||
|
if (R_SUCCEEDED(rc) && hosversionAtLeast(2,0,0)) rc = webConfigSetShopJump(config, true); // Check version so that rc isn't set to an error on pre-2.0.0.
|
||||||
|
|
||||||
|
if (R_SUCCEEDED(rc)) rc = _webConfigSetUrl(config, url);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
Result webConfigSetCallbackUrl(WebCommonConfig* config, const char* url) {
|
Result webConfigSetCallbackUrl(WebCommonConfig* config, const char* url) {
|
||||||
WebShimKind shim = _webGetShimKind(config);
|
WebShimKind shim = _webGetShimKind(config);
|
||||||
if (shim != WebShimKind_Share && shim != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
if (shim != WebShimKind_Share && shim != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||||
@ -196,6 +210,12 @@ Result webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist) {
|
|||||||
return _webConfigSetString(config, WebArgType_Whitelist, whitelist, 0x1000);
|
return _webConfigSetString(config, WebArgType_Whitelist, whitelist, 0x1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result webConfigSetEcClientCert(WebCommonConfig* config, bool flag) {
|
||||||
|
WebShimKind shim = _webGetShimKind(config);
|
||||||
|
if (shim != WebShimKind_Web && shim != WebShimKind_Offline) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||||
|
return _webConfigSetU8(config, WebArgType_EcClientCert, flag);
|
||||||
|
}
|
||||||
|
|
||||||
Result webConfigSetBootDisplayKind(WebCommonConfig* config, u32 kind) {
|
Result webConfigSetBootDisplayKind(WebCommonConfig* config, u32 kind) {
|
||||||
WebShimKind shim = _webGetShimKind(config);
|
WebShimKind shim = _webGetShimKind(config);
|
||||||
if (shim != WebShimKind_Web && shim != WebShimKind_Offline) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
if (shim != WebShimKind_Web && shim != WebShimKind_Offline) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||||
@ -225,6 +245,12 @@ Result webConfigSetBootAsMediaPlayer(WebCommonConfig* config, bool flag) {
|
|||||||
return _webConfigSetFlag(config, WebArgType_BootAsMediaPlayer, flag);
|
return _webConfigSetFlag(config, WebArgType_BootAsMediaPlayer, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result webConfigSetShopJump(WebCommonConfig* config, bool flag) {
|
||||||
|
if (_webGetShimKind(config) != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||||
|
if (hosversionBefore(2,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||||
|
return _webConfigSetFlag(config, WebArgType_ShopJump, flag);
|
||||||
|
}
|
||||||
|
|
||||||
Result webConfigShow(WebCommonConfig* config, WebCommonReturnValue *out) {
|
Result webConfigShow(WebCommonConfig* config, WebCommonReturnValue *out) {
|
||||||
return _webShow(config->appletid, config->version, &config->arg, sizeof(config->arg), out, sizeof(*out));
|
return _webShow(config->appletid, config->version, &config->arg, sizeof(config->arg), out, sizeof(*out));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user