", Pattern.DOTALL);
private static final Pattern topicLinkInPermalinkPattern = Pattern.compile("
)", Pattern.DOTALL);
- private static final Pattern pageTopicLinkNumberPattern = Pattern.compile("^(http://www\\.jeuxvideo\\.com/forums/(?:1|42)-([0-9]*)-([0-9]*)-)([0-9]*)(-[0-9]*-[0-9]*-[0-9]*-[^./]*\\.htm)[#?]?");
- private static final Pattern pageForumLinkNumberPattern = Pattern.compile("^(http://www\\.jeuxvideo\\.com/forums/0-([0-9]*)-[0-9]*-[0-9]*-[0-9]*-)([0-9]*)(-[0-9]*-([^./]*)\\.htm)[#?]?");
- private static final Pattern pageSearchTopicLinkNumberPattern = Pattern.compile("^(http://www\\.jeuxvideo\\.com/recherche/forums/(0-[0-9]*-[0-9]*-[0-9]*-[0-9]*-))([0-9]*)(-[0-9]*-[^./]*\\.htm)([#?]?.*)");
+ private static final Pattern pageTopicLinkNumberPattern = Pattern.compile("^(https?://www\\.jeuxvideo\\.com/forums/(?:1|42)-([0-9]*)-([0-9]*)-)([0-9]*)(-[0-9]*-[0-9]*-[0-9]*-[^./]*\\.htm)[#?]?");
+ private static final Pattern pageForumLinkNumberPattern = Pattern.compile("^(https?://www\\.jeuxvideo\\.com/forums/0-([0-9]*)-[0-9]*-[0-9]*-[0-9]*-)([0-9]*)(-[0-9]*-([^./]*)\\.htm)[#?]?");
+ private static final Pattern pageSearchTopicLinkNumberPattern = Pattern.compile("^(https?://www\\.jeuxvideo\\.com/recherche/forums/(0-[0-9]*-[0-9]*-[0-9]*-[0-9]*-))([0-9]*)(-[0-9]*-[^./]*\\.htm)([#?]?.*)");
private static final Pattern messageAnchorInTopicLinkPattern = Pattern.compile("#post_([0-9]*)");
private static final Pattern jvCarePattern = Pattern.compile("
([^<]*)");
private static final Pattern lastEditMessagePattern = Pattern.compile("
[^M]*(Message édité le ([^ ]* [^ ]* [^ ]* [^ ]* [0-9:]*) par.*?)
", Pattern.DOTALL);
@@ -125,23 +125,23 @@ public static String getForumForTopicLink(String topicLink) {
Matcher pageTopicLinkNumberMatcher = pageTopicLinkNumberPattern.matcher(topicLink);
if (pageTopicLinkNumberMatcher.find()) {
- return "http://www.jeuxvideo.com/forums/0-" + pageTopicLinkNumberMatcher.group(2) + "-0-1-0-1-0-respawn-irc.htm";
+ return "https://www.jeuxvideo.com/forums/0-" + pageTopicLinkNumberMatcher.group(2) + "-0-1-0-1-0-respawn-irc.htm";
} else {
return "";
}
}
public static String formatThisUrlToClassicJvcUrl(String urlToChange) {
- if (urlToChange.startsWith("https://")) {
- urlToChange = "http://" + urlToChange.substring(("https://").length());
- } else if (!urlToChange.startsWith("http://")) {
- urlToChange = "http://" + urlToChange;
+ if (urlToChange.startsWith("http://")) {
+ urlToChange = "https://" + urlToChange.substring(("http://").length());
+ } else if (!urlToChange.startsWith("https://")) {
+ urlToChange = "https://" + urlToChange;
}
- if (urlToChange.startsWith("http://m.jeuxvideo.com/")) {
- urlToChange = "http://www.jeuxvideo.com/" + urlToChange.substring(("http://m.jeuxvideo.com/").length());
- } else if (urlToChange.startsWith("http://jeuxvideo.com/")) {
- urlToChange = "http://www.jeuxvideo.com/" + urlToChange.substring(("http://jeuxvideo.com/").length());
+ if (urlToChange.startsWith("https://m.jeuxvideo.com/")) {
+ urlToChange = "https://www.jeuxvideo.com/" + urlToChange.substring(("https://m.jeuxvideo.com/").length());
+ } else if (urlToChange.startsWith("https://jeuxvideo.com/")) {
+ urlToChange = "https://www.jeuxvideo.com/" + urlToChange.substring(("https://jeuxvideo.com/").length());
}
return urlToChange;
@@ -227,21 +227,21 @@ public static boolean checkIfForumAreSame(String firstForumLink, String secondFo
}
public static boolean checkIfItsForumFormatedLink(String linkToCheck) {
- return linkToCheck.startsWith("http://www.jeuxvideo.com/forums/0-");
+ return linkToCheck.startsWith("https://www.jeuxvideo.com/forums/0-");
}
public static boolean checkIfItsTopicFormatedLink(String linkToCheck) {
- return linkToCheck.startsWith("http://www.jeuxvideo.com/forums/1-") ||
- linkToCheck.startsWith("http://www.jeuxvideo.com/forums/42-");
+ return linkToCheck.startsWith("https://www.jeuxvideo.com/forums/1-") ||
+ linkToCheck.startsWith("https://www.jeuxvideo.com/forums/42-");
}
public static boolean checkIfItsSearchFormatedLink(String linkToCheck) {
- return linkToCheck.startsWith("http://www.jeuxvideo.com/recherche/forums/0-");
+ return linkToCheck.startsWith("https://www.jeuxvideo.com/recherche/forums/0-");
}
public static boolean checkIfItsMessageFormatedLink(String linkToCheck) {
- if (linkToCheck.startsWith("http://www.jeuxvideo.com/")) {
- String partOfLinkToCheck = linkToCheck.substring(("http://www.jeuxvideo.com/").length());
+ if (linkToCheck.startsWith("https://www.jeuxvideo.com/")) {
+ String partOfLinkToCheck = linkToCheck.substring(("https://www.jeuxvideo.com/").length());
if (partOfLinkToCheck.contains("/")) {
partOfLinkToCheck = partOfLinkToCheck.substring(partOfLinkToCheck.indexOf('/'));
@@ -512,7 +512,7 @@ public static ArrayList
getListOfForumsInSearchPage(String pageSour
newNameAndLink.name = forumInSearchPageMatcher.group(2).replace("", "").replace("", "");
if (!forumInSearchPageMatcher.group(1).isEmpty()) {
- newNameAndLink.link = "http://www.jeuxvideo.com" + forumInSearchPageMatcher.group(1);
+ newNameAndLink.link = "https://www.jeuxvideo.com" + forumInSearchPageMatcher.group(1);
}
listOfForums.add(newNameAndLink);
@@ -535,7 +535,7 @@ public static ArrayList getListOfSubforumsInForumPage(String pageSo
newNameAndLink.name = subforumInListMatcher.group(2).trim();
if (!subforumInListMatcher.group(1).isEmpty()) {
- newNameAndLink.link = "http://www.jeuxvideo.com" + subforumInListMatcher.group(1);
+ newNameAndLink.link = "https://www.jeuxvideo.com" + subforumInListMatcher.group(1);
}
listOfSubforums.add(newNameAndLink);
@@ -559,7 +559,7 @@ public static ArrayList getListOfNoMissTopicsInForumPage(String pag
newNameAndLink.name = noMissTopicInListMatcher.group(2).trim();
if (!noMissTopicInListMatcher.group(1).isEmpty()) {
- newNameAndLink.link = "http://www.jeuxvideo.com" + noMissTopicInListMatcher.group(1);
+ newNameAndLink.link = "https://www.jeuxvideo.com" + noMissTopicInListMatcher.group(1);
}
listOfNoMissTopics.add(newNameAndLink);
@@ -601,9 +601,9 @@ public static ArrayList getListOfFavInBloc(String pageSource) {
newFav.name = specialCharToNormalChar(favMatcher.group(2));
if (tmpLink.startsWith("/forums/")) {
- newFav.link = "http://www.jeuxvideo.com" + tmpLink;
- } else if (!tmpLink.startsWith("http:")) {
- newFav.link = "http:" + tmpLink;
+ newFav.link = "https://www.jeuxvideo.com" + tmpLink;
+ } else if (!tmpLink.startsWith("https:")) {
+ newFav.link = "https:" + tmpLink;
} else {
newFav.link = tmpLink;
}
@@ -665,7 +665,7 @@ public static NameAndLink getMainForumNameAndLinkInForumPage(String pageSource)
mainForum.name = specialCharToNormalChar(mainForum.name.trim());
if (!mainForum.link.isEmpty()) {
- mainForum.link = "http://www.jeuxvideo.com" + mainForum.link;
+ mainForum.link = "https://www.jeuxvideo.com" + mainForum.link;
}
}
@@ -1010,7 +1010,7 @@ public static String getLastPageOfTopic(String pageSource) {
while (pageLinkMatcher.find()) {
if (Integer.parseInt(pageLinkMatcher.group(2)) > currentPageNumber) {
currentPageNumber = Integer.parseInt(pageLinkMatcher.group(2));
- lastPage = "http://www.jeuxvideo.com" + pageLinkMatcher.group(1);
+ lastPage = "https://www.jeuxvideo.com" + pageLinkMatcher.group(1);
}
}
@@ -1028,7 +1028,7 @@ public static String getNextPageOfTopic(String pageSource) {
while (pageLinkMatcher.find()) {
if (Integer.parseInt(pageLinkMatcher.group(2)) == (currentPageNumber + 1)) {
- return "http://www.jeuxvideo.com" + pageLinkMatcher.group(1);
+ return "https://www.jeuxvideo.com" + pageLinkMatcher.group(1);
}
}
@@ -1115,7 +1115,7 @@ public static String parseMessageToPrettyMessage(String messageInString, Setting
ToolForParsing.parseThisMessageWithThisPattern(messageInBuilder, smileyPattern, 2, "
", null, null);
ToolForParsing.parseThisMessageWithThisPattern(messageInBuilder, embedVideoPattern, 1, "", "
", makeLinkDependingOnSettingsAndForceMake, null);
- ToolForParsing.parseThisMessageWithThisPattern(messageInBuilder, jvcVideoPattern, 1, "", "
", new AddPrefixString("http://www.jeuxvideo.com/videos/iframe/"), makeLinkDependingOnSettingsAndForceMake);
+ ToolForParsing.parseThisMessageWithThisPattern(messageInBuilder, jvcVideoPattern, 1, "", "
", new AddPrefixString("https://www.jeuxvideo.com/videos/iframe/"), makeLinkDependingOnSettingsAndForceMake);
ToolForParsing.parseThisMessageWithThisPattern(messageInBuilder, shortJvcLinkPattern, 1, "", "", makeLinkDependingOnSettingsAndForceMake, null);
ToolForParsing.parseThisMessageWithThisPattern(messageInBuilder, longJvcLinkPattern, 1, "", "", makeLinkDependingOnSettingsAndForceMake, null);
ToolForParsing.parseThisMessageWithThisPattern(messageInBuilder, shortLinkPattern, 1, "", "", makeLinkDependingOnSettingsAndForceMake, null);
@@ -1171,7 +1171,7 @@ public static String parseMessageToSimpleMessage(String messageInString) {
ToolForParsing.replaceStringByAnother(messageInBuilder, "\n", "");
ToolForParsing.parseThisMessageWithThisPattern(messageInBuilder, smileyPattern, 3, "", "", null, null);
ToolForParsing.parseThisMessageWithThisPattern(messageInBuilder, embedVideoPattern, 1, "", "
", null, null);
- ToolForParsing.parseThisMessageWithThisPattern(messageInBuilder, jvcVideoPattern, 1, "http://www.jeuxvideo.com/videos/iframe/", "
", null, null);
+ ToolForParsing.parseThisMessageWithThisPattern(messageInBuilder, jvcVideoPattern, 1, "https://www.jeuxvideo.com/videos/iframe/", "
", null, null);
ToolForParsing.parseThisMessageWithThisPattern(messageInBuilder, shortJvcLinkPattern, 1, "", "", null, null);
ToolForParsing.parseThisMessageWithThisPattern(messageInBuilder, longJvcLinkPattern, 1, "", "", null, null);
ToolForParsing.parseThisMessageWithThisPattern(messageInBuilder, shortLinkPattern, 1, "", "", null, null);
@@ -1258,7 +1258,7 @@ public static MessageInfos createMessageInfoFromEntireMessage(String thisEntireM
}
if (avatarMatcher.find()) {
- newMessageInfo.avatarLink = "http://" + avatarMatcher.group(2);
+ newMessageInfo.avatarLink = "https://" + avatarMatcher.group(2);
}
if (messageIdMatcher.find()) {
@@ -1311,7 +1311,7 @@ public static TopicInfos createTopicInfoFromEntireTopic(String thisEntireTopic)
if (topicNameAndLinkMatcher.find()) {
String topicNameAndLinkString = topicNameAndLinkMatcher.group(1);
- newTopicInfo.link = "http://www.jeuxvideo.com" + topicNameAndLinkString.substring(0, topicNameAndLinkString.indexOf("\""));
+ newTopicInfo.link = "https://www.jeuxvideo.com" + topicNameAndLinkString.substring(0, topicNameAndLinkString.indexOf("\""));
newTopicInfo.htmlName = topicNameAndLinkString.substring(topicNameAndLinkString.indexOf("title=\"") + 7);
}
@@ -1341,7 +1341,7 @@ public static TopicInfos createTopicInfoFromEntireTopicMessageSearch(String this
}
if (topicNameAndLinkMatcher.find()) {
- newTopicInfo.link = "http://www.jeuxvideo.com" + topicNameAndLinkMatcher.group(1);
+ newTopicInfo.link = "https://www.jeuxvideo.com" + topicNameAndLinkMatcher.group(1);
newTopicInfo.htmlName = topicNameAndLinkMatcher.group(2).replace("\r", "").replace("\n", "").replace("em>", "u>").trim();
}
@@ -1383,7 +1383,7 @@ public static String getTopicLinkFromPermalinkPage(String sourcePage) {
Matcher topicLinkMatcher = topicLinkInPermalinkPattern.matcher(sourcePage);
if (topicLinkMatcher.find()) {
- return "http://www.jeuxvideo.com" + topicLinkMatcher.group(1);
+ return "https://www.jeuxvideo.com" + topicLinkMatcher.group(1);
}
return "";
diff --git a/app/src/main/java/com/franckrj/respawnirc/utils/Utils.java b/app/src/main/java/com/franckrj/respawnirc/utils/Utils.java
index 7339a48b..408cdc2c 100644
--- a/app/src/main/java/com/franckrj/respawnirc/utils/Utils.java
+++ b/app/src/main/java/com/franckrj/respawnirc/utils/Utils.java
@@ -15,6 +15,7 @@
import android.text.Spannable;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
+import android.webkit.CookieManager;
import android.widget.EditText;
import com.franckrj.respawnirc.MainActivity;
@@ -44,7 +45,6 @@ public static long roundToLong(double valToRound) {
return (long) (valToRound + 0.5);
}
- @SuppressWarnings("BooleanMethodIsAlwaysInverted")
public static boolean stringsAreEquals(String str1, String str2) {
return (Objects.equals(str1, str2));
}
@@ -123,6 +123,8 @@ public static String imageLinkToFileName(String link) {
return "nlsk_xs/" + link.substring(("http://image.noelshack.com/fichiers-xs/").length()).replace("/", "_");
} else if (link.startsWith("http://image.noelshack.com/fichiers/")) {
return "nlsk_big/" + link.substring(("http://image.noelshack.com/fichiers/").length()).replace("/", "_");
+ } else if (link.startsWith("https://image.jeuxvideo.com/avatar")) {
+ return "vtr_sm/" + link.substring(("https://image.jeuxvideo.com/avatar").length()).replace("/", "_");
} else if (link.startsWith("http://image.jeuxvideo.com/avatar")) {
return "vtr_sm/" + link.substring(("http://image.jeuxvideo.com/avatar").length()).replace("/", "_");
} else {
@@ -130,6 +132,16 @@ public static String imageLinkToFileName(String link) {
}
}
+ public static void setupCookiesForJvc(CookieManager cookieManager) {
+ cookieManager.removeAllCookies(null);
+ cookieManager.setCookie("https://www.jeuxvideo.com", "_cmpQcif3pcsupported=1");
+ cookieManager.setCookie("https://jeuxvideo.com", "_gcl_au=1.1.1298996599.1593456467");
+ cookieManager.setCookie("https://www.jeuxvideo.com", "euconsent=BO1ximpO1ximpAKAiCENDQAAAAAweAAA");
+ cookieManager.setCookie("https://www.jeuxvideo.com", "googlepersonalization=O1ximpO1ximpAA");
+ cookieManager.setCookie("https://www.jeuxvideo.com", "noniabvendorconsent=O1ximpO1ximpAKAiAA8AAA");
+ cookieManager.setCookie("https://www.jeuxvideo.com", "visitor_country=FR");
+ }
+
public static void openCorrespondingBrowser(PrefsManager.LinkType linkTypeToOpenInternalBrowser, String link, Activity parentActivity) {
boolean itsAJVCLink = link.matches("(?i)^http(s)?://((www|m)\\.)?jeuxvideo\\.com$") ||
link.matches("(?i)^http(s)?://((www|m)\\.)?jeuxvideo\\.com/.*");
@@ -212,7 +224,7 @@ public static CharSequence applyEmojiCompatIfPossible(CharSequence baseMessage)
@TargetApi(25)
public static void updateShortcuts(Activity parentActivity, ShortcutManager shortcutManager, int sizeOfForumFavArray) {
ArrayList listOfShortcuts = new ArrayList<>();
- int sizeOfShortcutArray = (sizeOfForumFavArray > 4 ? 4 : sizeOfForumFavArray);
+ int sizeOfShortcutArray = Math.min(sizeOfForumFavArray, 4);
for (int i = 0; i < sizeOfShortcutArray; ++i) {
String currentShortcutLink = PrefsManager.getStringWithSufix(PrefsManager.StringPref.Names.FORUM_FAV_LINK, String.valueOf(i));
diff --git a/app/src/main/java/com/franckrj/respawnirc/utils/WebManager.java b/app/src/main/java/com/franckrj/respawnirc/utils/WebManager.java
index 24f18fdf..3dca5367 100644
--- a/app/src/main/java/com/franckrj/respawnirc/utils/WebManager.java
+++ b/app/src/main/java/com/franckrj/respawnirc/utils/WebManager.java
@@ -9,7 +9,7 @@
import java.util.concurrent.Callable;
public class WebManager {
- public static final String userAgentString = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:75.0) Gecko/20100101 Firefox/75.0";
+ public static final String userAgentString = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0";
public static String sendRequestWithMultipleTrys(String linkToPage, String requestMethod, String requestParameters, WebInfos currentInfos, int maxNumberOfTrys) {
int numberOfTrys = 0;
diff --git a/build.gradle b/build.gradle
index 5a42266f..2f307b92 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,11 +1,11 @@
buildscript {
- ext.kotlin_version = '1.3.71'
+ ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.6.2'
+ classpath 'com.android.tools.build:gradle:4.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 6d444c79..82c14a5a 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Fri Apr 10 12:27:09 CEST 2020
+#Mon Jun 29 20:31:32 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip