Added webConfigSetUserID, and internal web adjustments.

This commit is contained in:
yellows8 2019-02-27 22:48:48 -05:00
parent 526441a547
commit 6736053ae1
2 changed files with 18 additions and 4 deletions

View File

@ -191,6 +191,14 @@ Result webConfigSetCallbackableUrl(WebCommonConfig* config, const char* url);
*/
Result webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist);
/**
* @brief Sets the account UserID. Controls which user-specific savedata to mount.
* @note Only available with config created by \ref webPageCreate, or with Share-applet/Lobby-applet.
* @param config WebCommonConfig object.
* @param userID Account userID
*/
Result webConfigSetUserID(WebCommonConfig* config, u128 userID);
/**
* @brief Sets the EcClientCert flag.
* @note Only available with config created by \ref webPageCreate or with Offline-applet.

View File

@ -141,12 +141,12 @@ static Result _webTLVWrite(WebCommonTLVStorage *storage, u16 type, const void* a
return 0;
}
static Result _webTLVSet(WebCommonTLVStorage *storage, u16 type, const void* argdata, u16 argdata_size) {
return _webTLVWrite(storage, type, argdata, argdata_size, argdata_size);
static Result _webTLVSet(WebCommonConfig* config, u16 type, const void* argdata, u16 argdata_size) {
return _webTLVWrite(&config->arg, type, argdata, argdata_size, argdata_size);
}
static Result _webConfigSetU8(WebCommonConfig* config, u16 type, u8 arg) {
return _webTLVSet(&config->arg, type, &arg, sizeof(arg));
return _webTLVSet(config, type, &arg, sizeof(arg));
}
static Result _webConfigSetFlag(WebCommonConfig* config, u16 type, bool arg) {
@ -154,7 +154,7 @@ static Result _webConfigSetFlag(WebCommonConfig* config, u16 type, bool arg) {
}
static Result _webConfigSetU32(WebCommonConfig* config, u16 type, u32 arg) {
return _webTLVSet(&config->arg, type, &arg, sizeof(arg));
return _webTLVSet(config, type, &arg, sizeof(arg));
}
static Result _webConfigSetString(WebCommonConfig* config, u16 type, const char* str, u16 argdata_size_total) {
@ -225,6 +225,12 @@ Result webConfigSetWhitelist(WebCommonConfig* config, const char* whitelist) {
return _webConfigSetString(config, WebArgType_Whitelist, whitelist, 0x1000);
}
Result webConfigSetUserID(WebCommonConfig* config, u128 userID) {
WebShimKind shim = _webGetShimKind(config);
if (shim != WebShimKind_Share && shim != WebShimKind_Web && shim != WebShimKind_Lobby) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
return _webTLVSet(config, WebArgType_UserID, &userID, sizeof(userID));
}
Result webConfigSetEcClientCert(WebCommonConfig* config, bool flag) {
WebShimKind shim = _webGetShimKind(config);
if (shim != WebShimKind_Web && shim != WebShimKind_Offline) return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);