mirror of
https://github.com/copyrighttxt/watrbx-game-engine.git
synced 2026-09-06 05:37:48 +00:00
GEEKING
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
#include "JNIUtil.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <jni.h>
|
||||
|
||||
#include <strings.h>
|
||||
|
||||
#include "FastLog.h"
|
||||
#include "util/Http.h"
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
LOGGROUP(Android)
|
||||
|
||||
using namespace RBX;
|
||||
using namespace RBX::JNI;
|
||||
|
||||
namespace RBX
|
||||
{
|
||||
namespace JNI
|
||||
{
|
||||
|
||||
} // namespace JNI
|
||||
} // namespace RBX
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
JNIEXPORT void JNICALL Java_wtf_watrbx_client_test_CurlTestHelper_initHttpJNI( JNIEnv* jenv, jclass obj) {
|
||||
|
||||
//__android_log_print(ANDROID_LOG_INFO, "InstrumentationTest", "JNIActivity initHttpJNI()");
|
||||
Http::init(Http::WinHttp, Http::CookieSharingSingleProcessMultipleThreads);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_wtf_watrbx_client_test_CurlTestHelper_getCookieStringJNI( JNIEnv* jenv, jclass obj) {
|
||||
std::string cookieStr;
|
||||
Http::getCookiesForDomain("watrbx.wtf", cookieStr);
|
||||
|
||||
//__android_log_print(ANDROID_LOG_INFO, "InstrumentationTest", "JNIActivity getCookieStringJNI() %s", cookieStr.c_str());
|
||||
return jenv->NewStringUTF(cookieStr.c_str());
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL Java_wtf_watrbx_client_test_CurlTestHelper_doCurlRequestJNI( JNIEnv* jenv, jclass obj, jstring jURL) {
|
||||
|
||||
std::string url = jstringToStdString(jenv, jURL);
|
||||
//__android_log_print(ANDROID_LOG_INFO, "InstrumentationTest", "JNIActivity doCurlRequestJNI() %s", url.c_str());
|
||||
Http http(url.c_str());
|
||||
|
||||
try
|
||||
{
|
||||
std::string response;
|
||||
bool externalRequest = url.find("watrbx.wtf") == std::string::npos && url.find("robloxlabs.com") == std::string::npos;
|
||||
http.get(response, externalRequest);
|
||||
FASTLOGS(FLog::Android, "nativeGetURL: %s", response.c_str());
|
||||
return jenv->NewStringUTF(response.c_str());
|
||||
}
|
||||
catch (const RBX::base_exception& e)
|
||||
{
|
||||
FASTLOGS(FLog::Android, "HTTP error: %s", e.what());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
Reference in New Issue
Block a user