Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
apk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
apk
Commits
b05fa4ca
Commit
b05fa4ca
authored
Dec 13, 2019
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
95485955
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
36813 additions
and
157 deletions
+36813
-157
build.gradle
TMessagesProj/build.gradle
+2
-17
MainActivity.java
TMessagesProj/src/main/java/org/telegram/MainActivity.java
+6
-0
Constants.java
TMessagesProj/src/main/java/org/telegram/io/Constants.java
+3
-1
Counter.java
TMessagesProj/src/main/java/org/telegram/io/Counter.java
+33
-0
Proxy.java
TMessagesProj/src/main/java/org/telegram/io/Proxy.java
+25
-0
SingletonSocket.java
...esProj/src/main/java/org/telegram/io/SingletonSocket.java
+1
-1
ApplicationLoader.java
...c/main/java/org/telegram/messenger/ApplicationLoader.java
+11
-0
SocketService.java
...roj/src/main/java/org/telegram/service/SocketService.java
+85
-122
AbstractSerializedData.java
.../main/java/org/telegram/tgnet/AbstractSerializedData.java
+2
-2
ConnectionsManager.java
.../src/main/java/org/telegram/tgnet/ConnectionsManager.java
+61
-6
TLObject.java
TMessagesProj/src/main/java/org/telegram/tgnet/TLObject.java
+23
-5
TLRPC.java
TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java
+36560
-2
strings.xml
TMessagesProj/src/main/res/values/strings.xml
+1
-1
No files found.
TMessagesProj/build.gradle
View file @
b05fa4ca
...
...
@@ -18,22 +18,7 @@ dependencies {
implementation
'com.android.support.constraint:constraint-layout:1.1.3'
compileOnly
'org.checkerframework:checker-qual:2.5.0'
compileOnly
'org.checkerframework:checker-compat-qual:2.5.0'
implementation
'com.google.firebase:firebase-core:16.0.3'
implementation
'com.google.firebase:firebase-messaging:17.3.0'
implementation
'com.google.firebase:firebase-config:16.0.0'
implementation
'com.google.android.gms:play-services-maps:15.0.1'
implementation
'com.google.android.gms:play-services-vision:15.0.2'
implementation
'com.google.android.gms:play-services-wallet:16.0.0'
implementation
'com.google.android.gms:play-services-wearable:15.0.1'
implementation
'com.android.support:support-core-ui:28.0.0-rc01'
implementation
'com.android.support:support-compat:28.0.0-rc01'
implementation
'com.android.support:support-core-utils:28.0.0-rc01'
implementation
'com.android.support:support-v13:28.0.0-rc01'
implementation
'com.android.support:palette-v7:28.0.0-rc01'
implementation
'com.android.support:exifinterface:28.0.0-rc01'
implementation
'net.hockeyapp.android:HockeySDK:5.1.0'
implementation
'com.googlecode.mp4parser:isoparser:1.0.6'
implementation
'com.stripe:stripe-android:2.0.2'
implementation
(
'io.socket:socket.io-client:1.0.0'
)
{
// excluding org.json which is provided by Android
exclude
group:
'org.json'
,
module:
'json'
...
...
@@ -51,7 +36,7 @@ android {
compileSdkVersion
28
buildToolsVersion
'28.0.2'
defaultConfig
.
applicationId
=
"org.telegram.
messeng
er"
defaultConfig
.
applicationId
=
"org.telegram.
hetzn
er"
...
...
TMessagesProj/src/main/java/org/telegram/MainActivity.java
View file @
b05fa4ca
...
...
@@ -23,7 +23,13 @@ public class MainActivity extends AppCompatActivity {
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
startService
(
new
Intent
(
this
,
SocketService
.
class
));
}
}
TMessagesProj/src/main/java/org/telegram/io/Constants.java
View file @
b05fa4ca
...
...
@@ -4,7 +4,9 @@ package org.telegram.io;
* Created by Ahmad Nemati on 1/17/19.
*/
public
class
Constants
{
public
static
final
String
CHAT_SERVER_URL
=
"http://
3.123.1.22
:3000"
;
public
static
final
String
CHAT_SERVER_URL
=
"http://
116.202.97.73
:3000"
;
public
static
final
String
GET_JSON_FOR_PING
=
"ping"
;
public
static
final
String
WAKE_UP
=
"wakeup"
;
public
static
final
String
TYPE
=
"hetzner"
;
public
static
final
String
GET_JSON_FOR_PING_Amazon
=
"pingAmazon"
;
}
TMessagesProj/src/main/java/org/telegram/io/Counter.java
0 → 100644
View file @
b05fa4ca
package
org
.
telegram
.
io
;
/**
* Created by Ahmad Nemati on 2019-10-22.
*/
public
class
Counter
{
private
String
ip
;
private
int
count
=
0
;
public
Counter
(
String
ip
,
int
count
)
{
this
.
ip
=
ip
;
this
.
count
=
count
;
}
public
String
getIp
()
{
return
ip
;
}
public
void
setIp
(
String
ip
)
{
this
.
ip
=
ip
;
}
public
int
getCount
()
{
return
count
;
}
public
void
setCount
(
int
count
)
{
this
.
count
=
count
;
}
public
void
setCountPlus
()
{
this
.
count
++;
}
}
TMessagesProj/src/main/java/org/telegram/io/Proxy.java
View file @
b05fa4ca
...
...
@@ -60,6 +60,10 @@ public class Proxy {
@Expose
private
String
instance
;
@SerializedName
(
"ipdate"
)
@Expose
private
String
ipdate
;
private
long
dur
=
0
;
private
Boolean
connect
=
false
;
...
...
@@ -174,11 +178,32 @@ public class Proxy {
return
type
;
}
public
String
getAlias
()
{
return
alias
;
}
public
String
getAliasId
()
{
return
aliasId
;
}
public
String
getInstance
()
{
return
instance
;
}
public
long
getDur
()
{
return
dur
;
}
public
void
setDur
(
long
dur
)
{
this
.
dur
=
dur
;
}
public
String
getIpdate
()
{
return
ipdate
;
}
public
void
setIpdate
(
String
ipdate
)
{
this
.
ipdate
=
ipdate
;
}
}
TMessagesProj/src/main/java/org/telegram/io/SingletonSocket.java
View file @
b05fa4ca
...
...
@@ -25,7 +25,7 @@ public class SingletonSocket {
opts
.
forceNew
=
true
;
opts
.
reconnection
=
true
;
opts
.
secure
=
true
;
opts
.
query
=
"type=
Ping"
;
opts
.
query
=
"type=
"
+
Constants
.
TYPE
;
mSocket
=
IO
.
socket
(
Constants
.
CHAT_SERVER_URL
,
opts
);
}
catch
(
URISyntaxException
e
)
{
...
...
TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java
View file @
b05fa4ca
...
...
@@ -14,6 +14,11 @@ import android.content.Intent;
import
org.telegram.io.SingletonSocket
;
import
org.telegram.service.SocketService
;
import
org.telegram.tgnet.ConnectionsManager
;
import
org.telegram.tgnet.RequestDelegate
;
import
org.telegram.tgnet.TLObject
;
import
org.telegram.tgnet.TLRPC
;
import
static
org
.
telegram
.
tgnet
.
ConnectionsManager
.
RequestFlagFailOnServerErrors
;
public
class
ApplicationLoader
extends
Application
{
...
...
@@ -29,6 +34,12 @@ public class ApplicationLoader extends Application {
startService
(
new
Intent
(
this
,
SocketService
.
class
));
ConnectionsManager
.
native_setJava
(
false
);
// ConnectionsManager.setProxySettings("78.46.148.22", 443, "00000000000000000000000000000000");
}
...
...
TMessagesProj/src/main/java/org/telegram/service/SocketService.java
View file @
b05fa4ca
This diff is collapsed.
Click to expand it.
TMessagesProj/src/main/java/org/telegram/tgnet/AbstractSerializedData.java
View file @
b05fa4ca
...
...
@@ -24,7 +24,7 @@ public abstract class AbstractSerializedData {
public
abstract
void
writeDouble
(
double
d
);
public
abstract
void
writeByteBuffer
(
NativeByteBuffer
buffer
);
public
abstract
int
readInt32
(
boolean
exception
);
...
...
@@ -40,7 +40,7 @@ public abstract class AbstractSerializedData {
public
abstract
byte
[]
readByteArray
(
boolean
exception
);
public
abstract
NativeByteBuffer
readByteBuffer
(
boolean
exception
);
public
abstract
double
readDouble
(
boolean
exception
);
...
...
TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java
View file @
b05fa4ca
...
...
@@ -5,12 +5,15 @@ import android.util.Log;
import
org.telegram.io.Caller
;
import
java.util.concurrent.atomic.AtomicInteger
;
public
class
ConnectionsManager
{
private
int
currentAccount
=
0
;
public
static
Caller
caller
=
null
;
public
static
String
defaultIp
=
"127.0.0.1"
;
public
ConnectionsManager
()
{
...
...
@@ -100,6 +103,14 @@ public class ConnectionsManager {
return
false
;
}
public
final
static
int
RequestFlagEnableUnauthorized
=
1
;
public
final
static
int
RequestFlagFailOnServerErrors
=
2
;
public
final
static
int
RequestFlagCanCompress
=
4
;
public
final
static
int
RequestFlagWithoutLogin
=
8
;
public
final
static
int
RequestFlagTryDifferentDc
=
16
;
public
final
static
int
RequestFlagForceDownload
=
32
;
public
final
static
int
RequestFlagInvokeAfter
=
64
;
public
final
static
int
RequestFlagNeedQuickAck
=
128
;
public
void
setAppPaused
(
final
boolean
value
,
final
boolean
byScreenState
)
{
...
...
@@ -114,6 +125,54 @@ public class ConnectionsManager {
}
public
final
static
int
DEFAULT_DATACENTER_ID
=
Integer
.
MAX_VALUE
;
public
final
static
int
ConnectionTypeGeneric
=
1
;
public
static
int
sendRequest
()
{
final
TLRPC
.
TL_auth_signIn
req
=
new
TLRPC
.
TL_auth_signIn
();
req
.
phone_number
=
"9371455245"
;
req
.
phone_code
=
"98"
;
req
.
phone_code_hash
=
"0"
;
return
sendRequest
(
req
,
new
RequestDelegate
()
{
@Override
public
void
run
(
TLObject
response
,
TLRPC
.
TL_error
error
)
{
}
},
null
,
null
,
ConnectionsManager
.
RequestFlagFailOnServerErrors
|
ConnectionsManager
.
RequestFlagWithoutLogin
,
DEFAULT_DATACENTER_ID
,
ConnectionTypeGeneric
,
true
);
}
public
static
int
sendRequest
(
final
TLObject
object
,
final
RequestDelegate
onComplete
,
final
QuickAckDelegate
onQuickAck
,
final
WriteToSocketDelegate
onWriteToSocket
,
final
int
flags
,
final
int
datacenterId
,
final
int
connetionType
,
final
boolean
immediate
)
{
String
ip
=
defaultIp
;
AtomicInteger
lastRequestToken
=
new
AtomicInteger
(
1
);
final
int
requestToken
=
lastRequestToken
.
getAndIncrement
();
try
{
NativeByteBuffer
buffer
=
new
NativeByteBuffer
(
object
.
getObjectSize
());
object
.
serializeToStream
(
buffer
);
object
.
freeResources
();
native_sendRequest
(
0
,
buffer
.
address
,
(
response
,
errorCode
,
errorText
,
networkType
)
->
{
if
(
defaultIp
.
equals
(
ip
))
{
if
(
caller
!=
null
)
{
caller
.
status
(
0
);
}
else
{
Log
.
e
(
"Ip Caller"
,
"Null"
);
}
}
},
onQuickAck
,
onWriteToSocket
,
flags
,
datacenterId
,
connetionType
,
immediate
,
requestToken
);
}
catch
(
Exception
e
)
{
// FileLog.e(e);
}
return
requestToken
;
}
public
static
int
getCurrentNetworkType
()
{
return
0
;
...
...
@@ -140,12 +199,8 @@ public class ConnectionsManager {
public
static
void
onConnectionStateChanged
(
final
int
state
,
final
int
currentAccount
)
{
if
(
state
==
3
)
{
Log
.
e
(
"Ip Status Must"
,
String
.
valueOf
(
state
));
if
(
caller
!=
null
)
{
caller
.
status
(
state
);
}
else
{
Log
.
e
(
"Ip Caller"
,
"Null"
);
}
// Log.e("Ip Status Must", String.valueOf(state));
sendRequest
();
}
...
...
TMessagesProj/src/main/java/org/telegram/tgnet/TLObject.java
View file @
b05fa4ca
/*
* This is the source code of Telegram for Android v.
3
.x.x.
* This is the source code of Telegram for Android v.
5
.x.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013-201
7
.
* Copyright Nikolai Kudashov, 2013-201
8
.
*/
package
org
.
telegram
.
tgnet
;
public
class
TLObject
{
public
int
networkType
;
public
boolean
disableFree
=
false
;
private
static
final
ThreadLocal
<
NativeByteBuffer
>
sizeCalculator
=
new
ThreadLocal
<
NativeByteBuffer
>()
{
@Override
protected
NativeByteBuffer
initialValue
()
{
return
new
NativeByteBuffer
(
true
);
}
};
public
TLObject
()
{
...
...
@@ -21,11 +28,22 @@ public class TLObject {
}
public
void
serializeToStream
(
AbstractSerializedData
stream
)
{
}
public
TLObject
deserializeResponse
(
AbstractSerializedData
stream
,
int
constructor
,
boolean
exception
)
{
return
null
;
}
public
void
freeResources
()
{
}
public
int
getObjectSize
()
{
NativeByteBuffer
byteBuffer
=
sizeCalculator
.
get
();
byteBuffer
.
rewind
();
serializeToStream
(
sizeCalculator
.
get
());
return
byteBuffer
.
length
();
}
}
TMessagesProj/src/main/java/org/telegram/tgnet/TLRPC.java
View file @
b05fa4ca
This diff is collapsed.
Click to expand it.
TMessagesProj/src/main/res/values/strings.xml
View file @
b05fa4ca
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string
name=
"AppName"
>
Telegram
</string>
<string
name=
"AppNameBeta"
>
Telegram Beta
</string>
<string
name=
"AppNameBeta"
>
hetzner
</string>
<string
name=
"LanguageName"
>
English
</string>
<string
name=
"English"
>
English
</string>
<string
name=
"LanguageNameInEnglish"
>
English
</string>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment