diff options
author | Allan Wang <me@allanwang.ca> | 2017-12-31 12:44:17 -0500 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-12-31 12:44:17 -0500 |
commit | 442350ea476b4203bd9e006a63e20de7d57ad5c3 (patch) | |
tree | c91c6cde6425a9e0d61d7f2c3db786a288ebda86 /app/src/main/kotlin | |
parent | b556c42daa61c99c1a2f8de06e1c526425228450 (diff) | |
download | frost-442350ea476b4203bd9e006a63e20de7d57ad5c3.tar.gz frost-442350ea476b4203bd9e006a63e20de7d57ad5c3.tar.bz2 frost-442350ea476b4203bd9e006a63e20de7d57ad5c3.zip |
Use less aggressive link retrieval
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt | 20 |
1 files changed, 15 insertions, 5 deletions
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 72b2324a..92e1bd05 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt @@ -224,15 +224,25 @@ inline val String?.isVideoUrl */ inline val String?.isIndependent: Boolean get() { - if (this == null || length < 5) return false // ignore short queries - if (this[0] == '#' && !contains('/')) return false // ignore element values - if (startsWith("http") && !isFacebookUrl) return true // ignore non facebook urls - if (dependentSet.any { contains(it) }) return false // ignore known dependent segments + if (this == null || length < 5) return false // ignore short queries + if (this[0] == '#' && !contains('/')) return false // ignore element values + if (startsWith("http") && !isFacebookUrl) return true // ignore non facebook urls + if (independentSegments.any { contains(it) }) return true // known independent segments + if (this.startsWith("#!/")) return false // ignore these links for now + if (dependentSegments.any { contains(it) }) return false // ignore known dependent segments return true } -val dependentSet = setOf( +val independentSegments = arrayOf( + "messages/read/?tid=cid" +) + +val dependentSegments = arrayOf( "photoset_token", "direct_action_execute", "messages/?pageNum", "sharer.php", + /** + * Editing images + */ + "/confirmation/?", /* * Facebook messages have the following cases for the tid query * mid* or id* for newer threads, which can be launched in new windows |