summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/org/terst/feedreader/data/AppDatabase.kt26
1 files changed, 24 insertions, 2 deletions
diff --git a/app/src/main/java/org/terst/feedreader/data/AppDatabase.kt b/app/src/main/java/org/terst/feedreader/data/AppDatabase.kt
index da68d3d..745148c 100644
--- a/app/src/main/java/org/terst/feedreader/data/AppDatabase.kt
+++ b/app/src/main/java/org/terst/feedreader/data/AppDatabase.kt
@@ -9,7 +9,7 @@ import androidx.room.migration.Migration
@Database(
entities = [FeedEntity::class, ArticleEntity::class, FilterRuleEntity::class],
- version = 7,
+ version = 8,
exportSchema = false
)
abstract class AppDatabase : RoomDatabase() {
@@ -135,12 +135,34 @@ abstract class AppDatabase : RoomDatabase() {
}
}
+ // v8: one more http feed turned out to have a real https home after all --
+ // blog.securitymouse.com's own TLS handshake is broken, but it's actually a Blogger
+ // blog under the hood (its feed XML is Blogger's own Atom format, "Server: GSE" on
+ // its homepage response), and Blogger blogs are always reachable at a stable,
+ // always-https URL keyed by blog ID regardless of a custom domain's own DNS/TLS setup.
+ // The other two hosts left over from v7 (bit-player.org, webpolicy.org) genuinely have
+ // no https path forward: webpolicy.org's feed itself is dead (last post 2015, long
+ // before this check), and bit-player.org's site was rebuilt on a static generator that
+ // no longer appears to expose a feed at any path (checked /feed, /feed/, /feed.xml,
+ // /rss, /atom.xml, and the homepage's own <link rel="alternate"> -- nothing).
+ private val MIGRATION_7_8 = object : Migration(7, 8) {
+ override fun migrate(db: SupportSQLiteDatabase) {
+ val oldUrl = "http://blog.securitymouse.com/feeds/posts/default"
+ val newUrl = "https://www.blogger.com/feeds/5803873077727212399/posts/default"
+ db.execSQL("UPDATE articles SET feedId = ? WHERE feedId = ?", arrayOf(newUrl, oldUrl))
+ db.execSQL("UPDATE feeds SET id = ? WHERE id = ?", arrayOf(newUrl, oldUrl))
+ }
+ }
+
fun get(context: Context): AppDatabase = instance ?: synchronized(this) {
instance ?: Room.databaseBuilder(
context.applicationContext,
AppDatabase::class.java,
"feedreader.db"
- ).addMigrations(MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4, MIGRATION_4_5, MIGRATION_5_6, MIGRATION_6_7).build().also { instance = it }
+ ).addMigrations(
+ MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4, MIGRATION_4_5,
+ MIGRATION_5_6, MIGRATION_6_7, MIGRATION_7_8
+ ).build().also { instance = it }
}
}
}