add request ua & add tile long press action

This commit is contained in:
Kr328 committed 2020-02-20 14:44:05 +08:00
1 parent 1e8cadb878
commit 932778b153
4 files changed
+18 -1

No files matched your search

+3
View File
@@ -26,6 +26,9 @@
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" />
</intent-filter>
</activity>
<activity
android:name=".ApkBrokenActivity"
+4
View File
@@ -22,3 +22,7 @@ func Reset() {
profile.LoadDefault()
tunnel.DefaultManager.ResetStatistic()
}
func SetApplicationVersion(version string) {
profile.ApplicationVersion = version
}
+10 -1
View File
@@ -15,6 +15,8 @@ import (
"github.com/Dreamacro/clash/tunnel"
)
var ApplicationVersion = "Unknown"
const defaultFileMode = 0600
var client = &http.Client{
@@ -45,7 +47,14 @@ var client = &http.Client{
}
func DownloadAndCheck(url, output, baseDir string) error {
response, err := client.Get(url)
request, err := http.NewRequest("GET", url, nil)
if err != nil {
return err
}
request.Header.Set("User-Agent", "ClashForAndroid/"+ApplicationVersion)
response, err := client.Do(request)
if err != nil {
return err
}
@@ -31,6 +31,7 @@ object Clash {
Bridge.loadMMDB(bytes)
Bridge.setHome(context.cacheDir.absolutePath)
Bridge.setApplicationVersion(BuildConfig.VERSION_NAME)
Bridge.reset()
Log.d("MMDB loaded ${bytes.size}")