Skip to content

Commit 1ed6b3b

Browse files
committed
In the beginning…
0 parents  commit 1ed6b3b

File tree

1,837 files changed

+426151
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,837 files changed

+426151
-0
lines changed

‎.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
app/jniLibs/*/*.so filter=lfs diff=lfs merge=lfs -text
2+
*.zip -delta

‎.gitignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.DS_Store
2+
3+
.gradle
4+
.idea
5+
6+
build
7+
.cxx
8+
.externalNativeBuild
9+
obj
10+
11+
*.apk
12+
*.iml
13+
14+
/builds
15+
16+
/captures
17+
/local.properties
18+
19+
libc++_shared.so

‎.gitmodules

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
[submodule "app/jni/thirdparty/webp"]
2+
path = app/jni/thirdparty/webp
3+
url = https://chromium.googlesource.com/webm/libwebp
4+
shallow = true
5+
[submodule "app/jni/thirdparty/libyuv"]
6+
path = app/jni/thirdparty/libyuv
7+
url = https://chromium.googlesource.com/libyuv/libyuv
8+
shallow = true
9+
[submodule "app/jni/thirdparty/libtgvoip"]
10+
path = app/jni/thirdparty/libtgvoip
11+
url = https://github.com/TGX-Android/libtgvoip.git
12+
shallow = true
13+
[submodule "app/jni/thirdparty/ffmpeg"]
14+
path = app/jni/thirdparty/ffmpeg
15+
url = https://git.ffmpeg.org/ffmpeg.git
16+
shallow = true
17+
[submodule "app/jni/thirdparty/lz4"]
18+
path = app/jni/thirdparty/lz4
19+
url = https://github.com/lz4/lz4
20+
shallow = true
21+
[submodule "ExoPlayer"]
22+
path = thirdparty/ExoPlayer
23+
url = https://github.com/google/ExoPlayer.git
24+
shallow = true
25+
[submodule "app/jni/thirdparty/flac"]
26+
path = app/jni/thirdparty/flac
27+
url = https://gitlab.xiph.org/xiph/flac.git
28+
shallow = true
29+
[submodule "app/jni/thirdparty/opus"]
30+
path = app/jni/thirdparty/opus
31+
url = https://gitlab.xiph.org/xiph/opus.git
32+
shallow = true
33+
[submodule "app/jni/thirdparty/opusfile"]
34+
path = app/jni/thirdparty/opusfile
35+
url = https://gitlab.xiph.org/xiph/opusfile
36+
shallow = true
37+
[submodule "app/jni/thirdparty/ogg"]
38+
path = app/jni/thirdparty/ogg
39+
url = https://gitlab.xiph.org/xiph/ogg.git
40+
shallow = true
41+
[submodule "app/jni/thirdparty/libvpx"]
42+
path = app/jni/thirdparty/libvpx
43+
url = https://chromium.googlesource.com/webm/libvpx
44+
shallow = true
45+
[submodule "tdlib"]
46+
path = tdlib
47+
url = https://github.com/TGX-Android/tdlib
48+
shallow = true
49+
[submodule "app/jni/thirdparty/jni-utils"]
50+
path = app/jni/thirdparty/jni-utils
51+
url = https://github.com/TGX-Android/jni-utils
52+
shallow = true
53+
[submodule "vkryl/leveldb"]
54+
path = vkryl/leveldb
55+
url = https://github.com/TGX-Android/leveldb
56+
shallow = true
57+
[submodule "app/jni/thirdparty/rlottie"]
58+
path = app/jni/thirdparty/rlottie
59+
url = https://github.com/TGX-Android/rlottie
60+
shallow = true

‎Dockerfile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM ubuntu:hirsute
2+
3+
COPY scripts/ scripts/
4+
COPY version.properties version.properties
5+
COPY docker/ docker/
6+
7+
RUN apt-get update -y
8+
RUN apt-get install -y $(cat docker/dependencies.txt)
9+
10+
ENV ANDROID_SDK_ROOT "/usr/local/android-sdk-linux"
11+
RUN test -d $ANDROID_SDK_ROOT || (mkdir -p "$ANDROID_SDK_ROOT" && echo "Created ANDROID_SDK_ROOT at $ANDROID_SDK_ROOT")
12+
13+
ENV NDK_VERSION $(scripts/./read-property.sh version.properties version.ndk)
14+
ENV CMAKE_VERSION $(scripts/./read-property.sh version.properties version.cmake)
15+
ENV ANDROID_NDK "$ANDROID_SDK_ROOT/ndk/$NDK_VERSION"
16+
17+
ENV PATH "$ANDROID_NDK/prebuilt/linux-x86_64/bin:$ANDROID_SDK_ROOT/cmake/$CMAKE_VERSION/bin:$ANDROID_NDK:$ANDROID_SDK_ROOT/tools/bin:$ANDROID_SDK_ROOT/platform-tools:$PATH"
18+
ENV TERM "xterm"
19+
20+
ENV CC "$(which clang-12)"
21+
ENV CPP "$(which clang-cpp-12)"
22+
ENV CXX "$(which clang++-12)"
23+
ENV LD "$(which ld.lld-12)"
24+
25+
RUN scripts/./setup-sdk.sh

‎README.md

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# [Telegram X](https://play.google.com/store/apps/details?id=org.thunderdog.challegram) — a slick experimental Telegram client based on [TDLib](https://core.telegram.org/tdlib).
2+
3+
![Telegram X](/images/feature.png)
4+
5+
This is the complete source code and the build instructions for the official alternative Android client for the Telegram messenger, based on the [Telegram API](https://core.telegram.org/api) and the [MTProto](https://core.telegram.org/mtproto) secure protocol via [TDLib](https://github.com/TGX-Android/tdlib).
6+
7+
* [**Telegram X** on Google Play](http://play.google.com/store/apps/details?id=org.thunderdog.challegram)
8+
* [Subscribe to Beta](https://play.google.com/apps/testing/org.thunderdog.challegram)
9+
* [Announcements and Change Logs](https://t.me/tgx_android)
10+
* [Developer Log and APKs](https://t.me/tgx_log)
11+
12+
## Build instructions
13+
14+
### Prerequisites
15+
16+
* At least **5,34GB** of free disk space: **487,10MB** for source codes and around **4,85GB** for files generated after building all variants;
17+
* **4GB** of RAM;
18+
* **macOS** or **Linux**-based operating system. **Windows** platform is not yet supported in [scripts](/scripts) that build native dependencies, however, it might be easy to patch them in order to make it work.
19+
20+
#### macOS
21+
22+
* [Homebrew](https://brew.sh)
23+
* git with LFS, wget and sed: `$ brew install git git-lfs wget gsed`
24+
25+
#### Ubuntu
26+
27+
* git with LFS: `# apt install git git-lfs`
28+
29+
### Building
30+
31+
1. `$ git clone --recursive --depth=1 --shallow-submodules https://github.com/TGX-Android/Telegram-X tgx` — clone **Telegram X** with submodules;
32+
2. In case you forgot the `--recursive` flag, `cd` into `tgx` directory and: `$ git submodule init && git submodule update --init --recursive --depth=1`
33+
3. Create `keystore.properties` file outside of source tree with the following properties:<br/>`keystore.file`: absolute path to the keystore file;<br/>`keystore.password`: password for the keystore;<br/>`key.alias`: key alias that will be used to sign the app;<br/>`key.password`: key password.<br/>**Warning**: keep this file safe and make sure nobody, except you, has access to it. For production builds one could use a separate user with home folder encryption to avoid harm from physical theft;
34+
4. `$ cd tgx`;
35+
5. Run `$ scripts/./setup.sh` and follow up the instructions;
36+
6. Now you can open the project using **[Android Studio](https://developer.android.com/studio/)** or build manually from the command line: `./gradlew assembleUniversalRelease`.
37+
38+
#### Available flavors
39+
40+
* `arm64`: **arm64-v8a** build with `minSdkVersion` set to `21` (**Lollipop**)
41+
* `arm32`: **armeabi-v7a** build;
42+
* `x64`: **x86_64** build with `minSdkVersion` set to `21` (**Lollipop**)
43+
* `x86`: **x86** build;
44+
* `universal`: universal build that includes native bundles for all platforms.
45+
46+
## Reproducing public builds
47+
48+
In order to verify that there is no additional source code injected inside official APKs, you must use **Ubuntu 21.04** and comply with the following requirements:
49+
50+
1. Create user called `vk` with the home directory located at `/home/vk`;
51+
2. Clone `tgx` repository to `/home/vk/tgx`;
52+
3. Check out the specific commit you want to verify;
53+
4. `cd` into `tgx` folder and install dependencies: `# apt install $(cat reproducible-builds/dependencies.txt)`;
54+
5. Follow up the build instruction from the previous section;
55+
6. Run `$ apkanalyzer apk compare --different-only <remote-apk> <reproduced-apk>`;
56+
7. If only signature files and metadata differ, build reproduction is successful.
57+
58+
In future build reproduction will be made easier. Here's a list of related TODOs (PR-welcome!):
59+
60+
* Project path must not affect the resulting `.so` files, so user & project location requirement could be removed;
61+
* When building native binaries on **macOS**, `.comment` ELF section differs from the one built with **Linux** version of NDK. It must be removed or made deterministic without any side-effects like breaking `native-debug-symbols.zip` (or should be reported to NDK team?);
62+
* It might be a good idea to use `--build-id=0x<commit>` instead of `--build-id=none`;
63+
* Checksums of cold APK builds always differ, even though the same keystore applied and generated inner APK contents do not differ. Real cause must be investigated and fixed, if possible.<br/>To generate cold build, invoke `$ scripts/./reset.sh` and `$ scripts/./setup.sh --skip-sdk-setup`.<br/>**Warning**: this will also reset changes inside some of the submodules ([ffmpeg](/app/jni/thirdparty/ffmpeg), [libvpx](/app/jni/thirdparty/libvpx), [webp](/app/jni/thirdparty/webp), [opus](/app/jni/thirdparty/opus) and [ExoPlayer](/app/jni/thirdparty/exoplayer));
64+
65+
66+
<i>PS: [Docker](/Dockerfile) is not considered an option, as it just hides away these tasks, and requires that all published APKs must be built using it.</i>
67+
68+
## Verifying side-loaded APKs
69+
70+
If you downloaded **Telegram X** APK from somewhere and would like to simply verify whether it's an original APK without any injected malicious source code, you need to get `SHA-256` checksum of the downloaded APK file and find whether it corresponds to any known **Telegram X** version.
71+
72+
In order to obtain **SHA-256** of the APK:
73+
* `$ sha256sum <path-to-apk>` on **Ubuntu**
74+
* `$ shasum -a 256 <path-to-apk>` on **macOS**
75+
76+
Then there are three ways to find out the commit for the specific **SHA-256** checksum:
77+
78+
* Checking on GitHub releases page — if you don't have an access to Telegram (e.g. using another device);
79+
* Sending checksum to [`@tgx_bot`](https://t.me/tgx_bot);
80+
* Searching for a checksum in [`@tgx_log`](https://t.me/tgx_log).

‎app/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/jniLibs
2+
/arm
3+
/arm64
4+
/x86
5+
/x86_64
6+
/universal

0 commit comments

Comments
 (0)