forked from mirrors/Fedilab
Remove fake user agent
This commit is contained in:
parent
6f8ca561bf
commit
6f288acbc9
4 changed files with 10 additions and 11 deletions
|
@ -136,8 +136,8 @@ public class WebviewConnectActivity extends BaseActivity {
|
|||
|
||||
clearCookies(WebviewConnectActivity.this);
|
||||
binding.webviewConnect.getSettings().setJavaScriptEnabled(true);
|
||||
String user_agent = sharedpreferences.getString(getString(R.string.SET_CUSTOM_USER_AGENT), Helper.USER_AGENT);
|
||||
binding.webviewConnect.getSettings().setUserAgentString(user_agent);
|
||||
// String user_agent = sharedpreferences.getString(getString(R.string.SET_CUSTOM_USER_AGENT), Helper.USER_AGENT);
|
||||
// binding.webviewConnect.getSettings().setUserAgentString(user_agent);
|
||||
binding.webviewConnect.getSettings().setDomStorageEnabled(true);
|
||||
CookieManager.getInstance().setAcceptThirdPartyCookies(binding.webviewConnect, true);
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ public class Helper {
|
|||
|
||||
public static final String VALUE_TRENDS = "VALUE_TRENDS";
|
||||
|
||||
public static final String USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0";
|
||||
//public static final String USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Firefox/60.0";
|
||||
public static final String REDIRECT_CONTENT_WEB = "fedilab://backtofedilab";
|
||||
public static final String REDIRECT_CONTENT = "urn:ietf:wg:oauth:2.0:oob";
|
||||
public static final String APP_OAUTH_SCOPES = "read write";
|
||||
|
@ -439,8 +439,8 @@ public class Helper {
|
|||
webView.getSettings().setLoadsImagesAutomatically(true);
|
||||
webView.getSettings().setSupportMultipleWindows(false);
|
||||
webView.getSettings().setMediaPlaybackRequiresUserGesture(true);
|
||||
String user_agent = sharedpreferences.getString(activity.getString(R.string.SET_CUSTOM_USER_AGENT), USER_AGENT);
|
||||
webView.getSettings().setUserAgentString(user_agent);
|
||||
//String user_agent = sharedpreferences.getString(activity.getString(R.string.SET_CUSTOM_USER_AGENT), USER_AGENT);
|
||||
// webView.getSettings().setUserAgentString(user_agent);
|
||||
boolean cookies = sharedpreferences.getBoolean(activity.getString(R.string.SET_COOKIES), false);
|
||||
CookieManager cookieManager = CookieManager.getInstance();
|
||||
cookieManager.setAcceptThirdPartyCookies(webView, cookies);
|
||||
|
@ -1761,7 +1761,7 @@ public class Helper {
|
|||
httpURLConnection = (HttpURLConnection) url.openConnection(proxy);
|
||||
else
|
||||
httpURLConnection = (HttpURLConnection) url.openConnection();
|
||||
httpURLConnection.setRequestProperty("User-Agent", USER_AGENT);
|
||||
// httpURLConnection.setRequestProperty("User-Agent", USER_AGENT);
|
||||
int responseCode = httpURLConnection.getResponseCode();
|
||||
|
||||
// always check HTTP response code first
|
||||
|
|
|
@ -16,7 +16,6 @@ package app.fedilab.android.helper;
|
|||
|
||||
|
||||
import static app.fedilab.android.BaseMainActivity.currentAccount;
|
||||
import static app.fedilab.android.helper.Helper.USER_AGENT;
|
||||
import static app.fedilab.android.helper.ThemeHelper.linkColor;
|
||||
|
||||
import android.content.ClipData;
|
||||
|
@ -321,7 +320,7 @@ public class SpannableHelper {
|
|||
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) finalUrlCheck.openConnection();
|
||||
httpsURLConnection.setConnectTimeout(10 * 1000);
|
||||
httpsURLConnection.setRequestProperty("http.keepAlive", "false");
|
||||
httpsURLConnection.setRequestProperty("User-Agent", USER_AGENT);
|
||||
// httpsURLConnection.setRequestProperty("User-Agent", USER_AGENT);
|
||||
httpsURLConnection.setRequestMethod("HEAD");
|
||||
httpsURLConnection.setInstanceFollowRedirects(false);
|
||||
if (httpsURLConnection.getResponseCode() == 301 || httpsURLConnection.getResponseCode() == 302) {
|
||||
|
@ -550,7 +549,7 @@ public class SpannableHelper {
|
|||
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) finalUrlCheck.openConnection();
|
||||
httpsURLConnection.setConnectTimeout(10 * 1000);
|
||||
httpsURLConnection.setRequestProperty("http.keepAlive", "false");
|
||||
httpsURLConnection.setRequestProperty("User-Agent", USER_AGENT);
|
||||
//httpsURLConnection.setRequestProperty("User-Agent", USER_AGENT);
|
||||
httpsURLConnection.setRequestMethod("HEAD");
|
||||
httpsURLConnection.setInstanceFollowRedirects(false);
|
||||
if (httpsURLConnection.getResponseCode() == 301 || httpsURLConnection.getResponseCode() == 302) {
|
||||
|
|
|
@ -245,8 +245,8 @@ public class FragmentMedia extends Fragment {
|
|||
webview_video.setWebChromeClient(fedilabWebChromeClient);
|
||||
webview_video.getSettings().setDomStorageEnabled(true);
|
||||
webview_video.getSettings().setAppCacheEnabled(true);
|
||||
String user_agent = sharedpreferences.getString(getString(R.string.SET_CUSTOM_USER_AGENT), Helper.USER_AGENT);
|
||||
webview_video.getSettings().setUserAgentString(user_agent);
|
||||
// String user_agent = sharedpreferences.getString(getString(R.string.SET_CUSTOM_USER_AGENT), Helper.USER_AGENT);
|
||||
// webview_video.getSettings().setUserAgentString(user_agent);
|
||||
webview_video.getSettings().setMediaPlaybackRequiresUserGesture(false);
|
||||
webview_video.setWebViewClient(new FedilabWebViewClient(requireActivity()));
|
||||
webview_video.loadUrl(attachment.url);
|
||||
|
|
Loading…
Reference in a new issue