android-client 1.4.1: Russian sites direct by default
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.pca.phobos.vpn"
|
||||
android:versionCode="140"
|
||||
android:versionName="1.4.0">
|
||||
android:versionCode="141"
|
||||
android:versionName="1.4.1">
|
||||
|
||||
<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="35" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
2
android-client/assets/ru_bypass.txt
Normal file
2
android-client/assets/ru_bypass.txt
Normal file
File diff suppressed because one or more lines are too long
@@ -14,7 +14,7 @@ rm -rf build && mkdir -p build/res build/classes build/dex build/aar build/apk/l
|
||||
unzip -q "$AAR" -d build/aar
|
||||
LIBS="build/aar/classes.jar:$(ls libs/*.jar | tr '\n' ':')"
|
||||
"$BT/aapt2" compile --dir res -o build/res/
|
||||
"$BT/aapt2" link -o build/base.apk -I "$JAR" --manifest AndroidManifest.xml \
|
||||
"$BT/aapt2" link -o build/base.apk -I "$JAR" --manifest AndroidManifest.xml -A assets \
|
||||
--java build/gen build/res/*.flat --min-sdk-version 24 --target-sdk-version 35
|
||||
javac -source 11 -target 11 -nowarn -classpath "$JAR:$LIBS" -d build/classes \
|
||||
$(find src build/gen -name '*.java') 2>&1 | grep -v "bootstrap classpath\|^Note:" || true
|
||||
|
||||
@@ -190,13 +190,29 @@ public class MainActivity extends Activity {
|
||||
sb.append("ExcludedApplications = ").append(String.join(", ", ex)).append('\n');
|
||||
}
|
||||
sb.append("\n[Peer]\n");
|
||||
String ruBypass = prefs != null && prefs.getBoolean("ru_direct", true) ? ruBypassAllowedIps() : null;
|
||||
for (String ln : section(conf, "[Peer]")) {
|
||||
if (key(ln).equals("endpoint")) ln = "Endpoint = 127.0.0.1:" + LPORT;
|
||||
if (key(ln).equals("allowedips") && ruBypass != null) ln = "AllowedIPs = " + ruBypass;
|
||||
sb.append(ln).append('\n');
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private String ruCache;
|
||||
|
||||
/** Internet minus Russian networks (assets/ru_bypass.txt, generated from ipdeny). */
|
||||
private String ruBypassAllowedIps() {
|
||||
if (ruCache != null) return ruCache;
|
||||
try (BufferedReader r = new BufferedReader(new java.io.InputStreamReader(
|
||||
getAssets().open("ru_bypass.txt"), StandardCharsets.UTF_8))) {
|
||||
for (String ln; (ln = r.readLine()) != null; ) {
|
||||
if (!ln.startsWith("#") && ln.contains("/")) { ruCache = ln.trim(); break; }
|
||||
}
|
||||
} catch (Exception e) { log("ru_bypass: " + e); }
|
||||
return ruCache;
|
||||
}
|
||||
|
||||
private static String getPackageNameSafe() { return "com.pca.phobos.vpn"; }
|
||||
|
||||
private String obfPart(String conf) {
|
||||
@@ -342,6 +358,12 @@ public class MainActivity extends Activity {
|
||||
rg.addView(r);
|
||||
}
|
||||
split.addView(rg);
|
||||
android.widget.CheckBox ru = new android.widget.CheckBox(this);
|
||||
ru.setText("Российские сайты — напрямую, без VPN");
|
||||
ru.setTextColor(text());
|
||||
ru.setChecked(prefs.getBoolean("ru_direct", true));
|
||||
ru.setOnCheckedChangeListener((b, on) -> { prefs.edit().putBoolean("ru_direct", on).apply(); applyIfUp(); });
|
||||
split.addView(ru, mw(4));
|
||||
int n = prefs.getString("apps", "").isEmpty() ? 0 : prefs.getString("apps", "").split(",").length;
|
||||
split.addView(button("Выбрать приложения (" + n + ")", 0xFF475569, v -> pickApps()), mw(8));
|
||||
split.addView(tv("Изменения применяются сразу. Само приложение всегда идёт напрямую — так обфускатор держит связь с сервером.",
|
||||
@@ -431,8 +453,12 @@ public class MainActivity extends Activity {
|
||||
|
||||
private static String tail(File f, int max) {
|
||||
try {
|
||||
byte[] b = java.nio.file.Files.readAllBytes(f.toPath());
|
||||
String t = new String(b, StandardCharsets.UTF_8);
|
||||
java.io.ByteArrayOutputStream o = new java.io.ByteArrayOutputStream();
|
||||
try (java.io.FileInputStream in = new java.io.FileInputStream(f)) {
|
||||
byte[] buf = new byte[8192];
|
||||
for (int n; (n = in.read(buf)) > 0; ) o.write(buf, 0, n);
|
||||
}
|
||||
String t = new String(o.toByteArray(), StandardCharsets.UTF_8);
|
||||
return t.length() > max ? t.substring(t.length() - max) : t;
|
||||
} catch (Exception e) { return ""; }
|
||||
}
|
||||
|
||||
8664
server/data/ru-aggregated.zone
Normal file
8664
server/data/ru-aggregated.zone
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user