aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/facebook
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/facebook')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt16
2 files changed, 13 insertions, 5 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt
index e5216881..4d5127c5 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt
@@ -8,6 +8,6 @@ const val FACEBOOK_COM = "facebook.com"
const val FB_URL_BASE = "https://m.facebook.com/"
fun PROFILE_PICTURE_URL(id: Long) = "https://graph.facebook.com/$id/picture?type=large"
-const val USER_AGENT_BASIC_FULL = "Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG SM-G900T Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36"
+const val USER_AGENT_FULL = "Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG SM-G900T Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36"
const val USER_AGENT_BASIC = "Mozilla/5.0 (Linux; U; Android 2.3.3; en-gb; Nexus S Build/GRI20) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
const val USER_AGENT_MESSENGER = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36" \ No newline at end of file
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 e53bb202..622be067 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt
@@ -14,10 +14,10 @@ class FbUrlFormatter(url: String) {
init {
var cleanedUrl = url
- discardable.forEach { cleanedUrl = cleanedUrl.replace(it, "") }
+ discardable.forEach { cleanedUrl = cleanedUrl.replace(it, "", true) }
val changed = cleanedUrl != url //note that discardables strip away the first ?
- decoder.forEach { (k, v) -> cleanedUrl = cleanedUrl.replace(k, v) }
- val qm = cleanedUrl.indexOf(if (changed)"&" else "?")
+ decoder.forEach { (k, v) -> cleanedUrl = cleanedUrl.replace(k, v, true) }
+ val qm = cleanedUrl.indexOf(if (changed) "&" else "?")
if (qm > -1) {
cleanedUrl.substring(qm + 1).split("&").forEach {
val p = it.split("=")
@@ -72,7 +72,15 @@ class FbUrlFormatter(url: String) {
"%60" to "`", "%3B" to ";", "%2F" to "/", "%3F" to "?",
"%3A" to ":", "%40" to "@", "%3D" to "=", "%26" to "&",
"%24" to "$", "%2B" to "+", "%22" to "\"", "%2C" to ",",
- "%20" to " "
+ "%20" to " ",
+ //css
+ "\\3C " to "<", "\\3E " to ">", "\\23 " to "#", "\\25 " to "%",
+ "\\7B " to "{", "\\7D " to "}", "\\7C " to "|", "\\5C " to "\\",
+ "\\5E " to "^", "\\7E " to "~", "\\5B " to "[", "\\5D " to "]",
+ "\\60 " to "`", "\\3B " to ";", "\\2F " to "/", "\\3F " to "?",
+ "\\3A " to ":", "\\40 " to "@", "\\3D " to "=", "\\26 " to "&",
+ "\\24 " to "$", "\\2B " to "+", "\\22 " to "\"", "\\2C " to ",",
+ "\\20 " to " "
)
}
} \ No newline at end of file