Remove 1 or 2 hour library updates to avoid DDoSing sources

This commit is contained in:
arkon 2021-05-22 11:52:28 -04:00
parent 2f7f00c7a2
commit 569df39fb8
4 changed files with 10 additions and 6 deletions

View File

@ -29,7 +29,7 @@ android {
minSdkVersion(AndroidConfig.minSdk)
targetSdkVersion(AndroidConfig.targetSdk)
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
versionCode = 60
versionCode = 61
versionName = "0.10.12"
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")

View File

@ -182,6 +182,14 @@ object Migrations {
remove("pref_default_viewer_key")
}
}
if (oldVersion < 61) {
// Handle removed every 1 or 2 hour library updates
val updateInterval = preferences.libraryUpdateInterval().get()
if (updateInterval == 1 || updateInterval == 2) {
preferences.libraryUpdateInterval().set(3)
LibraryUpdateJob.setupTask(context, 3)
}
}
return true
}

View File

@ -126,8 +126,6 @@ class SettingsLibraryController : SettingsController() {
titleRes = R.string.pref_library_update_interval
entriesRes = arrayOf(
R.string.update_never,
R.string.update_1hour,
R.string.update_2hour,
R.string.update_3hour,
R.string.update_4hour,
R.string.update_6hour,
@ -137,7 +135,7 @@ class SettingsLibraryController : SettingsController() {
R.string.update_48hour,
R.string.update_weekly
)
entryValues = arrayOf("0", "1", "2", "3", "4", "6", "8", "12", "24", "48", "168")
entryValues = arrayOf("0", "3", "4", "6", "8", "12", "24", "48", "168")
defaultValue = "24"
summary = "%s"

View File

@ -198,8 +198,6 @@
<string name="pref_category_library_update">Global update</string>
<string name="pref_library_update_interval">Update frequency</string>
<string name="update_never">Manual</string>
<string name="update_1hour">Hourly</string>
<string name="update_2hour">Every 2 hours</string>
<string name="update_3hour">Every 3 hours</string>
<string name="update_4hour">Every 4 hours</string>
<string name="update_6hour">Every 6 hours</string>