@@ -20,6 +20,7 @@
|
||||
#include "i18n.hpp"
|
||||
#include "ftpsrv_helper.hpp"
|
||||
#include "web.hpp"
|
||||
#include "swkbd.hpp"
|
||||
|
||||
#include <nanovg_dk.h>
|
||||
#include <minIni.h>
|
||||
@@ -1628,7 +1629,29 @@ void App::DisplayMiscOptions(bool left_side) {
|
||||
|
||||
if (App::IsApplication()) {
|
||||
options->Add(std::make_shared<ui::SidebarEntryCallback>("Web"_i18n, [](){
|
||||
WebShow("https://lite.duckduckgo.com/lite");
|
||||
// add some default entries, will use a config file soon so users can set their own.
|
||||
ui::PopupList::Items items;
|
||||
items.emplace_back("https://lite.duckduckgo.com/lite");
|
||||
items.emplace_back("https://dns.switchbru.com");
|
||||
items.emplace_back("https://gbatemp.net");
|
||||
items.emplace_back("https://github.com/ITotalJustice/sphaira/wiki");
|
||||
items.emplace_back("Enter custom URL"_i18n);
|
||||
|
||||
App::Push(std::make_shared<ui::PopupList>(
|
||||
"Select URL"_i18n, items, [items](auto op_index){
|
||||
if (op_index) {
|
||||
const auto index = *op_index;
|
||||
if (index == items.size() - 1) {
|
||||
std::string out;
|
||||
if (R_SUCCEEDED(swkbd::ShowText(out, "Enter URL", "https://")) && !out.empty()) {
|
||||
WebShow(out);
|
||||
}
|
||||
} else {
|
||||
WebShow(items[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
#include "web.hpp"
|
||||
#include "log.hpp"
|
||||
#include "app.hpp"
|
||||
#include "defines.hpp"
|
||||
#include <cstring>
|
||||
|
||||
namespace sphaira {
|
||||
|
||||
auto WebShow(const std::string& url, bool show_error) -> Result {
|
||||
// showError("Running in applet mode\nPlease launch hbmenu by holding R on an APP (e.g. a game) NOT an applet (e.g. Gallery)", "", 0);
|
||||
// showError("Error: Nag active, check more details", "Browser won't launch if supernag is active\n\nUse gagorder or switch-sys-tweak (the latter is bundled with BrowseNX) to disable supernag.", 0);
|
||||
// log_write("web show with url: %s\n", url.c_str());
|
||||
// return 0;
|
||||
auto WebShow(const std::string& url) -> Result {
|
||||
WebCommonConfig config{};
|
||||
WebCommonReply reply{};
|
||||
WebExitReason reason{};
|
||||
@@ -19,20 +16,30 @@ auto WebShow(const std::string& url, bool show_error) -> Result {
|
||||
|
||||
// WebBackgroundKind_Unknown1 = shows background
|
||||
// WebBackgroundKind_Unknown2 = shows background faded
|
||||
if (R_FAILED(accountTrySelectUserWithoutInteraction(&account_uid, false))) { log_write("failed: accountTrySelectUserWithoutInteraction\n"); }
|
||||
|
||||
if (R_FAILED(accountGetPreselectedUser(&account_uid))) {
|
||||
log_write("failed: accountGetPreselectedUser\n");
|
||||
if (R_FAILED(accountTrySelectUserWithoutInteraction(&account_uid, false))) {
|
||||
log_write("failed: accountTrySelectUserWithoutInteraction\n");
|
||||
if (R_FAILED(accountGetLastOpenedUser(&account_uid))) {
|
||||
log_write("failed: accountGetLastOpenedUser\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (R_FAILED(webPageCreate(&config, url.c_str()))) { log_write("failed: webPageCreate\n"); }
|
||||
if (R_FAILED(webConfigSetWhitelist(&config, "^http"))) { log_write("failed: webConfigSetWhitelist\n"); }
|
||||
if (R_FAILED(webConfigSetWhitelist(&config, ".*"))) { log_write("failed: webConfigSetWhitelist\n"); }
|
||||
if (R_FAILED(webConfigSetEcClientCert(&config, true))) { log_write("failed: webConfigSetEcClientCert\n"); }
|
||||
if (R_FAILED(webConfigSetScreenShot(&config, true))) { log_write("failed: webConfigSetScreenShot\n"); }
|
||||
if (R_FAILED(webConfigSetBootDisplayKind(&config, WebBootDisplayKind_Black))) { log_write("failed: webConfigSetBootDisplayKind\n"); }
|
||||
if (R_FAILED(webConfigSetBackgroundKind(&config, WebBackgroundKind_Default))) { log_write("failed: webConfigSetBackgroundKind\n"); }
|
||||
if (R_FAILED(webConfigSetPointer(&config, true))) { log_write("failed: webConfigSetPointer\n"); }
|
||||
if (R_FAILED(webConfigSetLeftStickMode(&config, WebLeftStickMode_Pointer))) { log_write("failed: webConfigSetLeftStickMode\n"); }
|
||||
// if (R_FAILED(webConfigSetBootAsMediaPlayer(&config, true))) { log_write("failed: webConfigSetBootAsMediaPlayer\n"); }
|
||||
if (R_FAILED(webConfigSetBootAsMediaPlayer(&config, false))) { log_write("failed: webConfigSetBootAsMediaPlayer\n"); }
|
||||
if (R_FAILED(webConfigSetJsExtension(&config, true))) { log_write("failed: webConfigSetJsExtension\n"); }
|
||||
if (R_FAILED(webConfigSetMediaPlayerAutoClose(&config, true))) { log_write("failed: webConfigSetMediaPlayerAutoClose\n"); }
|
||||
if (R_FAILED(webConfigSetMediaPlayerAutoClose(&config, false))) { log_write("failed: webConfigSetMediaPlayerAutoClose\n"); }
|
||||
if (R_FAILED(webConfigSetPageCache(&config, true))) { log_write("failed: webConfigSetPageCache\n"); }
|
||||
if (R_FAILED(webConfigSetFooterFixedKind(&config, WebFooterFixedKind_Hidden))) { log_write("failed: webConfigSetFooterFixedKind\n"); }
|
||||
if (R_FAILED(webConfigSetFooterFixedKind(&config, WebFooterFixedKind_Default))) { log_write("failed: webConfigSetFooterFixedKind\n"); }
|
||||
if (R_FAILED(webConfigSetPageFade(&config, true))) { log_write("failed: webConfigSetPageFade\n"); }
|
||||
if (R_FAILED(webConfigSetPageScrollIndicator(&config, true))) { log_write("failed: webConfigSetPageScrollIndicator\n"); }
|
||||
// if (R_FAILED(webConfigSetMediaPlayerSpeedControl(&config, true))) { log_write("failed: webConfigSetMediaPlayerSpeedControl\n"); }
|
||||
@@ -40,10 +47,11 @@ auto WebShow(const std::string& url, bool show_error) -> Result {
|
||||
if (R_FAILED(webConfigSetTransferMemory(&config, true))) { log_write("failed: webConfigSetTransferMemory\n"); }
|
||||
if (R_FAILED(webConfigSetTouchEnabledOnContents(&config, true))) { log_write("failed: webConfigSetTouchEnabledOnContents\n"); }
|
||||
// if (R_FAILED(webConfigSetMediaPlayerUi(&config, true))) { log_write("failed: webConfigSetMediaPlayerUi\n"); }
|
||||
// if (R_FAILED(webConfigSetWebAudio(&config, true))) { log_write("failed: webConfigSetWebAudio\n"); }
|
||||
if (R_FAILED(webConfigSetWebAudio(&config, false))) { log_write("failed: webConfigSetWebAudio\n"); }
|
||||
if (R_FAILED(webConfigSetPageCache(&config, true))) { log_write("failed: webConfigSetPageCache\n"); }
|
||||
if (R_FAILED(webConfigSetBootLoadingIcon(&config, true))) { log_write("failed: webConfigSetBootLoadingIcon\n"); }
|
||||
// if (R_FAILED(webConfigSetBootLoadingIcon(&config, true))) { log_write("failed: webConfigSetBootLoadingIcon\n"); }
|
||||
if (R_FAILED(webConfigSetUid(&config, account_uid))) { log_write("failed: webConfigSetUid\n"); }
|
||||
|
||||
if (R_FAILED(webConfigShow(&config, &reply))) { log_write("failed: webConfigShow\n"); }
|
||||
if (R_FAILED(webReplyGetExitReason(&reply, &reason))) { log_write("failed: webReplyGetExitReason\n"); }
|
||||
if (R_FAILED(webReplyGetLastUrl(&reply, last_url, sizeof(last_url), &last_url_len))) { log_write("failed: webReplyGetLastUrl\n"); }
|
||||
|
||||
Reference in New Issue
Block a user