mirror of
https://github.com/switchbrew/libnx.git
synced 2025-08-07 08:39:24 +02:00
Fixed WebWifiPageArg struct, improved web-wifi handling and added docs.
This commit is contained in:
parent
ee2e19ce38
commit
6c3f72929d
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file web.h
|
* @file web.h
|
||||||
* @brief Wrapper for using the WifiWebAuthApplet LibraryApplet.
|
* @brief Wrapper for using the WifiWebAuthApplet LibraryApplet.
|
||||||
* @author p-sam
|
* @author p-sam, yellows8
|
||||||
* @copyright libnx Authors
|
* @copyright libnx Authors
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -9,20 +9,30 @@
|
|||||||
#include "../services/applet.h"
|
#include "../services/applet.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u8 unk_x0[0x4];
|
u32 unk_x0; ///< Official sw sets this to 0 with appletStorageWrite, seperately from the rest of the config struct.
|
||||||
char url[0xFC];
|
char conntest_url[0x100];
|
||||||
} WebWifiPageArgUrl;
|
char initial_url[0x400];
|
||||||
|
u128 userID;
|
||||||
typedef struct {
|
u32 unk_x514;
|
||||||
WebWifiPageArgUrl url1;
|
} PACKED WebWifiPageArg;
|
||||||
WebWifiPageArgUrl url2;
|
|
||||||
u8 unk_x200[0x300];
|
|
||||||
u8 unk_x500[0x18];
|
|
||||||
} WebWifiPageArg;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
WebWifiPageArg arg;
|
WebWifiPageArg arg;
|
||||||
} WebWifiConfig;
|
} WebWifiConfig;
|
||||||
|
|
||||||
void webWifiCreate(WebWifiConfig* config, const char* url);
|
/**
|
||||||
|
* @brief Creates the config for WifiWebAuthApplet.
|
||||||
|
* @param config WebWifiConfig object.
|
||||||
|
* @param conntest_url URL used for the connection-test requests, if NULL initial_url is used for this.
|
||||||
|
* @param initial_url Initial URL navigated to by the applet.
|
||||||
|
* @param userID Account userID, 0 for common.
|
||||||
|
* @param unk Value written to \ref WebWifiPageArg unk_x514, this can be 0.
|
||||||
|
*/
|
||||||
|
void webWifiCreate(WebWifiConfig* config, const char* conntest_url, const char* initial_url, u128 userID, u32 unk);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Launches WifiWebAuthApplet with the specified config and waits for it to exit.
|
||||||
|
* @param config WebWifiConfig object.
|
||||||
|
*/
|
||||||
Result webWifiShow(WebWifiConfig* config);
|
Result webWifiShow(WebWifiConfig* config);
|
||||||
|
|
||||||
|
@ -6,14 +6,16 @@
|
|||||||
#include "applets/libapplet.h"
|
#include "applets/libapplet.h"
|
||||||
#include "applets/web.h"
|
#include "applets/web.h"
|
||||||
|
|
||||||
static void _webWifiUrlCreate(WebWifiPageArgUrl* argUrl, const char* url) {
|
void webWifiCreate(WebWifiConfig* config, const char* conntest_url, const char* initial_url, u128 userID, u32 unk) {
|
||||||
strncpy(argUrl->url, url, sizeof(argUrl->url)-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void webWifiCreate(WebWifiConfig* config, const char* url) {
|
|
||||||
memset(config, 0, sizeof(WebWifiConfig));
|
memset(config, 0, sizeof(WebWifiConfig));
|
||||||
_webWifiUrlCreate(&config->arg.url1, url);
|
|
||||||
_webWifiUrlCreate(&config->arg.url2, url);
|
if (conntest_url==NULL) conntest_url = initial_url;
|
||||||
|
|
||||||
|
strncpy(config->arg.conntest_url, conntest_url, sizeof(config->arg.conntest_url)-1);
|
||||||
|
strncpy(config->arg.initial_url, initial_url, sizeof(config->arg.initial_url)-1);
|
||||||
|
|
||||||
|
config->arg.userID = userID;
|
||||||
|
config->arg.unk_x514 = unk;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result webWifiShow(WebWifiConfig* config) {
|
Result webWifiShow(WebWifiConfig* config) {
|
||||||
|
Loading…
Reference in New Issue
Block a user