Skip to content

Commit

Permalink
Update preset
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed Aug 28, 2023
1 parent c9ef22f commit d367402
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ object DataStore : OnPreferenceDataStoreChangeListener {
var showGroupInNotification by configurationStore.boolean("showGroupInNotification")

var remoteDns by configurationStore.string(Key.REMOTE_DNS) { "https://8.8.8.8/dns-query" }
var directDns by configurationStore.string(Key.DIRECT_DNS) { "https://223.5.5.5/dns-query" }
var directDns by configurationStore.string(Key.DIRECT_DNS) { "local" }
var enableDnsRouting by configurationStore.boolean(Key.ENABLE_DNS_ROUTING) { true }
var enableFakeDns by configurationStore.boolean(Key.ENABLE_FAKEDNS)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,23 +212,16 @@ object ProfileManager {
outbound = -2,
)
)
var country = Locale.getDefault().country.lowercase()
var displayCountry = Locale.getDefault().displayCountry
if (country in arrayOf(
"ir"
)
) {
createRule(
RuleEntity(
name = app.getString(R.string.route_bypass_domain, displayCountry),
domains = "domain:$country",
outbound = -1
), false
)
} else {
country = Locale.CHINA.country.lowercase()
displayCountry = Locale.CHINA.displayCountry
createRule(
val fuckedCountry = mutableListOf("cn:中国")
if (Locale.getDefault().country != Locale.CHINA.country) {
// 非中文用户
fuckedCountry += "ir:Iran"
}
for (c in fuckedCountry) {
val country = c.substringBefore(":")
val displayCountry = c.substringAfter(":")
//
if (country == "cn") createRule(
RuleEntity(
name = app.getString(R.string.route_play_store, displayCountry),
domains = "domain:googleapis.cn",
Expand All @@ -241,14 +234,14 @@ object ProfileManager {
outbound = -1
), false
)
createRule(
RuleEntity(
name = app.getString(R.string.route_bypass_ip, displayCountry),
ip = "geoip:$country",
outbound = -1
), false
)
}
createRule(
RuleEntity(
name = app.getString(R.string.route_bypass_ip, displayCountry),
ip = "geoip:$country",
outbound = -1
), false
)
rules = SagerDatabase.rulesDao.allRules()
}
return rules
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/io/nekohasekai/sagernet/ui/GroupFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,10 @@ class GroupFragment : ToolbarFragment(R.layout.layout_group),
subscriptionUpdateProgress.isIndeterminate = true
} else {
subscriptionUpdateProgress.isIndeterminate = false
val progress = GroupUpdater.progress[proxyGroup.id]!!
subscriptionUpdateProgress.max = progress.max
subscriptionUpdateProgress.progress = progress.progress
GroupUpdater.progress[proxyGroup.id]?.let {
subscriptionUpdateProgress.max = it.max
subscriptionUpdateProgress.progress = it.progress
}
}

updateButton.isInvisible = true
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/xml/global_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
app:title="@string/domain_strategy_for_remote"
app:useSimpleSummaryProvider="true" />
<EditTextPreference
app:defaultValue="https://223.5.5.5/dns-query"
app:defaultValue="local"
app:icon="@drawable/ic_action_dns"
app:key="directDns"
app:title="@string/direct_dns"
Expand Down

0 comments on commit d367402

Please sign in to comment.