Release v1.8.0
This commit is contained in:
parent
0d88d6f75e
commit
9919375111
@ -51,7 +51,7 @@ Requirements
|
||||
|
||||
Open Source Licenses
|
||||
-------------
|
||||
* __[ClearEditText](https://github.com/MrFuFuFu/ClearEditText)__ by *[Yuan Fu](https://github.com/MrFuFuFu)* - None
|
||||
* __[ClearEditText](https://github.com/MrFuFuFu/ClearEditText)__ by *[Yuan Fu](https://github.com/MrFuFuFu)* - [APL 2.0](https://github.com/MrFuFuFu/ClearEditText)
|
||||
* __[DNS66](https://github.com/julian-klode/dns66)__ by *[Julian Andres Klode](https://github.com/julian-klode)* - [GPLv3](https://github.com/julian-klode/dns66/blob/master/COPYING)
|
||||
* __[Pcap4J](https://github.com/kaitoy/pcap4j)__ by *[Kaito Yamada](https://github.com/kaitoy)* - [MIT](https://github.com/kaitoy/pcap4j)
|
||||
* __[MiniDNS](https://github.com/rtreffer/minidns)__ by *[Rene Treffer](https://github.com/rtreffer)* - [LGPLv2.1](https://github.com/rtreffer/minidns/blob/master/LICENCE_LGPL2.1)
|
||||
|
@ -10,8 +10,8 @@ android {
|
||||
applicationId "org.itxtech.daedalus"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 25
|
||||
versionCode 7
|
||||
versionName "1.7.0"
|
||||
versionCode 8
|
||||
versionName "1.8.0"
|
||||
|
||||
buildConfigField "String", "BUILD_TIME", "\"${System.currentTimeMillis()}\""
|
||||
buildConfigField "String", "GIT_COMMIT", "\"${gitCommit}\""
|
||||
|
@ -87,14 +87,15 @@
|
||||
<div style="font-size: 16px; color: gray;">Open Source Licenses</div>
|
||||
<br>
|
||||
<div style="font-size: 14px; color: gray;">
|
||||
<a href="https://github.com/MrFuFuFu/ClearEditText">ClearEditText</a>: None<br>
|
||||
<a href="https://github.com/MrFuFuFu/ClearEditText">ClearEditText</a>: <a
|
||||
href="https://github.com/MrFuFuFu/ClearEditText">APL 2.0</a><br>
|
||||
<a href="https://github.com/julian-klode/dns66">DNS66</a>: <a
|
||||
href="https://github.com/julian-klode/dns66/blob/master/COPYING">GPLv3</a><br>
|
||||
<a href="https://github.com/kaitoy/pcap4j">Pcap4J</a>: <a href="https://github.com/kaitoy/pcap4j">MIT</a><br>
|
||||
<a href="https://github.com/rtreffer/minidns">MiniDNS</a>: <a
|
||||
href="https://github.com/rtreffer/minidns/blob/master/LICENCE_LGPL2.1">LGPLv2.1</a><br>
|
||||
<a href="https://github.com/google/gson">Gson</a>: <a
|
||||
href="https://github.com/google/gson/blob/master/LICENSE">APL 2.0</a>
|
||||
href="https://github.com/google/gson/blob/master/LICENSE">APL 2.0</a><br>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -87,14 +87,15 @@
|
||||
<div style="font-size: 16px; color: gray;">Open Source Licenses</div>
|
||||
<br>
|
||||
<div style="font-size: 14px; color: gray;">
|
||||
<a href="https://github.com/MrFuFuFu/ClearEditText">ClearEditText</a>: None<br>
|
||||
<a href="https://github.com/MrFuFuFu/ClearEditText">ClearEditText</a>: <a
|
||||
href="https://github.com/MrFuFuFu/ClearEditText">APL 2.0</a><br>
|
||||
<a href="https://github.com/julian-klode/dns66">DNS66</a>: <a
|
||||
href="https://github.com/julian-klode/dns66/blob/master/COPYING">GPLv3</a><br>
|
||||
<a href="https://github.com/kaitoy/pcap4j">Pcap4J</a>: <a href="https://github.com/kaitoy/pcap4j">MIT</a><br>
|
||||
<a href="https://github.com/rtreffer/minidns">MiniDNS</a>: <a
|
||||
href="https://github.com/rtreffer/minidns/blob/master/LICENCE_LGPL2.1">LGPLv2.1</a><br>
|
||||
<a href="https://github.com/google/gson">Gson</a>: <a
|
||||
href="https://github.com/google/gson/blob/master/LICENSE">APL 2.0</a>
|
||||
href="https://github.com/google/gson/blob/master/LICENSE">APL 2.0</a><br>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -100,6 +100,8 @@ public class Daedalus extends Application {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
instance = this;
|
||||
|
||||
Logger.init();
|
||||
|
||||
mResolver = new Thread(new RulesResolver());
|
||||
@ -111,8 +113,6 @@ public class Daedalus extends Application {
|
||||
}
|
||||
|
||||
initData();
|
||||
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
|
@ -73,6 +73,16 @@ public class GlobalConfigFragment extends PreferenceFragment {
|
||||
}
|
||||
});
|
||||
|
||||
EditTextPreference logSize = (EditTextPreference) findPreference("settings_log_size");
|
||||
logSize.setSummary(logSize.getText());
|
||||
logSize.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
preference.setSummary((String) newValue);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
SwitchPreference advanced = (SwitchPreference) findPreference("settings_advanced_switch");
|
||||
advanced.setEnabled(false);
|
||||
@ -137,7 +147,9 @@ public class GlobalConfigFragment extends PreferenceFragment {
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
Snackbar.make(view, R.string.notice_legacy_api, Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
Snackbar.make(view, R.string.notice_legacy_api, Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,10 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.VpnService;
|
||||
import android.util.Log;
|
||||
import org.itxtech.daedalus.Daedalus;
|
||||
import org.itxtech.daedalus.service.DaedalusVpnService;
|
||||
import org.itxtech.daedalus.util.DnsServerHelper;
|
||||
import org.itxtech.daedalus.util.Logger;
|
||||
|
||||
/**
|
||||
* Daedalus Project
|
||||
@ -35,7 +35,7 @@ public class BootBroadcastReceiver extends BroadcastReceiver {
|
||||
|
||||
context.startService((new Intent(context, DaedalusVpnService.class)).setAction(DaedalusVpnService.ACTION_ACTIVATE));
|
||||
|
||||
Log.d("DBootRecv", "Triggered boot receiver");
|
||||
Logger.info("Triggered boot receiver");
|
||||
}
|
||||
|
||||
Daedalus.updateShortcut(context);
|
||||
|
@ -3,9 +3,9 @@ package org.itxtech.daedalus.receiver;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import org.itxtech.daedalus.Daedalus;
|
||||
import org.itxtech.daedalus.activity.MainActivity;
|
||||
import org.itxtech.daedalus.util.Logger;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
@ -38,7 +38,7 @@ public class StatusBarBroadcastReceiver extends BroadcastReceiver {
|
||||
Method collapse = statusBarManager.getClass().getMethod("collapsePanels");
|
||||
collapse.invoke(statusBarManager);
|
||||
} catch (Exception e) {
|
||||
Log.d("DStatusBarRecv", e.toString());
|
||||
Logger.logException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,9 @@ public class Configurations {
|
||||
Configurations config = null;
|
||||
try {
|
||||
config = Daedalus.parseJson(Configurations.class, new JsonReader(new FileReader(file)));
|
||||
} catch (Exception ignored) {
|
||||
Logger.info("Loading configuration successfully from " + file);
|
||||
} catch (Exception e) {
|
||||
Logger.logException(e);
|
||||
}
|
||||
|
||||
if (config == null) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.itxtech.daedalus.util;
|
||||
|
||||
import android.util.Log;
|
||||
import org.itxtech.daedalus.Daedalus;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
@ -19,30 +20,22 @@ import java.util.Date;
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
public class Logger {
|
||||
private static StringBuilder builder;
|
||||
private static StringBuffer buffer = null;
|
||||
|
||||
public static void init() {
|
||||
builder = new StringBuilder();
|
||||
if (buffer != null) {
|
||||
buffer.setLength(0);
|
||||
} else {
|
||||
buffer = new StringBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
public static void shutdown() {
|
||||
builder = null;
|
||||
buffer = null;
|
||||
}
|
||||
|
||||
public static String getLog() {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public static void emergency(String message) {
|
||||
send("[EMERGENCY] " + message);
|
||||
}
|
||||
|
||||
public static void alert(String message) {
|
||||
send("[ALERT] " + message);
|
||||
}
|
||||
|
||||
public static void critical(String message) {
|
||||
send("[CRITICAL] " + message);
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
public static void error(String message) {
|
||||
@ -53,10 +46,6 @@ public class Logger {
|
||||
send("[WARNING] " + message);
|
||||
}
|
||||
|
||||
public static void notice(String message) {
|
||||
send("[NOTICE] " + message);
|
||||
}
|
||||
|
||||
public static void info(String message) {
|
||||
send("[INFO] " + message);
|
||||
}
|
||||
@ -66,7 +55,7 @@ public class Logger {
|
||||
}
|
||||
|
||||
public static void logException(Throwable e) {
|
||||
alert(getExceptionMessage(e));
|
||||
error(getExceptionMessage(e));
|
||||
}
|
||||
|
||||
private static String getExceptionMessage(Throwable e) {
|
||||
@ -76,9 +65,33 @@ public class Logger {
|
||||
return stringWriter.toString();
|
||||
}
|
||||
|
||||
private static int getLogSizeLimit() {
|
||||
return Integer.parseInt(Daedalus.getPrefs().getString("settings_log_size", "10000"));
|
||||
}
|
||||
|
||||
private static boolean checkBufferSize() {
|
||||
int limit = getLogSizeLimit();
|
||||
if (limit == 0) {//DISABLED!
|
||||
return false;
|
||||
}
|
||||
if (limit == -1) {//N0 limit
|
||||
return true;
|
||||
}
|
||||
if (buffer.length() > limit) {//LET's clean it up!
|
||||
buffer.setLength(limit);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void send(String message) {
|
||||
String fileDateFormat = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss ").format(new Date());
|
||||
builder.insert(0, "\n").insert(0, message).insert(0, fileDateFormat);
|
||||
Log.d("Daedalus", message);
|
||||
try {
|
||||
if (checkBufferSize()) {
|
||||
String fileDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ").format(new Date());
|
||||
buffer.insert(0, "\n").insert(0, message).insert(0, fileDateFormat);
|
||||
}
|
||||
Log.d("Daedalus", message);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public class RulesResolver implements Runnable {
|
||||
for (String hostsFile : hostsFiles) {
|
||||
File file = new File(hostsFile);
|
||||
if (file.canRead()) {
|
||||
Logger.info("Loading hosts " + file.toString());
|
||||
Logger.info("Loading hosts from " + file.toString());
|
||||
FileInputStream stream = new FileInputStream(file);
|
||||
BufferedReader dataIO = new BufferedReader(new InputStreamReader(stream));
|
||||
String strLine;
|
||||
@ -120,7 +120,7 @@ public class RulesResolver implements Runnable {
|
||||
for (String dnsmasqFile : dnsmasqFiles) {
|
||||
File file = new File(dnsmasqFile);
|
||||
if (file.canRead()) {
|
||||
Logger.info("Loading DNSMasq configuration " + file.toString());
|
||||
Logger.info("Loading DNSMasq configuration from " + file.toString());
|
||||
FileInputStream stream = new FileInputStream(file);
|
||||
BufferedReader dataIO = new BufferedReader(new InputStreamReader(stream));
|
||||
String strLine;
|
||||
|
@ -75,4 +75,5 @@
|
||||
<string name="settings_manual_summary">访问 GitHub wiki 页面。</string>
|
||||
<string name="action_log">日志</string>
|
||||
<string name="action_refresh">刷新</string>
|
||||
<string name="settings_log_size">日志大小限制</string>
|
||||
</resources>
|
@ -74,4 +74,5 @@
|
||||
<string name="settings_manual_summary">Visit GitHub wiki page.</string>
|
||||
<string name="action_log">Log</string>
|
||||
<string name="action_refresh">Refresh</string>
|
||||
<string name="settings_log_size">Log size limit</string>
|
||||
</resources>
|
||||
|
@ -35,6 +35,13 @@
|
||||
android:key="settings_notification"
|
||||
android:title="@string/settings_notification"
|
||||
android:defaultValue="true"/>
|
||||
<EditTextPreference
|
||||
android:key="settings_log_size"
|
||||
android:selectAllOnFocus="false"
|
||||
android:singleLine="true"
|
||||
android:numeric="integer"
|
||||
android:defaultValue="10000"
|
||||
android:title="@string/settings_log_size"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
|
Loading…
Reference in New Issue
Block a user