From e804e7a77a6cac048d5f6edeac0a339ca89e4d40 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Wed, 22 Jul 2026 18:35:06 +0000 Subject: Add site login and alternate-source search for paywalled articles Deliberately not a paywall-bypass mechanism -- that space (archive.today-style proxies, "Bypass Paywalls" extensions) is legally grey, adversarial toward publishers, and constantly breaking. Instead: - BrowserScreen: a real interactive mini-browser (JS + DOM storage on, ordinary navigation, no Readability interception) for the two cases where the user needs to actually USE a page rather than read it. Reached from a new overflow menu on the article reader: - "Log in to this site" opens the article's own URL there so the user can sign into a site they already subscribe to. Needs no extra plumbing: Android's CookieManager is one process-wide store shared by every WebView in the app, so a session cookie set here is picked up automatically by the reader's (JS-off) extraction WebView on the next visit to that domain -- same as a normal browser remembering you're signed in. - "Find another source" runs a web search on the article's title in the same browser, so the user can pick a different, non-paywalled outlet covering the same story themselves -- plain search/discovery, not circumvention. Verified live: search opened a real, interactive Google results page with working title-bar sync; back navigation (via BackHandler, goBack() when the WebView has history, else pop the screen) returned cleanly to the article. --- app/src/main/java/org/terst/feedreader/ui/MainActivity.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'app/src/main/java/org/terst/feedreader/ui/MainActivity.kt') diff --git a/app/src/main/java/org/terst/feedreader/ui/MainActivity.kt b/app/src/main/java/org/terst/feedreader/ui/MainActivity.kt index 95ef71e..bd09393 100644 --- a/app/src/main/java/org/terst/feedreader/ui/MainActivity.kt +++ b/app/src/main/java/org/terst/feedreader/ui/MainActivity.kt @@ -1,6 +1,7 @@ package org.terst.feedreader.ui import android.os.Bundle +import android.webkit.CookieManager import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.compose.foundation.layout.fillMaxSize @@ -28,6 +29,9 @@ class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) FeedFetchWorker.schedulePeriodic(applicationContext) + // Explicit, even though it defaults on -- BrowserScreen relies on cookies set + // during a site login surviving into the reader's later extraction requests. + CookieManager.getInstance().setAcceptCookie(true) setContent { // Dark by default -- per user request, not following system light/dark for now. @@ -85,7 +89,8 @@ fun FeedReaderApp() { feedId = feedId, initialArticleId = articleId, onBack = { navController.popBackStack() }, - onOpenLink = { url -> navController.navigate("linkReader/${encodeNavArg(url)}") } + onOpenLink = { url -> navController.navigate("linkReader/${encodeNavArg(url)}") }, + onOpenBrowser = { url -> navController.navigate("browser/${encodeNavArg(url)}") } ) } composable( @@ -101,6 +106,13 @@ fun FeedReaderApp() { onOpenLink = { nextUrl -> navController.navigate("linkReader/${encodeNavArg(nextUrl)}") } ) } + composable( + "browser/{url}", + arguments = listOf(navArgument("url") { type = NavType.StringType }) + ) { backStackEntry -> + val url = decodeNavArg(backStackEntry.arguments?.getString("url") ?: "") + BrowserScreen(startUrl = url, onBack = { navController.popBackStack() }) + } composable("addFeed") { AddFeedScreen(onDone = { navController.popBackStack() }) } -- cgit v1.2.3