This commit is contained in:
Thomas 2020-04-10 18:03:04 +02:00
parent 4e66b69f57
commit 65167f643f
1 changed files with 18 additions and 14 deletions

View File

@ -475,18 +475,20 @@ public class TransformActivity extends Activity {
if (nitter_enabled) { if (nitter_enabled) {
String nitterHost = sharedpreferences.getString(MainActivity.SET_NITTER_HOST, MainActivity.DEFAULT_NITTER_HOST).toLowerCase(); String nitterHost = sharedpreferences.getString(MainActivity.SET_NITTER_HOST, MainActivity.DEFAULT_NITTER_HOST).toLowerCase();
assert host != null; assert host != null;
if (host.compareTo("pbs.twimg.com") != 0 || host.compareTo("pic.twitter.com") != 0) { if (host.compareTo("pbs.twimg.com") == 0 || host.compareTo("pic.twitter.com") == 0) {
Matcher matcher = nitterPattern.matcher(url);
while (matcher.find()) {
final String nitter_directory = matcher.group(2);
newUrl = "https://" + nitterHost + nitter_directory;
}
} else {
try { try {
newUrl = "https://" + nitterHost + "/pic/" + URLEncoder.encode(url, "utf-8"); newUrl = "https://" + nitterHost + "/pic/" + URLEncoder.encode(url, "utf-8");
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
newUrl = "https://" + nitterHost + "/pic/" + url; newUrl = "https://" + nitterHost + "/pic/" + url;
} }
}else if(url.contains("/search?")){
newUrl = url.replace(host, nitterHost);
} else {
Matcher matcher = nitterPattern.matcher(url);
while (matcher.find()) {
final String nitter_directory = matcher.group(2);
newUrl = "https://" + nitterHost + nitter_directory;
}
} }
return newUrl; return newUrl;
} else { } else {
@ -621,18 +623,20 @@ public class TransformActivity extends Activity {
String nitterHost = sharedpreferences.getString(MainActivity.SET_NITTER_HOST, MainActivity.DEFAULT_NITTER_HOST).toLowerCase(); String nitterHost = sharedpreferences.getString(MainActivity.SET_NITTER_HOST, MainActivity.DEFAULT_NITTER_HOST).toLowerCase();
assert host != null; assert host != null;
if (host.compareTo("pbs.twimg.com") != 0 || host.compareTo("pic.twitter.com") != 0) { if (host.compareTo("pbs.twimg.com") == 0 || host.compareTo("pic.twitter.com") == 0) {
Matcher matcher = nitterPattern.matcher(url);
while (matcher.find()) {
final String nitter_directory = matcher.group(2);
newUrl = "https://" + nitterHost + nitter_directory;
}
} else {
try { try {
newUrl = "https://" + nitterHost + "/pic/" + URLEncoder.encode(url, "utf-8"); newUrl = "https://" + nitterHost + "/pic/" + URLEncoder.encode(url, "utf-8");
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
newUrl = "https://" + nitterHost + "/pic/" + url; newUrl = "https://" + nitterHost + "/pic/" + url;
} }
}else if(url.contains("/search?")){
newUrl = url.replace(host, nitterHost);
} else {
Matcher matcher = nitterPattern.matcher(url);
while (matcher.find()) {
final String nitter_directory = matcher.group(2);
newUrl = "https://" + nitterHost + nitter_directory;
}
} }
} }
} else if (Arrays.asList(instagram_domains).contains(host)) { } else if (Arrays.asList(instagram_domains).contains(host)) {