diff --git a/.gitignore b/.gitignore index 20c9d6e..808656c 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ titles/8000000000001071/Cookie.dat titles/8000000000001071/dataco.txt titles/8000000000001071/VisitedLink.dat titles/8000000000001071/WebStorage.dat +source/DBY.h diff --git a/out/RipJKAnimeNX.nro b/out/RipJKAnimeNX.nro index d7c19d8..e77d76d 100644 Binary files a/out/RipJKAnimeNX.nro and b/out/RipJKAnimeNX.nro differ diff --git a/source/Networking.cpp b/source/Networking.cpp index 8b2e7c0..9012b5d 100644 --- a/source/Networking.cpp +++ b/source/Networking.cpp @@ -137,22 +137,6 @@ int progress_func_str(void* ptr, double TotalToDownload, double NowDownloaded,do namespace Net { //string UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"; string UserAgent = "Mozilla/5.0 (Nintendo Switch; WebApplet) AppleWebKit/609.4 (KHTML, like Gecko) NF/6.0.2.22.5 NintendoBrowser/5.1.0.23519"; -/* -bool init(){ - //this is to ge the user agent of browser WIP - bool change = false; - string UserAgentSet = "UserAgent"+DInfo["Firmware"].get(); - if (isset(BD,UserAgentSet)) { - UserAgent = BD[UserAgentSet].get(); - } else { - string id = DInfo["DeviceID"].get(); - WebBrowserCall("https://????/?set="+id,false); - BD[UserAgentSet] = GET("https://????/?get="+id); - change = true; - } - return change; -} -*/ int DebugNet = 1; //0 no debug , 1 some debug, 2 All debug //Simplification @@ -320,6 +304,19 @@ bool DOWNLOAD(string url,string path,bool progress){ return allok; } +bool Bypass(){ + #if __has_include("Debug.h") + //just for tests + #include "DBY.h" + #else + //just open the browser + WebBrowserCall("https://jkanime.net",false); + #endif + GetCookies(); + return change; +} + + bool HasConnection(){ NifmInternetConnectionType connectionType; NifmInternetConnectionStatus connectionStatus; diff --git a/source/Networking.hpp b/source/Networking.hpp index 4f8cfdf..e42e8a3 100644 --- a/source/Networking.hpp +++ b/source/Networking.hpp @@ -10,6 +10,7 @@ using json = nlohmann::json; namespace Net { bool HasConnection(); +bool Bypass(); json REQUEST(string url,string POSTFIEL="",bool HEADR=false,bool Verify=false); bool DOWNLOAD(string url,string path,bool progress = true); diff --git a/source/extra.hpp b/source/extra.hpp index 8976bac..98a6c33 100644 --- a/source/extra.hpp +++ b/source/extra.hpp @@ -40,6 +40,7 @@ string CDNURL = "cdn.jkdesu.com"; bool ClFlock = false; bool Mromfs=true; bool ThemeNeedUpdate=false; +bool reloadmain = false; //Screen dimension constants const int SCREEN_WIDTH = 1280, SCREEN_HEIGHT = 720; diff --git a/source/main.cpp b/source/main.cpp index 5f1f21e..36203b8 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -927,12 +927,13 @@ int main(int argc, char **argv) //clock cicle 15s if (inTimeN(15000)) { isConnected=Net::HasConnection(); + } if (ClFlock){ //CloudFlare protege este sitio asi q lo abrimos en en navegador - WebBrowserCall("https://jkanime.net/",false); - GetCookies(); + Net::Bypass(); ClFlock = false; + reloadmain = true; } if (!isConnected) { gTextTexture.loadFromRenderedText(GOD.digi_16, "Sin Internet", {255,0,0}); @@ -956,7 +957,8 @@ int main(int argc, char **argv) if (Frames>1000) Frames=0; if (Frames>0) Frames++; //Update tik - if (inTimeN(1260000)) { + if (inTimeN(1260000) || reloadmain) { + reloadmain = false; if (Net::HasConnection()) { if(!isChained) { cout << "Reloading Animes" << endl; diff --git a/source/utils.hpp b/source/utils.hpp index 179b155..5aaaeff 100644 --- a/source/utils.hpp +++ b/source/utils.hpp @@ -77,6 +77,7 @@ extern string CDNURL; extern bool ClFlock; extern bool Mromfs; extern bool ThemeNeedUpdate; +extern bool reloadmain; //Screen dimension constants extern const int SCREEN_WIDTH, SCREEN_HEIGHT;