forked from melod1n/fast-messenger
Retrieving sensitive data from local.properties
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
|
||||||
|
|
||||||
|
val vkSecret: String = gradleLocalProperties(rootDir).getProperty("vk.app.secret")
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
id("kotlin-android")
|
id("kotlin-android")
|
||||||
@@ -26,8 +30,15 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
getByName("debug") {
|
||||||
|
buildConfigField("String", "vkSecret", vkSecret)
|
||||||
|
}
|
||||||
|
|
||||||
getByName("release") {
|
getByName("release") {
|
||||||
|
buildConfigField("String", "vkSecret", vkSecret)
|
||||||
|
|
||||||
isMinifyEnabled = false
|
isMinifyEnabled = false
|
||||||
|
|
||||||
proguardFiles(
|
proguardFiles(
|
||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
"proguard-rules.pro"
|
"proguard-rules.pro"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ object UserConfig {
|
|||||||
private const val TOKEN = "token"
|
private const val TOKEN = "token"
|
||||||
private const val USER_ID = "user_id"
|
private const val USER_ID = "user_id"
|
||||||
|
|
||||||
const val API_ID = "6964679"
|
const val FAST_APP_ID = "6964679"
|
||||||
|
|
||||||
var userId: Int = -1
|
var userId: Int = -1
|
||||||
get() = AppGlobal.preferences.getInt(USER_ID, -1)
|
get() = AppGlobal.preferences.getInt(USER_ID, -1)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.meloda.fast.api
|
|||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.meloda.fast.BuildConfig
|
import com.meloda.fast.BuildConfig
|
||||||
|
import com.meloda.fast.UserConfig
|
||||||
import com.meloda.fast.api.util.VKUtil
|
import com.meloda.fast.api.util.VKUtil
|
||||||
import java.net.URLEncoder
|
import java.net.URLEncoder
|
||||||
|
|
||||||
@@ -9,8 +10,7 @@ object VKAuth {
|
|||||||
|
|
||||||
private const val TAG = "VKM.VKAuth"
|
private const val TAG = "VKM.VKAuth"
|
||||||
|
|
||||||
const val settings =
|
private const val settings = "notify," +
|
||||||
"notify," +
|
|
||||||
"friends," +
|
"friends," +
|
||||||
"photos," +
|
"photos," +
|
||||||
"audio," +
|
"audio," +
|
||||||
@@ -25,35 +25,25 @@ object VKAuth {
|
|||||||
"offline," +
|
"offline," +
|
||||||
"notifications"
|
"notifications"
|
||||||
|
|
||||||
const val redirectUrl = "https://oauth.vk.com/blank.html"
|
private const val redirectUrl = "https://oauth.vk.com/blank.html"
|
||||||
|
|
||||||
fun getDirectAuthUrl(
|
fun getDirectAuthUrl(
|
||||||
login: String,
|
login: String,
|
||||||
password: String,
|
password: String,
|
||||||
captchaSid: String? = null,
|
captchaSid: String? = null,
|
||||||
captchaKey: String? = null
|
captchaKey: String? = null
|
||||||
): String {
|
) = "https://oauth.vk.com/token?grant_type=password&" +
|
||||||
return "https://oauth.vk.com/token?grant_type=password&" +
|
|
||||||
"client_id=${VKConstants.VK_APP_ID}&" +
|
"client_id=${VKConstants.VK_APP_ID}&" +
|
||||||
"scope=$settings&" +
|
"scope=$settings&" +
|
||||||
"client_secret=${VKConstants.VK_APP_SECRET}&" +
|
"client_secret=${BuildConfig.vkSecret}&" +
|
||||||
"username=$login&" +
|
"username=$login&" +
|
||||||
"password=$password" +
|
"password=$password" +
|
||||||
(if (captchaSid == null || captchaKey == null) "" else "&captcha_sid=$captchaSid&captcha_key=$captchaKey") +
|
(if (captchaSid == null || captchaKey == null) "" else "&captcha_sid=$captchaSid&captcha_key=$captchaKey") +
|
||||||
"&v=${VKApi.API_VERSION}"
|
"&v=${URLEncoder.encode(VKApi.API_VERSION, "utf-8")}"
|
||||||
// return "https://oauth.vk.com/token?grant_type=password&" +
|
|
||||||
// "client_id=2274003&" +
|
|
||||||
// "scope=notify,friends,photos,audio,video,docs,notes,pages,status,offers,questions,wall,groups,messages,email,notifications,stats,ads,market,offline&" +
|
|
||||||
// "client_secret=hHbZxrka2uZ6jB1inYsH&" +
|
|
||||||
// "username=$login&" +
|
|
||||||
// "password=$password" +
|
|
||||||
// (if (captcha.isEmpty()) "" else "&$captcha") +
|
|
||||||
// "&v=${VKApi.API_VERSION}"
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getUrl(api_id: String, settings: String): String {
|
|
||||||
return "https://oauth.vk.com/authorize?" +
|
fun getOAuthUrl(settings: String) = "https://oauth.vk.com/authorize?" +
|
||||||
"client_id=$api_id&" +
|
"client_id=${UserConfig.FAST_APP_ID}&" +
|
||||||
"display=mobile&" +
|
"display=mobile&" +
|
||||||
"scope=$settings&" +
|
"scope=$settings&" +
|
||||||
"redirect_uri=${
|
"redirect_uri=${
|
||||||
@@ -64,7 +54,6 @@ object VKAuth {
|
|||||||
}&" +
|
}&" +
|
||||||
"response_type=token&" +
|
"response_type=token&" +
|
||||||
"v=${URLEncoder.encode(VKApi.API_VERSION, "utf-8")}"
|
"v=${URLEncoder.encode(VKApi.API_VERSION, "utf-8")}"
|
||||||
}
|
|
||||||
|
|
||||||
fun parseRedirectUrl(url: String): Pair<String, Int> {
|
fun parseRedirectUrl(url: String): Pair<String, Int> {
|
||||||
val accessToken = VKUtil.extractPattern(url, "access_token=(.*?)&") ?: ""
|
val accessToken = VKUtil.extractPattern(url, "access_token=(.*?)&") ?: ""
|
||||||
|
|||||||
@@ -2,31 +2,10 @@ package com.meloda.fast.api
|
|||||||
|
|
||||||
object VKConstants {
|
object VKConstants {
|
||||||
|
|
||||||
|
|
||||||
const val GROUP_FIELDS = "description,members_count,counters,status,verified"
|
const val GROUP_FIELDS = "description,members_count,counters,status,verified"
|
||||||
|
|
||||||
const val USER_FIELDS =
|
const val USER_FIELDS =
|
||||||
"photo_50,photo_100,photo_200,status,screen_name,online,online_mobile,last_seen,verified,sex"
|
"photo_50,photo_100,photo_200,status,screen_name,online,online_mobile,last_seen,verified,sex"
|
||||||
|
|
||||||
const val VK_APP_ID = "2274003"
|
const val VK_APP_ID = "2274003"
|
||||||
const val VK_APP_SECRET = "hHbZxrka2uZ6jB1inYsH"
|
|
||||||
|
|
||||||
const val VK_ME_ID = "6146827"
|
|
||||||
const val VK_ME_SECRET = "qVxWRF1CwHERuIrKBnqe"
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
const val ACTION_CHAT_CREATE = "chat_create"
|
|
||||||
const val ACTION_PHOTO_UPDATE = "chat_photo_update"
|
|
||||||
const val ACTION_PHOTO_REMOVE = "chat_photo_remove"
|
|
||||||
const val ACTION_TITLE_UPDATE = "chat_title_update"
|
|
||||||
const val ACTION_PIN_MESSAGE = "chat_pin_message"
|
|
||||||
const val ACTION_UNPIN_MESSAGE = "chat_unpin_message"
|
|
||||||
const val ACTION_INVITE_USER = "chat_invite_user"
|
|
||||||
const val ACTION_INVITE_USER_BY_LINK = "chat_invite_user_by_link"
|
|
||||||
const val ACTION_KICK_USER = "chat_kick_user"
|
|
||||||
const val ACTION_SCREENSHOT = "chat_screenshot"
|
|
||||||
const val ACTION_INVITE_USER_BY_CALL = "chat_invite_user_by_call"
|
|
||||||
const val ACTION_INVITE_USER_BY_CALL_JOIN_LINK = "chat_invite_user_by_call_link"
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user