diff options
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt | 12 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt | 14 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt | 21 | ||||
-rw-r--r-- | app/src/main/play/en-US/whatsnew | 3 | ||||
-rw-r--r-- | app/src/main/res/xml/frost_changelog.xml | 2 | ||||
-rw-r--r-- | app/src/web/scss/core/_core_bg.scss | 12 | ||||
-rw-r--r-- | app/src/web/scss/core/_core_border.scss | 14 | ||||
-rw-r--r-- | app/src/web/scss/core/_core_text.scss | 22 | ||||
-rw-r--r-- | docs/Changelog.md | 1 |
9 files changed, 68 insertions, 33 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt index 6208f401..16cbc9c8 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt @@ -16,6 +16,7 @@ */ package com.pitchedapps.frost.facebook +import android.net.Uri import com.pitchedapps.frost.utils.L import java.net.URLDecoder import java.nio.charset.StandardCharsets @@ -28,6 +29,12 @@ import java.nio.charset.StandardCharsets inline val String.formattedFbUrl: String get() = FbUrlFormatter(this).toString() +inline val Uri.formattedFbUri: Uri + get() { + val url = toString() + return if (url.startsWith("http")) Uri.parse(url.formattedFbUrl) else this + } + class FbUrlFormatter(url: String) { private val queries = mutableMapOf<String, String>() private val cleaned: String @@ -72,7 +79,10 @@ class FbUrlFormatter(url: String) { } discardableQueries.forEach { queries.remove(it) } if (cleanedUrl.startsWith("/")) cleanedUrl = FB_URL_BASE + cleanedUrl.substring(1) - cleanedUrl = cleanedUrl.replaceFirst(".facebook.com//", ".facebook.com/") //sometimes we are given a bad url + cleanedUrl = cleanedUrl.replaceFirst( + ".facebook.com//", + ".facebook.com/" + ) //sometimes we are given a bad url L.v { "Formatted url from $url to $cleanedUrl" } return cleanedUrl } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt index 8544aac3..0367457e 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt @@ -65,6 +65,7 @@ import com.pitchedapps.frost.facebook.FbCookie import com.pitchedapps.frost.facebook.FbItem import com.pitchedapps.frost.facebook.FbUrlFormatter.Companion.VIDEO_REDIRECT import com.pitchedapps.frost.facebook.USER_AGENT_DESKTOP +import com.pitchedapps.frost.facebook.formattedFbUri import com.pitchedapps.frost.facebook.formattedFbUrl import com.pitchedapps.frost.injectors.CssAssets import com.pitchedapps.frost.injectors.JsAssets @@ -270,9 +271,16 @@ fun Context.createPrivateMediaFile(extension: String) = createPrivateMediaFile(" */ fun Context.resolveActivityForUri(uri: Uri): Boolean { val url = uri.toString() - if (url.isFacebookUrl && !url.isExplicitIntent) return false - val intent = Intent(Intent.ACTION_VIEW, uri) - if (intent.resolveActivity(packageManager) == null) return false + if (url.isFacebookUrl && !url.isExplicitIntent) { + return false + } + val intent = Intent( + Intent.ACTION_VIEW, + uri.formattedFbUri + ) + if (intent.resolveActivity(packageManager) == null) { + return false + } startActivity(intent) return true } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt index 85914f33..ecedc997 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt @@ -54,7 +54,10 @@ import kotlinx.coroutines.channels.SendChannel */ open class BaseWebViewClient : WebViewClient() { - override fun shouldInterceptRequest(view: WebView, request: WebResourceRequest): WebResourceResponse? = + override fun shouldInterceptRequest( + view: WebView, + request: WebResourceRequest + ): WebResourceResponse? = view.shouldFrostInterceptRequest(request) } @@ -173,12 +176,18 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() { view.context.resolveActivityForUri(request.url) return true } - if (path.startsWith("/composer/")) return launchRequest(request) - if (url.isImageUrl) - return launchImage(url.formattedFbUrl) - if (url.isIndirectImageUrl) + if (path.startsWith("/composer/")) { + return launchRequest(request) + } + if (url.isIndirectImageUrl) { return launchImage(url.formattedFbUrl, cookie = FbCookie.webCookie) - if (Prefs.linksInDefaultApp && view.context.resolveActivityForUri(request.url)) return true + } + if (url.isImageUrl) { + return launchImage(url.formattedFbUrl) + } + if (Prefs.linksInDefaultApp && view.context.resolveActivityForUri(request.url)) { + return true + } return super.shouldOverrideUrlLoading(view, request) } } diff --git a/app/src/main/play/en-US/whatsnew b/app/src/main/play/en-US/whatsnew index d2b73404..a9aab7e3 100644 --- a/app/src/main/play/en-US/whatsnew +++ b/app/src/main/play/en-US/whatsnew @@ -2,4 +2,5 @@ v2.3.2 * Disable auto feed refresh by default and add setting to re-enable it * Update theme -* Disable bugsnag completely when opting out of analytics
\ No newline at end of file +* Disable bugsnag completely when opting out of analytics +* Filter urls before sending to other apps
\ No newline at end of file diff --git a/app/src/main/res/xml/frost_changelog.xml b/app/src/main/res/xml/frost_changelog.xml index 09bb9d2e..21140984 100644 --- a/app/src/main/res/xml/frost_changelog.xml +++ b/app/src/main/res/xml/frost_changelog.xml @@ -11,7 +11,7 @@ <item text="Disable auto feed refresh by default and add setting to re-enable it" /> <item text="Update theme" /> <item text="Disable bugsnag completely when opting out of analytics" /> - <item text="" /> + <item text="Filter urls before sending to other apps" /> <item text="" /> <item text="" /> diff --git a/app/src/web/scss/core/_core_bg.scss b/app/src/web/scss/core/_core_bg.scss index 5c50bf69..17c93b7b 100644 --- a/app/src/web/scss/core/_core_bg.scss +++ b/app/src/web/scss/core/_core_bg.scss @@ -2,10 +2,10 @@ background: $background !important; } -body, :root, #root, #header, #MComposer, ._1upc, input, ._2f9r, ._59e9, ._5pz4, ._5lp4, +html, body, :root, #root, #header, #MComposer, ._1upc, input, ._2f9r, ._59e9, ._5pz4, ._5lp4, div[style*="background-color: #FFFFFF"], ._5lp5, .container, .subpage, ._5n_f, #static_templates, ._22_8, ._1t4h, ._uoq, ._3qdh, ._8ca, ._3h8i, ._6-l ._2us7, ._6-l ._6-p:not([style*="background-image:"]), ._333v, div.sharerSelector, ._529j, ._305j, ._1pph, ._3t_l, ._4pvz, -._1g05, .acy, ._51-g, ._533c, ._ib-, .sharerAttachmentEmpty, .sharerBottomWrapper, ._24e1, ._-j7, +._1g05, .acy, ._51-g, ._533c, ._ib-, .sharerAttachmentEmpty, .sharerBottomWrapper, ._24e1, ._3bg5 ._56do, ._5hfh, ._52e-, .mQuestionsPollResultsBar, ._5hoc, ._5oxw, ._32_4, ._1hiz, ._38do, .bo, .cq, ._234-, ._a-5, ._2zh4, ._15ks, ._3oyc, ._36dc, ._3iyw ._3iyx, ._6bes, ._55wo, ._4-dy, .tlBody, #timelineBody, .timelineX, .timeline, .feed, .tlPrelude, .tlFeedPlaceholder, ._4_d0, @@ -17,9 +17,9 @@ body, :root, #root, #header, #MComposer, ._1upc, input, ._2f9r, ._59e9, ._5pz4, ._5c9u, div._5y57::before, ._59f6._55so::before, .structuredPublisher, ._94v, ._vqv, ._5lp5, ._55wm, ._2om3, ._2ol-, ._1f9d, ._vee, ._31a-, ._3r8b, ._3r9d, ._5vq5, ._3tl8, ._65wz, ._4edl, .acw, ._4_xl, ._1p70, ._1p70, ._1ih_, ._51v6, ._u2c, ._484w, ._3ils, ._rm7, ._32qk, ._d01, ._1glm, -._ue6, ._hdn._hdn, ._6vzw, ._77xj, ._38nq, ._9_7, ._51li, ._7hkf, ._6vzz, +._ue6, ._hdn._hdn, ._6vzw, ._77xj, ._38nq, ._9_7, ._51li, ._7hkf, ._6vzz, ._3iyw ._37fb, ._2y60, ._5fu3, ._2foa, ._2y5_, ._38o9, ._1kb, .mAppCenterFatLabel, ._3bmj, ._5zmb, ._2x2s, ._3kac, ._3kad, -._3f50, .mentions-placeholder, .mentions, .mentions-measurer, .acg, ._59tu, +._3f50, .mentions-placeholder, .mentions, .mentions-measurer, .acg, ._59tu, ._7lcm, ._7kxh, ._4l9b, ._4gj3, .groupChromeView, ._i3g, ._3jcf, .error, ._1dbp, ._5zma, ._6beq, ._vi6, ._uww, textarea, ._15n_, ._skt, ._5f28, ._14_j, ._3bg5, ._53_-, ._52x1, ._35au, ._cwy, ._1rfn ._1rfk ._4vc-, ._1rfk, ._1rfk ._2v9s, ._301x { @@ -27,7 +27,7 @@ body, :root, #root, #header, #MComposer, ._1upc, input, ._2f9r, ._59e9, ._5pz4, } //card related -._31nf, ._2v9s, ._d4i, article._55wo, ._10c_, ._2jl2, ._6150, ._50mi, ._4-dw, ._4_2z, ._5m_s, ._13fn { +._31nf, ._2v9s, ._d4i, article._55wo, ._10c_, ._2jl2, ._6150, ._50mi, ._4-dw, ._4_2z, ._5m_s, ._13fn, ._7kxe { background: $card !important; } @@ -46,7 +46,7 @@ body, :root, #root, #header, #MComposer, ._1upc, input, ._2f9r, ._59e9, ._5pz4, background: transparent !important; } -.jewel, .flyout, ._52z5, ._13e_, ._5-lw, ._5c0e, .jx-result, ._336p, .mentions-suggest-item, ._2suk, +.jewel, .flyout, ._52z5, ._13e_, ._5-lw, ._5c0e, .jx-result, ._336p, .mentions-suggest-item, ._2suk, ._-j7, .mentions-suggest, ._1xoz, ._1xow { background: $bg_opaque !important; } diff --git a/app/src/web/scss/core/_core_border.scss b/app/src/web/scss/core/_core_border.scss index 9f2bdec0..c7d21adf 100644 --- a/app/src/web/scss/core/_core_border.scss +++ b/app/src/web/scss/core/_core_border.scss @@ -1,5 +1,6 @@ //border between like and comment ._15kl::before, ._37fd .inlineComposerButton, ._1hb:before, +._pfn ._pfo::before, ._5j35::after, ._2k4b, ._3to7, ._4nw8 { border-left: 1px solid $divider !important; } @@ -13,12 +14,13 @@ ._2pbp, ._5rou:first-child, ._egf:first-child, ._io2, ._3qdi ._48_m::after, ._46dd::before, ._15n_, ._3-2-, ._27ve, ._2s20, ._gui, ._2s21 > *::after, ._32qk, ._d00, ._d01, ._38o9, ._3u9t, ._55fj, .mEventProfileSection.useBorder td, ._3ils, ._5as0, ._5as2, ._5-lw, +._2s1_:before, ._143z::before, ._143z::after, ._52x1, ._3wjp, ._usq, ._2cul:before, ._13e_, .jewel .flyout, ._3bg5 ._52x6, ._56d8, .al { border-top: 1px solid $divider !important; } ._15ny::after, ._z-w, ._8i2, ._2nk0, ._22_8, ._1t4h, ._37fd, ._1ha, ._3bg5 ._56do, ._8he, -._400s, ._5hoc, ._1bhn, ._5ag6, ._4pvz, +._400s, ._5hoc, ._1bhn, ._5ag6, ._4pvz, ._31y5, ._301x, ._x08 ._x0a:after, ._36dc, ._6-l ._57jn, ._527k, ._g_k, ._577z:not(:last-child) ._ygd, ._3u9u, ._3mgz, ._52x6, ._2066, ._5luf, ._2bdc, ._3ci9, .mAppCenterFatLabel, .appCenterCategorySelectorButton, ._1q6v, ._5q_r, ._5yt8, ._38do, ._38dt, @@ -31,7 +33,7 @@ border-bottom: 1px solid $divider !important; } -.item a.primary.touched .primarywrap, ._4dwt ._5y33, ._1ih_, ._5_50, ._6beq, ._69aj, +.item a.primary.touched .primarywrap, ._4dwt ._5y33, ._1ih_, ._5_50, ._6beq, ._69aj, ._3iyw ._37fb, ._5fjv, ._3on6, ._2u4w, ._2om3, ._2ol-, ._5fjw, ._4z83, ._1gkq, ._4-dy { border-top: 1px solid $divider !important; border-bottom: 1px solid $divider !important; @@ -44,8 +46,8 @@ ._2q7w, .acy, ._58ak, ._3t_l, ._4msa, ._3h8i, ._3clk, ._1kt6, ._1ksq, ._1_y5, ._lr0, ._5hgt, ._2cpp, ._50uu, ._50uw, ._31yd, ._1e3d, ._3xz7, ._1xoz, ._4kcb, ._2lut, .jewel .touchable-notification.touched, .touchable-notification .touchable.touched, -.home-notification .touchable.touched, ._6beo ._6ber, -._73ku ._73jw, ._6--d, ._26vk._56bt, +.home-notification .touchable.touched, ._6beo ._6ber, ._7kxg, +._73ku ._73jw, ._6--d, ._26vk._56bt, ._3iyw ._2whz ._13-g, ._-jx, ._4e8n, ._uww, .mentions-placeholder, .mentions-shadow, .mentions-measurer, ._5whq, ._59tt, ._41ft::after, .jx-tokenizer, ._3uqf, ._4756, ._1rrd, ._5n_f { border: 1px solid $divider !important; @@ -92,3 +94,7 @@ ._484w.selected > ._6zf, ._5kqs::after, ._3lvo ._5xum._5xuk, ._x0b { border-bottom: 1px solid $text !important; } + +._484w.selected ._6zf { + border-bottom: 2px solid $accent !important; +} diff --git a/app/src/web/scss/core/_core_text.scss b/app/src/web/scss/core/_core_text.scss index 871fddcc..b8cb74a0 100644 --- a/app/src/web/scss/core/_core_text.scss +++ b/app/src/web/scss/core/_core_text.scss @@ -1,13 +1,13 @@ -body, input, ._42rv, ._4qau, ._dwm .descArea, ._eu5, +html, body, input, ._42rv, ._4qau, ._dwm .descArea, ._eu5, ._1tcc, ._3g9-, ._29z_, ._3xz7, ._ib-, ._3bg5 ._56dq, ._477i, ._2vxk, .touched *, ._1_yj, ._1_yl, ._4pj9, ._2bdc, ._3qdh ._3qdn ._3qdk, ._3qdk ._48_q, ._z-z, ._z-v, ._1e8d, ._36nl, ._36nm, ._2_11, ._2_rf, ._2ip_, ._403p, .cq, ._usr, ._5xu2, ._3ml8, ._3mla, ._50vk, ._1m2u, ._31y7, ._4kcb, ._1lf6, ._1lf5, -._1lf4, ._1hiz, ._xod, ._5ag5, ._zmk, ._3t_h, ._5lm6, ._3clv, ._3zlc, ._36rd, -._31zk, ._31zl, ._3xsa, ._3xs9, ._2-4s, ._2fzz ul, ._3z10, ._4mo, ._2om6, -._43mh, .touch .btn, .fcg, button, ._52j9, ._52jb, ._52ja, ._5j35, ._ctg, -._rnk, ._24u0, ._1g06, ._14ye, .fcb, ._56cz._56c_, ._1gk_, ._55fj, ._45fu, -._18qg, ._1_ac, ._529p, ._4dwt ._1vh3, ._4a5f, ._23_t, ._2rzc, ._23_s, ._2rzd, +._1lf4, ._1hiz, ._xod, ._5ag5, ._zmk, ._3t_h, ._5lm6, ._3clv, ._3zlc, ._36rd, ._6oby, +._31zk, ._31zl, ._3xsa, ._3xs9, ._2-4s, ._2fzz ul, ._3z10, ._4mo, ._2om6, ._33r5, ._82y3, ._82y1, +._43mh, .touch .btn, .fcg, button, ._52j9, ._52jb, ._52ja, ._5j35, ._ctg, ._5300, ._5302, +._rnk, ._24u0, ._1g06, ._14ye, .fcb, ._56cz._56c_, ._1gk_, ._55fj, ._45fu, ._7kx4, ._20zd, ._egh, ._egi, +._18qg, ._1_ac, ._529p, ._4dwt ._1vh3, ._4a5f, ._23_t, ._2rzc, ._23_s, ._2rzd, ._6obp, ._2iiu, ._1s06, ._5aga, ._5ag9, ._537a, .acy, ._5ro_, ._6-l ._2us7, ._4mp, ._2b08, ._36e0, ._4-dy, ._14v5 ._14v8, ._1440, ._1442, ._1448, ._4ks_, .mCount, ._27vc, ._24e1, ._2rbw, ._3iyw ._3mzw, textarea:not([style*="color: rgb"]), ._24pi, ._4en9, ._1kb, ._5p7j, ._2klz, ._5780, ._5781, ._5782, @@ -16,17 +16,17 @@ textarea:not([style*="color: rgb"]), ._24pi, ._4en9, ._1kb, ._5p7j, ._2klz, ._57 ._27vp, ._4nwe, ._4nw9, ._27vi, .appCenterAppInfo, .appCenterPermissions, ._6xqt, ._7cui, ._3c9l, ._3c9m, ._4jn_, ._32qt, ._3mom, ._3moo, ._-7o, ._d00, ._d01, ._559g, ._7cdj, ._2new, .appCenterCategorySelectorButton, ._1ksq, ._1kt6, ._6ber, ._mxb, ._3oyd, ._3gir, ._3gis, -div.sharerSelector, .footer, ._4pv_, ._1dbp, ._3kad, ._20zc, ._2i5v, ._2i5w, -a, ._5fpq, ._4gux, ._3bg5 ._52x1, ._3bg5 ._52x2, ._6dsj ._3gin, ._hdn._hdn, +div.sharerSelector, .footer, ._4pv_, ._1dbp, ._3kad, ._20zc, ._2i5v, ._2i5w, ._6zf, ._mhg, +a, ._5fpq, ._4gux, ._3bg5 ._52x1, ._3bg5 ._52x2, ._6dsj ._3gin, ._hdn._hdn, ._3iyw ._2whz ._13-g, .mentions-input:not([style*="color: rgb"]), .mentions-placeholder:not([style*="color: rgb"]), -.largeStatusBox .placeHolder, .fcw, ._2rgt, ._67i4 ._5hu6 ._59tt, ._2bu3, ._2bu4, -._5-7t, .fcl, ._4qas, .thread-title, .title, ._46pa, ._336p, ._1rrd, ._2om4, +.largeStatusBox .placeHolder, .fcw, ._2rgt, ._67i4 ._5hu6 ._59tt, ._2bu3, ._2bu4, ._1ii2, ._1ii3, +._5-7t, .fcl, ._4qas, .thread-title, .title, ._46pa, ._336p, ._1rrd, ._2om4, ._4yxo, ._3m1m, ._2om2, ._5n_e, .appListExplanation, ._5yt8, ._8he, ._2luw, ._5rgs, h1, h2, h3, h4, h5, h6 { color: $text !important; } -strong > a, ._15ks ._2q8z._2q8z, ._1e3e, .blueName, ._5kqs ._55sr { +strong > a, a[data-sigil~="unlike"], ._15ks ._2q8z._2q8z, ._1e3e, .blueName, ._5kqs ._55sr, ._484w.selected ._6zf { color: $accent !important; } diff --git a/docs/Changelog.md b/docs/Changelog.md index 949eb8d4..a04a5f2c 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -4,6 +4,7 @@ * Disable auto feed refresh by default and add setting to re-enable it * Update theme * Disable bugsnag completely when opting out of analytics +* Filter urls before sending to other apps ## v2.3.1 * Hide all story panels if enabled |