From 121f2cf8685cfcca66930a70bb595c9104642986 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Thu, 28 Feb 2019 22:15:18 -0500 Subject: [PATCH] Added webConfigSetScreenShot, and minor other web changes. --- nx/include/switch/applets/web.h | 9 +++++++++ nx/source/applets/web.c | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/nx/include/switch/applets/web.h b/nx/include/switch/applets/web.h index df3298bf..b3d0b748 100644 --- a/nx/include/switch/applets/web.h +++ b/nx/include/switch/applets/web.h @@ -78,6 +78,7 @@ typedef enum { WebArgType_UnknownD = 0xD, ///< [1.0.0+] u8 WebArgType_UserID = 0xE, ///< [1.0.0+] u128 userID, controls which user-specific savedata to mount. WebArgType_AlbumEntry = 0xF, ///< [1.0.0+] Share-applet caps AlbumEntry + WebArgType_ScreenShot = 0x10, ///< [1.0.0+] u8 bool WebArgType_EcClientCert = 0x11, ///< [1.0.0+] u8 bool WebArgType_Unknown12 = 0x12, ///< [1.0.0+] u8 WebArgType_PlayReport = 0x13, ///< [1.0.0+] u8 bool @@ -209,6 +210,14 @@ Result webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist); */ Result webConfigSetUserID(WebCommonConfig* config, u128 userID); +/** + * @brief Sets the ScreenShot flag, which controls whether screen-shot capture is allowed. + * @note Only available with config created by \ref webPageCreate. + * @param config WebCommonConfig object. + * @param flag Flag + */ +Result webConfigSetScreenShot(WebCommonConfig* config, bool flag); + /** * @brief Sets the EcClientCert flag. * @note Only available with config created by \ref webPageCreate or with Offline-applet. diff --git a/nx/source/applets/web.c b/nx/source/applets/web.c index dd51f1f8..84f426e7 100644 --- a/nx/source/applets/web.c +++ b/nx/source/applets/web.c @@ -251,10 +251,15 @@ Result webConfigSetUserID(WebCommonConfig* config, u128 userID) { return _webTLVSet(config, WebArgType_UserID, &userID, sizeof(userID)); } +Result webConfigSetScreenShot(WebCommonConfig* config, bool flag) { + if (_webGetShimKind(config) != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + return _webConfigSetFlag(config, WebArgType_ScreenShot, flag); +} + Result webConfigSetEcClientCert(WebCommonConfig* config, bool flag) { WebShimKind shim = _webGetShimKind(config); if (shim != WebShimKind_Offline && shim != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); - return _webConfigSetU8(config, WebArgType_EcClientCert, flag); + return _webConfigSetFlag(config, WebArgType_EcClientCert, flag); } Result webConfigSetBootDisplayKind(WebCommonConfig* config, u32 kind) {