Merge remote-tracking branch 'origin/vtl-remaster' into vtl-remaster
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package ru.vtosters.lite.dnr;
|
||||
|
||||
import static ru.vtosters.lite.net.Request.makeRequest;
|
||||
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Globals.getUserToken;
|
||||
import static ru.vtosters.lite.utils.Proxy.getApiCom;
|
||||
|
||||
import com.vk.core.util.ToastUtils;
|
||||
import com.vk.im.engine.commands.messages.SetUserActivityCmd;
|
||||
@@ -51,7 +51,7 @@ public class DNRModule{
|
||||
}
|
||||
|
||||
public static void hookRead(Dialog dialog){
|
||||
makeRequest("https://" + getApiCom() + "/method/messages.markAsRead?start_message_id=" + dialog.F1() + "&peer_id=" + dialog.getId() + "&v=5.91&access_token=" + getUserToken(), response -> {
|
||||
makeRequest("https://" + getPrefsValue("proxyapi") + "/method/messages.markAsRead?start_message_id=" + dialog.F1() + "&peer_id=" + dialog.getId() + "&v=5.91&access_token=" + getUserToken(), response -> {
|
||||
ToastUtils.a("Чат помечен как прочитанный!");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package ru.vtosters.lite.foaf;
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
import static android.widget.Toast.makeText;
|
||||
import static ru.vtosters.lite.utils.Globals.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Globals.getString;
|
||||
import static ru.vtosters.lite.utils.Proxy.getApiCom;
|
||||
import static ru.vtosters.lite.utils.Proxy.proxy;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
@@ -52,7 +52,7 @@ public class FoafBase{
|
||||
StringBuilder sb;
|
||||
if(proxy()){
|
||||
sb = new StringBuilder();
|
||||
str = "https://" + getApiCom() + "/_/vk.com/foaf.php?id=";
|
||||
str = "https://" + getPrefsValue("proxyapi") + "/_/vk.com/foaf.php?id=";
|
||||
} else {
|
||||
sb = new StringBuilder();
|
||||
str = "https://vk.com/foaf.php?id=";
|
||||
|
||||
@@ -48,9 +48,11 @@ import java.util.List;
|
||||
|
||||
public class Newsfeed{
|
||||
public static List<String> mFilters;
|
||||
public static List<String> mFiltersLinks;
|
||||
|
||||
public static void setupFilters(){
|
||||
mFilters = new ArrayList();
|
||||
mFiltersLinks = new ArrayList();
|
||||
|
||||
getFilter("refsfilter", "Referals.txt");
|
||||
getFilter("shortlinkfilter", "LinkShorter.txt");
|
||||
@@ -63,6 +65,11 @@ public class Newsfeed{
|
||||
mFilters.addAll(Arrays.asList(customfilters.split(", ")));
|
||||
}
|
||||
|
||||
String linkfilter = getPrefsValue("linkfilter");
|
||||
|
||||
if(!linkfilter.isEmpty()){
|
||||
mFiltersLinks.addAll(Arrays.asList(linkfilter.split(", ")));
|
||||
}
|
||||
}
|
||||
|
||||
public static void getFilter(String boolname, String filename){
|
||||
@@ -98,32 +105,32 @@ public class Newsfeed{
|
||||
return false;
|
||||
}
|
||||
|
||||
checkCopyright(obj);
|
||||
if(checkCopyright(obj)) return false;
|
||||
|
||||
if(isBadNew(obj.optString("text", ""))) return false;
|
||||
|
||||
optString = obj.optString("text", "");
|
||||
if(isBadNew(optString)) return false;
|
||||
if(checkCaption(obj)) return false;
|
||||
|
||||
return !isGroupAds(obj);
|
||||
}
|
||||
|
||||
private static boolean checkCopyright(JSONObject json) throws JSONException{
|
||||
String linkfilter = getPrefsValue("linkfilter");
|
||||
|
||||
if(json.opt("copyright") != null){
|
||||
JSONObject copyright = json.getJSONObject("copyright");
|
||||
String copyrightlink = copyright.getString("link");
|
||||
|
||||
return !copyrightlink.contains("vk.com") || !copyright_post(); // fuck you, it doesn't work to detect link value
|
||||
for(String linkfilters : mFiltersLinks) {
|
||||
if(copyrightlink.toLowerCase().contains(linkfilters.toLowerCase())){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// example of response
|
||||
//"copyright": {
|
||||
//"id": 251706814,
|
||||
//"link": "https://vk.com/wall251706814_9016",
|
||||
//"type": "owner",
|
||||
//"name": "Маргарита Буруня"
|
||||
//}
|
||||
return copyright_post();
|
||||
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isRecomsGroup(String src){
|
||||
|
||||
@@ -289,10 +289,6 @@ public class Preferences{
|
||||
return dnr() ? "messages.markAsRead" : "null";
|
||||
}
|
||||
|
||||
public static String copyrightfix(){
|
||||
return copyright_post() ? "copyright" : "ads_easy_promote";
|
||||
}
|
||||
|
||||
public static boolean refsfilter(){
|
||||
return getBoolValue("refsfilter", false);
|
||||
}
|
||||
|
||||
@@ -5,69 +5,52 @@ import static java.lang.System.getProperties;
|
||||
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
public class Proxy{
|
||||
public static String getOauthComAuth(){
|
||||
return getOauthComHttps() + "/authorize";
|
||||
}
|
||||
public static String linkReplacer(String link){
|
||||
String vkapi = "api.vk.com";
|
||||
String oauth = "oauth.vk.com";
|
||||
String vkstatic = "static.vk.com";
|
||||
|
||||
public static String getOauthComAuthClient(){
|
||||
return getOauthComAuth() + "?client_id=";
|
||||
}
|
||||
String proxproxyapi = getPrefsValue("proxyapi");
|
||||
String proxyoauth = getPrefsValue("proxyoauth");
|
||||
String proxystatic = getPrefsValue("proxystatic");
|
||||
|
||||
public static String getOauthComBlank(){
|
||||
return getOauthComHttps() + "/blank.html";
|
||||
}
|
||||
if(!proxy() || link.isEmpty()){
|
||||
return link;
|
||||
}
|
||||
|
||||
public static String getOauthComBlankRedirect(){
|
||||
return "&redirect_uri=" + getOauthComBlank();
|
||||
}
|
||||
if(proxproxyapi.isEmpty() || proxyoauth.isEmpty() || proxystatic.isEmpty()){
|
||||
Log.d("VTLite", "Proxy is not set" + " " + proxproxyapi + " " + proxyoauth + " " + proxystatic);
|
||||
return link;
|
||||
}
|
||||
|
||||
public static String getOauthComHttps(){
|
||||
return "https://" + getOauthCom();
|
||||
}
|
||||
if(link.contains(vkapi)){
|
||||
return link.replace(proxproxyapi, vkapi);
|
||||
}
|
||||
|
||||
public static String getStaticComSupport(){
|
||||
return getStaticCom() + "/support";
|
||||
}
|
||||
if(link.contains(oauth)){
|
||||
return link.replace(proxyoauth, oauth);
|
||||
}
|
||||
|
||||
public static String oauthFix(){
|
||||
return "https://oauth.vk.com/blank.html";
|
||||
}
|
||||
if(link.contains(vkstatic)){
|
||||
return link.replace(proxystatic, vkstatic);
|
||||
}
|
||||
|
||||
public static String getApiCom(){
|
||||
String string = getPrefsValue("proxyapi");
|
||||
if(!proxy() & string.isEmpty()) return "api.vk.com";
|
||||
return string;
|
||||
return link;
|
||||
}
|
||||
|
||||
public static String getAwayPhpCom(){
|
||||
String string = getPrefsValue("proxyapi");
|
||||
if(!proxy() & string.isEmpty()) return "m.vk.com";
|
||||
return string;
|
||||
}
|
||||
String proxyapi = getPrefsValue("proxyapi");
|
||||
|
||||
public static String getOauthCom(){
|
||||
String string = getPrefsValue("proxyoauth");
|
||||
if(!proxy() & string.isEmpty()) return "oauth.vk.com";
|
||||
return string;
|
||||
}
|
||||
if(!proxy() & proxyapi.isEmpty()){
|
||||
return "m.vk.com";
|
||||
}
|
||||
|
||||
public static String getStaticCom(){
|
||||
String string = getPrefsValue("proxystatic");
|
||||
if(!proxy() & string.isEmpty()) return "static.vk.com";
|
||||
return string;
|
||||
}
|
||||
|
||||
public static String staticFix(String str){
|
||||
String str2;
|
||||
String string = getPrefsValue("proxystatic");
|
||||
|
||||
if(!proxy() & string.isEmpty()) return str;
|
||||
|
||||
str2 = string;
|
||||
return str.replace(str2, "static.vk.com");
|
||||
return proxyapi;
|
||||
}
|
||||
|
||||
public static void setProxy(){
|
||||
|
||||
Reference in New Issue
Block a user