From bc7b178036321f9dc6a5f43fc88dd50e91ddd777 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Fri, 1 Mar 2019 22:49:01 -0500 Subject: [PATCH] Added webConfigSetAdditionalCommentText, webConfigSetAdditionalMediaData, and webConfigSetMediaCreatorApplicationRatingAge. Improved web docs. --- nx/include/switch/applets/web.h | 29 +++++++++++++++++++++++++++-- nx/source/applets/web.c | 18 ++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/nx/include/switch/applets/web.h b/nx/include/switch/applets/web.h index 36ccc4c6..72a724f2 100644 --- a/nx/include/switch/applets/web.h +++ b/nx/include/switch/applets/web.h @@ -227,7 +227,7 @@ Result webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist); Result webConfigSetUserID(WebCommonConfig* config, u128 userID); /** - * @brief Sets the CapsAlbumEntry. + * @brief Sets the Share CapsAlbumEntry. * @note Only available with config created by \ref webShareCreate. * @param config WebCommonConfig object. * @param entry \ref CapsAlbumEntry @@ -349,7 +349,7 @@ Result webConfigSetMediaPlayerUserGestureRestriction(WebCommonConfig* config, bo Result webConfigSetLobbyParameter(WebCommonConfig* config, const char* str); /** - * @brief Sets the CapsApplicationAlbumEntry. + * @brief Sets the Share CapsApplicationAlbumEntry. * @note Only available with config created by \ref webShareCreate on [3.0.0+]. * @param config WebCommonConfig object. * @param entry \ref CapsApplicationAlbumEntry @@ -364,6 +364,14 @@ Result webConfigSetApplicationAlbumEntry(WebCommonConfig* config, CapsApplicatio */ Result webConfigSetJsExtension(WebCommonConfig* config, bool flag); +/** + * @brief Sets the Share AdditionalCommentText. + * @note Only available with config created by \ref webShareCreate on [4.0.0+]. + * @param config WebCommonConfig object. + * @param str String + */ +Result webConfigSetAdditionalCommentText(WebCommonConfig* config, const char* str); + /** * @brief Sets the TouchEnabledOnContents flag. * @note Only available with config created by \ref webPageCreate or with Offline-applet, on [4.0.0+]. @@ -380,6 +388,15 @@ Result webConfigSetTouchEnabledOnContents(WebCommonConfig* config, bool flag); */ Result webConfigSetUserAgentAdditionalString(WebCommonConfig* config, const char* str); +/** + * @brief Sets the Share AdditionalMediaData. + * @note Only available with config created by \ref webShareCreate on [4.0.0+]. + * @param config WebCommonConfig object. + * @param data Input data + * @param size Size of the input data, max size is 0x10. + */ +Result webConfigSetAdditionalMediaData(WebCommonConfig* config, const u8* data, size_t size); + /** * @brief Sets the MediaPlayerAutoClose flag. * @note Only available with config created by \ref webPageCreate on [4.0.0+]. @@ -420,6 +437,14 @@ Result webConfigSetFooterFixedKind(WebCommonConfig* config, u32 kind); */ Result webConfigSetPageFade(WebCommonConfig* config, bool flag); +/** + * @brief Sets the Share MediaCreatorApplicationRatingAge. + * @note Only available with config created by \ref webShareCreate on [5.0.0+]. + * @param config WebCommonConfig object. + * @param data 0x20-byte input data + */ +Result webConfigSetMediaCreatorApplicationRatingAge(WebCommonConfig* config, const s8 *data); + /** * @brief Sets the BootLoadingIcon flag. * @note Only available with Offline-applet on [5.0.0+]. diff --git a/nx/source/applets/web.c b/nx/source/applets/web.c index 5f4db225..d378e0dc 100644 --- a/nx/source/applets/web.c +++ b/nx/source/applets/web.c @@ -429,6 +429,12 @@ Result webConfigSetJsExtension(WebCommonConfig* config, bool flag) { return _webConfigSetFlag(config, WebArgType_JsExtension, flag); } +Result webConfigSetAdditionalCommentText(WebCommonConfig* config, const char* str) { + if (_webGetShimKind(config) != WebShimKind_Share) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(4,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + return _webConfigSetString(config, WebArgType_AdditionalCommentText, str, 0x100); +} + Result webConfigSetTouchEnabledOnContents(WebCommonConfig* config, bool flag) { WebShimKind shim = _webGetShimKind(config); if (shim != WebShimKind_Offline && shim != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); @@ -442,6 +448,12 @@ Result webConfigSetUserAgentAdditionalString(WebCommonConfig* config, const char return _webConfigSetString(config, WebArgType_UserAgentAdditionalString, str, 0x80); } +Result webConfigSetAdditionalMediaData(WebCommonConfig* config, const u8* data, size_t size) { + if (_webGetShimKind(config) != WebShimKind_Share) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(4,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + return _webTLVWrite(&config->arg, WebArgType_AdditionalMediaData, data, size, 0x10); +} + Result webConfigSetMediaPlayerAutoClose(WebCommonConfig* config, bool flag) { if (_webGetShimKind(config) != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); if (hosversionBefore(4,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); @@ -475,6 +487,12 @@ Result webConfigSetPageFade(WebCommonConfig* config, bool flag) { return _webConfigSetFlag(config, WebArgType_PageFade, flag); } +Result webConfigSetMediaCreatorApplicationRatingAge(WebCommonConfig* config, const s8 *data) { + if (_webGetShimKind(config) != WebShimKind_Share) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(5,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + return _webTLVSet(config, WebArgType_MediaCreatorApplicationRatingAge, data, 0x20); +} + Result webConfigSetBootLoadingIcon(WebCommonConfig* config, bool flag) { if (_webGetShimKind(config) != WebShimKind_Offline) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); if (hosversionBefore(5,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);