Skip to content

Commit

Permalink
Enhance FilterParser and AndroidManifest for Junk Feed Support
Browse files Browse the repository at this point in the history
- Added support for the "junk" feed type in FilterParser, allowing filters to include junk items.
- Updated regex patterns to accommodate the new "junk" type in feed and tag parsing.
- Modified AndroidManifest to handle HTTP and HTTPS schemes for the "/junk" path on pr0gramm.com.
  • Loading branch information
G4m813R authored and mopsalarm committed Dec 24, 2024
1 parent 2016529 commit 0775ddf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 8 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@
android:host="pr0gramm.com"
android:pathPrefix="/stalk"
android:scheme="https" />
<data
android:host="pr0gramm.com"
android:pathPrefix="/junk"
android:scheme="http" />
<data
android:host="pr0gramm.com"
android:pathPrefix="/junk"
android:scheme="https" />
<data
android:host="pr0gramm.com"
android:pathPrefix="/user"
Expand Down
12 changes: 8 additions & 4 deletions app/src/main/java/com/pr0gramm/app/ui/FilterParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ object FilterParser {
filter = filter.withFeedType(FeedType.STALK)
}

if (values["type"] == "junk") {
filter = filter.withFeedType(FeedType.JUNK).withShowJunk(true)
}

val tag = values["tag"]
val user = values["user"]

Expand Down Expand Up @@ -85,16 +89,16 @@ object FilterParser {

private val reCommentSuffix = ":comment[0-9]+$".toRegex()

private val pFeed = Pattern.compile("^/(?<type>new|top|stalk)$")
private val pFeedId = Pattern.compile("^/(?<type>new|top|stalk)/(?<id>[0-9]+)$")
private val pFeed = Pattern.compile("^/(?<type>new|top|stalk|junk)$")
private val pFeedId = Pattern.compile("^/(?<type>new|top|stalk|junk)/(?<id>[0-9]+)$")
private val pUser = Pattern.compile("^/user/(?<user>[^/]+)/?$")
private val pUserUploads = Pattern.compile("^/user/(?<user>[^/]+)/(?<subcategory>uploads|[^/]+)/?$")
private val pUserUploadsId = Pattern.compile("^/user/(?<user>[^/]+)/(?<subcategory>uploads|[^/]+)/(?<id>[0-9]+)$")
private val pUserUploadsWithTag = Pattern.compile("^/user/(?<user>[^/]+)/(?<subcategory>uploads)/(?<tag>[^/]+)$")
private val pUserUploadsWithTagId =
Pattern.compile("^/user/(?<user>[^/]+)/(?<subcategory>uploads|[^/]+)/(?<tag>[^/]+)/(?<id>[0-9]+)$")
private val pTag = Pattern.compile("^/(?<type>new|top)/(?<tag>[^/]+)$")
private val pTagId = Pattern.compile("^/(?<type>new|top)/(?<tag>[^/]+)/(?<id>[0-9]+)$")
private val pTag = Pattern.compile("^/(?<type>new|top|junk)/(?<tag>[^/]+)$")
private val pTagId = Pattern.compile("^/(?<type>new|top|junk)/(?<tag>[^/]+)/(?<id>[0-9]+)$")

private val patterns = listOf(
pFeed,
Expand Down

0 comments on commit 0775ddf

Please sign in to comment.