mirror of https://github.com/NekoX-Dev/NekoX.git
喵 (
This commit is contained in:
parent
0a40561006
commit
ab981c93ff
|
@ -191,11 +191,11 @@ public class SharedConfig {
|
|||
|
||||
if (StrUtil.isBlank(remarks)) {
|
||||
|
||||
return (isPublic ? LocaleController.getString("PublicPrefix",R.string.PublicPrefix) : "[MTProto] ") + address + ":" + port;
|
||||
return (isPublic ? LocaleController.getString("PublicPrefix", R.string.PublicPrefix) : "[MTProto] ") + address + ":" + port;
|
||||
|
||||
} else {
|
||||
|
||||
return (isPublic ? LocaleController.getString("PublicPrefix",R.string.PublicPrefix) : "[MTProto] ") + remarks;
|
||||
return (isPublic ? LocaleController.getString("PublicPrefix", R.string.PublicPrefix) : "[MTProto] ") + remarks;
|
||||
|
||||
}
|
||||
|
||||
|
@ -439,11 +439,11 @@ public class SharedConfig {
|
|||
|
||||
if (StrUtil.isBlank(getRemarks())) {
|
||||
|
||||
return (isPublic ? LocaleController.getString("PublicPrefix",R.string.PublicPrefix) : "[Vmess] ") + bean.getAddress() + ":" + bean.getPort();
|
||||
return (isPublic ? LocaleController.getString("PublicPrefix", R.string.PublicPrefix) : "[Vmess] ") + bean.getAddress() + ":" + bean.getPort();
|
||||
|
||||
} else {
|
||||
|
||||
return (isPublic ? LocaleController.getString("PublicPrefix",R.string.PublicPrefix) : "[Vmess] ") + getRemarks();
|
||||
return (isPublic ? LocaleController.getString("PublicPrefix", R.string.PublicPrefix) : "[Vmess] ") + getRemarks();
|
||||
|
||||
}
|
||||
|
||||
|
@ -541,11 +541,11 @@ public class SharedConfig {
|
|||
|
||||
if (StrUtil.isBlank(getRemarks())) {
|
||||
|
||||
return (isPublic ? LocaleController.getString("PublicPrefix",R.string.PublicPrefix) : "[SS] ") + bean.getHost() + ":" + bean.getRemotePort();
|
||||
return (isPublic ? LocaleController.getString("PublicPrefix", R.string.PublicPrefix) : "[SS] ") + bean.getHost() + ":" + bean.getRemotePort();
|
||||
|
||||
} else {
|
||||
|
||||
return (isPublic ? LocaleController.getString("PublicPrefix",R.string.PublicPrefix) : "[SS] ") + getRemarks();
|
||||
return (isPublic ? LocaleController.getString("PublicPrefix", R.string.PublicPrefix) : "[SS] ") + getRemarks();
|
||||
|
||||
}
|
||||
|
||||
|
@ -646,11 +646,11 @@ public class SharedConfig {
|
|||
|
||||
if (StrUtil.isBlank(getRemarks())) {
|
||||
|
||||
return (isPublic ? LocaleController.getString("PublicPrefix",R.string.PublicPrefix) : "[SSR] ") + bean.getHost() + ":" + bean.getRemotePort();
|
||||
return (isPublic ? LocaleController.getString("PublicPrefix", R.string.PublicPrefix) : "[SSR] ") + bean.getHost() + ":" + bean.getRemotePort();
|
||||
|
||||
} else {
|
||||
|
||||
return (isPublic ? LocaleController.getString("PublicPrefix",R.string.PublicPrefix) : "[SSR] ") + getRemarks();
|
||||
return (isPublic ? LocaleController.getString("PublicPrefix", R.string.PublicPrefix) : "[SSR] ") + getRemarks();
|
||||
|
||||
}
|
||||
|
||||
|
@ -1358,7 +1358,7 @@ public class SharedConfig {
|
|||
|
||||
public static void setProxyEnable(boolean enable) {
|
||||
|
||||
UIUtil.runOnUIThread(() -> {
|
||||
UIUtil.runOnIoDispatcher(() -> {
|
||||
|
||||
proxyEnabled = enable;
|
||||
|
||||
|
@ -1634,20 +1634,18 @@ public class SharedConfig {
|
|||
UIUtil.runOnIoDispatcher(() -> {
|
||||
|
||||
JSONArray proxyArray = new JSONArray();
|
||||
for (ProxyInfo info : proxyList) {
|
||||
try {
|
||||
JSONObject obj = info.toJson();
|
||||
if (info == currentProxy) {
|
||||
obj.put("current", true);
|
||||
|
||||
synchronized (sync) {
|
||||
for (ProxyInfo info : new LinkedList<>(proxyList)) {
|
||||
try {
|
||||
JSONObject obj = info.toJson();
|
||||
if (info.isInternal) {
|
||||
obj.put("internal", true);
|
||||
continue;
|
||||
}
|
||||
} else if (info.isInternal) {
|
||||
continue;
|
||||
proxyArray.put(obj);
|
||||
} catch (JSONException e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
proxyArray.put(obj);
|
||||
} catch (JSONException e) {
|
||||
FileLog.e(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1663,11 +1661,13 @@ public class SharedConfig {
|
|||
}
|
||||
|
||||
public static ProxyInfo addProxy(ProxyInfo proxyInfo) {
|
||||
int count = proxyList.size();
|
||||
for (int a = 0; a < count; a++) {
|
||||
ProxyInfo info = proxyList.get(a);
|
||||
if (info.equals(proxyInfo)) {
|
||||
return info;
|
||||
synchronized (sync) {
|
||||
int count = proxyList.size();
|
||||
for (int a = 0; a < count; a++) {
|
||||
ProxyInfo info = proxyList.get(a);
|
||||
if (info.equals(proxyInfo)) {
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
proxyList.add(proxyInfo);
|
||||
|
@ -1676,6 +1676,7 @@ public class SharedConfig {
|
|||
}
|
||||
|
||||
public static void deleteProxy(ProxyInfo proxyInfo) {
|
||||
|
||||
if (currentProxy == proxyInfo) {
|
||||
currentProxy = null;
|
||||
if (proxyEnabled) {
|
||||
|
|
|
@ -10,7 +10,6 @@ package org.telegram.ui;
|
|||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
@ -83,7 +82,6 @@ import tw.nekomimi.nekogram.VmessSettingsActivity;
|
|||
import tw.nekomimi.nekogram.utils.AlertUtil;
|
||||
import tw.nekomimi.nekogram.utils.FileUtil;
|
||||
import tw.nekomimi.nekogram.utils.ProxyUtil;
|
||||
import tw.nekomimi.nekogram.utils.StrUtil;
|
||||
import tw.nekomimi.nekogram.utils.UIUtil;
|
||||
|
||||
public class ProxyListActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
||||
|
@ -537,15 +535,15 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
updateRows(true);
|
||||
});
|
||||
} else if (id == menu_delete_unavailable) {
|
||||
AlertUtil.showConfirm(getParentActivity(),
|
||||
LocaleController.getString("DeleteUnavailableServer", R.string.DeleteUnavailableServer),
|
||||
LocaleController.getString("DeleteUnavailableServerConfirm", R.string.DeleteUnavailableServerConfirm),
|
||||
LocaleController.getString("Delete", R.string.Delete),
|
||||
true, (d, v) -> {
|
||||
SharedConfig.deleteUnavailableProxy();
|
||||
updateRows(true);
|
||||
});
|
||||
}
|
||||
AlertUtil.showConfirm(getParentActivity(),
|
||||
LocaleController.getString("DeleteUnavailableServer", R.string.DeleteUnavailableServer),
|
||||
LocaleController.getString("DeleteUnavailableServerConfirm", R.string.DeleteUnavailableServerConfirm),
|
||||
LocaleController.getString("Delete", R.string.Delete),
|
||||
true, (d, v) -> {
|
||||
SharedConfig.deleteUnavailableProxy();
|
||||
updateRows(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1013,6 +1011,17 @@ public class ProxyListActivity extends BaseFragment implements NotificationCente
|
|||
proxyInfo.checking = false;
|
||||
proxyInfo.available = false;
|
||||
proxyInfo.ping = 0;
|
||||
|
||||
if (proxyInfo.isPublic) {
|
||||
|
||||
if (SharedConfig.currentProxy != proxyInfo) {
|
||||
|
||||
SharedConfig.proxyList.remove(proxyInfo);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxyCheckDone, proxyInfo);
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue