Based on Nekogram. Key additions: - Rebrand to FoxiGram (app name, APK name, applicationId com.foxigram.app) - Embedded Xray (VLESS+Reality) proxy client via JNI libxray.so - Bundled hidden one-tap proxies (LTE + WiFi), read-only in UI - Auto-restore proxy on restart, rebind to active network (LTE/WiFi) - Server credentials externalized to git-ignored XrayServers.java (+ template) - libxray Go source included; compiled .so, keystore, google-services.json ignored
34 lines
970 B
C++
34 lines
970 B
C++
#include <jni.h>
|
|
#include <sys/stat.h>
|
|
#include <climits>
|
|
#include <unistd.h>
|
|
#include <string>
|
|
|
|
#include <android/log.h>
|
|
|
|
|
|
thread_local static char buf[PATH_MAX + 1];
|
|
|
|
extern "C" JNIEXPORT jstring Java_org_telegram_messenger_Utilities_readlink(JNIEnv *env, jclass clazz, jstring path) {
|
|
const char *fileName = env->GetStringUTFChars(path, NULL);
|
|
ssize_t result = readlink(fileName, buf, PATH_MAX);
|
|
jstring value = 0;
|
|
if (result != -1) {
|
|
buf[result] = '\0';
|
|
value = env->NewStringUTF(buf);
|
|
}
|
|
env->ReleaseStringUTFChars(path, fileName);
|
|
return value;
|
|
}
|
|
|
|
extern "C" JNIEXPORT jstring Java_org_telegram_messenger_Utilities_readlinkFd(JNIEnv *env, jclass clazz, int fd) {
|
|
std::string path = "/proc/self/fd/";
|
|
path += fd;
|
|
ssize_t result = readlink(path.c_str(), buf, PATH_MAX);
|
|
jstring value = 0;
|
|
if (result != -1) {
|
|
buf[result] = '\0';
|
|
value = env->NewStringUTF(buf);
|
|
}
|
|
return value;
|
|
}
|