aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/facebook
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-09-07 18:15:53 -0700
committerAllan Wang <me@allanwang.ca>2019-09-07 18:15:53 -0700
commit9363d4bc987cb7b4886ffb6a863b5d14c602e402 (patch)
tree3da405d9012b8a8f0fb58899cd670e60471bf015 /app/src/main/kotlin/com/pitchedapps/frost/facebook
parente736b53094629c4250c536170e938c625f5dc03c (diff)
downloadfrost-9363d4bc987cb7b4886ffb6a863b5d14c602e402.tar.gz
frost-9363d4bc987cb7b4886ffb6a863b5d14c602e402.tar.bz2
frost-9363d4bc987cb7b4886ffb6a863b5d14c602e402.zip
Remove desktop and mobile user agent def
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/facebook')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt10
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt4
2 files changed, 10 insertions, 4 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 032ff31e..c01bce55 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbConst.kt
@@ -28,6 +28,13 @@ fun profilePictureUrl(id: Long) = "https://graph.facebook.com/$id/picture?type=l
const val FB_LOGIN_URL = "${FB_URL_BASE}login"
const val FB_HOME_URL = "${FB_URL_BASE}home.php"
+/*
+ * User agent candidates.
+ * For those building from source, you can feel free to set the used agent to one of these options.
+ * Following https://github.com/AllanWang/Frost-for-Facebook/pull/1531, we do not support multiple
+ * agents per login session.
+ */
+
// Default user agent
private const val USER_AGENT_MOBILE_CONST =
"Mozilla/5.0 (Linux; Android 8.0.0; ONEPLUS A3000) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.90 Mobile Safari/537.36"
@@ -35,8 +42,7 @@ private const val USER_AGENT_MOBILE_CONST =
private const val USER_AGENT_DESKTOP_CONST =
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.90 Safari/537.36"
-const val USER_AGENT_MOBILE = USER_AGENT_DESKTOP_CONST
-const val USER_AGENT_DESKTOP = USER_AGENT_DESKTOP_CONST
+const val USER_AGENT = USER_AGENT_DESKTOP_CONST
/**
* Animation transition delay, just to ensure that the styles
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt
index 8a89b973..b948506f 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/FbRequest.kt
@@ -22,7 +22,7 @@ import com.pitchedapps.frost.facebook.FB_JSON_URL_MATCHER
import com.pitchedapps.frost.facebook.FB_REV_MATCHER
import com.pitchedapps.frost.facebook.FB_URL_BASE
import com.pitchedapps.frost.facebook.FB_USER_MATCHER
-import com.pitchedapps.frost.facebook.USER_AGENT_DESKTOP
+import com.pitchedapps.frost.facebook.USER_AGENT
import com.pitchedapps.frost.facebook.get
import com.pitchedapps.frost.kotlin.Flyweight
import com.pitchedapps.frost.utils.L
@@ -97,7 +97,7 @@ internal fun List<Pair<String, Any?>>.withEmptyData(vararg key: String): List<Pa
internal fun String?.requestBuilder(): Request.Builder {
val builder = Request.Builder()
- .header("User-Agent", USER_AGENT_DESKTOP)
+ .header("User-Agent", USER_AGENT)
if (this != null)
builder.header("Cookie", this)
// .cacheControl(CacheControl.FORCE_NETWORK)