From dc3cf7084eee528bf25b0f237623b1a3d9e95242 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Fri, 1 Mar 2019 22:17:11 -0500 Subject: [PATCH] Added webConfigSetAlbumEntry and webConfigSetApplicationAlbumEntry. --- nx/include/switch/applets/web.h | 17 +++++++++++++++++ nx/source/applets/web.c | 12 ++++++++++++ 2 files changed, 29 insertions(+) diff --git a/nx/include/switch/applets/web.h b/nx/include/switch/applets/web.h index 23e6baea..1533c9cf 100644 --- a/nx/include/switch/applets/web.h +++ b/nx/include/switch/applets/web.h @@ -7,6 +7,7 @@ #pragma once #include "../types.h" #include "../services/applet.h" +#include "../services/caps.h" /// This indicates the type of web-applet. typedef enum { @@ -226,6 +227,14 @@ Result webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist); */ Result webConfigSetUserID(WebCommonConfig* config, u128 userID); +/** + * @brief Sets the CapsAlbumEntry. + * @note Only available with config created by \ref webShareCreate. + * @param config WebCommonConfig object. + * @param entry \ref CapsAlbumEntry + */ +Result webConfigSetAlbumEntry(WebCommonConfig* config, CapsAlbumEntry *entry); + /** * @brief Sets the ScreenShot flag, which controls whether screen-shot capture is allowed. * @note Only available with config created by \ref webPageCreate. @@ -340,6 +349,14 @@ Result webConfigSetMediaPlayerUserGestureRestriction(WebCommonConfig* config, bo */ Result webConfigSetLobbyParameter(WebCommonConfig* config, const char* str); +/** + * @brief Sets the CapsApplicationAlbumEntry. + * @note Only available with config created by \ref webShareCreate on [3.0.0+]. + * @param config WebCommonConfig object. + * @param entry \ref CapsApplicationAlbumEntry + */ +Result webConfigSetApplicationAlbumEntry(WebCommonConfig* config, CapsApplicationAlbumEntry *entry); + /** * @brief Sets whether JsExtension is enabled. * @note Only available with config created by \ref webPageCreate or with Offline-applet, on [3.0.0+]. diff --git a/nx/source/applets/web.c b/nx/source/applets/web.c index aa5b6f16..bec4a9d6 100644 --- a/nx/source/applets/web.c +++ b/nx/source/applets/web.c @@ -2,6 +2,7 @@ #include #include "types.h" #include "result.h" +#include "services/caps.h" #include "services/applet.h" #include "applets/libapplet.h" #include "applets/web.h" @@ -322,6 +323,11 @@ Result webConfigSetUserID(WebCommonConfig* config, u128 userID) { return _webTLVSet(config, WebArgType_UserID, &userID, sizeof(userID)); } +Result webConfigSetAlbumEntry(WebCommonConfig* config, CapsAlbumEntry *entry) { + if (_webGetShimKind(config) != WebShimKind_Share) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + return _webTLVSet(config, WebArgType_AlbumEntry, entry, sizeof(*entry)); +} + Result webConfigSetScreenShot(WebCommonConfig* config, bool flag) { if (_webGetShimKind(config) != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); return _webConfigSetFlag(config, WebArgType_ScreenShot, flag); @@ -411,6 +417,12 @@ Result webConfigSetLobbyParameter(WebCommonConfig* config, const char* str) { return _webConfigSetString(config, WebArgType_LobbyParameter, str, 0x100); } +Result webConfigSetApplicationAlbumEntry(WebCommonConfig* config, CapsApplicationAlbumEntry *entry) { + if (_webGetShimKind(config) != WebShimKind_Share) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized); + if (hosversionBefore(3,0,0)) return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + return _webTLVSet(config, WebArgType_ApplicationAlbumEntry, entry, sizeof(*entry)); +} + Result webConfigSetJsExtension(WebCommonConfig* config, bool flag) { WebShimKind shim = _webGetShimKind(config); if (shim != WebShimKind_Offline && shim != WebShimKind_Web) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);