Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support ton:// links #649

Open
wants to merge 50 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
7c22897
[TF] modify .gitignore
thermatk Mar 20, 2022
9867562
[TF][JNI] remove native deps to be replaced
thermatk Mar 20, 2022
573f11a
[TF][JNI][UPDATE] libwebp 1.2.0
thermatk Nov 7, 2020
c65ff4b
[TF][JNI][UPDATE] BoringSSL from source (master)
thermatk Aug 21, 2022
98762dc
[TF][JNI] libvpx 1.11
thermatk Feb 8, 2022
6bb5321
[TF][JNI][KILL] libvpx binaries
thermatk Feb 8, 2022
82d7f47
[TF][JNI] libvpx path
thermatk Feb 8, 2022
3addacf
[TF][JNI][UPDATE] FFmpeg 4.3.4 from source
thermatk Aug 21, 2022
67b79a3
[TF][JNI][FIX] ffmpeg header included and patched
thermatk Mar 28, 2022
7e1d806
[TF][JNI][FIX] ffmpeg include path
thermatk Aug 4, 2021
f0e54f7
[TF] API keys
thermatk Sep 15, 2019
83aacfe
[TF] various build adjustments
thermatk Oct 2, 2022
6142dfb
[TF][FEATURE] Support installing APKs
thermatk Feb 9, 2019
73c0a9d
[TF][KILL] Google Vision
thermatk Mar 28, 2022
c9dfb34
[TF][KILL] Google Wallet and Android Pay
thermatk Jan 25, 2019
6461912
[TF][KILL] remaining GMS(GCM, Wear, etc), except for Maps
thermatk Jan 25, 2019
4eb790a
[TF][CENSOR] PWN RKN without Firebase
thermatk Jan 25, 2019
d8cc069
[TF][MAPS] force Telegram's static map previews
thermatk Jan 26, 2019
081e5f7
[TF][PUSH] push service adjustments
thermatk Jan 26, 2019
05fbb45
[TF][PUSH] notification in foregroung on Oreo+
thermatk Jul 21, 2019
f8ef47f
[TF][PUSH] remove one of the confusing toggles
thermatk Mar 9, 2019
37c32e5
[TF][BRAND] Do not send to Google Play for update
thermatk Jan 23, 2019
a6a648b
[TF][BRAND] Send invite link to F-Droid
thermatk May 2, 2020
edcdc3b
[TF][BRAND] AppName
thermatk May 2, 2020
d3f9447
[TF][KILL] remove fusedlocationprovider
thermatk Oct 13, 2020
17cb0d9
[TF][KILL] GMS SMS Receiver
thermatk Sep 15, 2019
702b7fb
[TF][KILL] Google Voice
thermatk Jan 4, 2020
6a1aae4
[TF][FIX] missing viewpager dependency
thermatk Jan 11, 2020
4692447
[TF][PUSH] default is true
thermatk Jan 12, 2020
758b638
[TF][PUSH] Enable push in migration case
thermatk Jan 25, 2020
ffa555a
[TF][FIX] missing interpolator dependency
thermatk Oct 12, 2020
dfcfffb
[TF][BRAND] in settings
thermatk Jul 26, 2020
2ab70c9
[TF][FEATURE] no restrictions
thermatk Apr 19, 2021
36ed414
[TF][FIX] the inverse color QR code scanned without vision
nekohasekai Jun 26, 2021
7b3fa86
[TF][KILL] Google Translate without MLKit
thermatk Jul 19, 2022
cb3f729
[TF][FEATURE] QR login always on
thermatk Jan 26, 2022
edaee43
[TF][KILL] Huawei
thermatk Aug 28, 2022
b278e5f
[TF] clean app gradle
thermatk Aug 28, 2022
cc88c8b
[TF][KILL] Android Billing
thermatk Oct 2, 2022
39cfe00
[TF][KILL] Google Login
thermatk Oct 2, 2022
f85d073
[TF][KILL] leftovers of GMS in manifests
thermatk Sep 12, 2022
f92680e
[TF][MAPS] replace Google Maps with OSMDroid
thermatk Sep 4, 2022
23f6d26
[TF][MAPS] OSMDroid useragent and cache directory configuration
thermatk Sep 4, 2022
8f60730
[TF][MAPS] support geo: intents
thermatk Jan 2, 2021
e537842
[TF][FEATURE] replace Apple's emojis with twemoji
thermatk Sep 4, 2022
d6f0c81
[TF][emoji] pick a close emoji for missing ones
thermatk Sep 4, 2022
854ba8c
[TF][Fix] crash on Android S+
tehcneko Dec 4, 2022
06bbe60
[TF] Readme + Changelog
thermatk Dec 4, 2022
93ae9c9
support ton:// links
mr-tron Dec 10, 2022
794c4be
remove google maps usage in manifest
mr-tron Dec 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
liberapay: Telegram-FOSS
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
.idea/
.gradle/
.cxx/
build/
obj/
*.iml
local.properties
API_KEYS
*.hprof
TMessagesProj/.externalNativeBuild/
TMessagesProj/jni/ffmpeg/android/
TMessagesProj/jni/ffmpeg/build/
TMessagesProj/jni/boringssl/build/
14 changes: 14 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[submodule "TMessagesProj/jni/libwebp"]
path = TMessagesProj/jni/libwebp
url = https://github.com/webmproject/libwebp
[submodule "TMessagesProj/jni/boringssl"]
path = TMessagesProj/jni/boringssl
url = https://github.com/google/boringssl
ignore = all
[submodule "TMessagesProj/jni/libvpx"]
path = TMessagesProj/jni/libvpx
url = https://github.com/webmproject/libvpx
[submodule "TMessagesProj/jni/ffmpeg"]
path = TMessagesProj/jni/ffmpeg
url = https://github.com/FFmpeg/FFmpeg
ignore = all
694 changes: 694 additions & 0 deletions Changelog.md

Large diffs are not rendered by default.

Binary file added DigitalResistance.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions Notifications.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Notifications

Since [Android 8.0 Oreo, Google doesn't allow apps to run in the background anymore](https://developer.android.com/about/versions/oreo/background#services), requiring all apps which were previously keeping background connection to exclusively use its Firebase push messaging service.

As one can't use Google's push messaging in a FOSS app, Telegram-FOSS has to show you a notification to keep the background service running. Otherwise, you wouldn't be notified about new messages.

Sadly, if the app would set the notification to lower priority (to hide it a bit in the lower part of the notification screen), you would immediately get a system notification about Telegram "using battery", which is confusing and is the reason for this not being the default. Despite Google's misleading warnings, there is no difference in battery usage between v4.6 in "true background" and v4.9+ with notification.

## Make it better

You may still lower the priority of the notification channel or even hide it altogether manually (make a long tap on the notification). You will then receive the misleading system notification, which [may be disabled as well with another long tap](https://9to5google.com/2017/10/26/how-to-disable-android-oreo-using-battery-notification-android-basics/).
144 changes: 121 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,137 @@
## Telegram messenger for Android
[![Releases](https://img.shields.io/github/release/Telegram-FOSS-Team/Telegram-FOSS.svg)](https://github.com/Telegram-FOSS-Team/Telegram-FOSS/releases/latest)
[![Discussions](https://img.shields.io/badge/Offtopics-Telegram-blue.svg)](https://t.me/tfossofftopics)

[![Donate](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/Telegram-FOSS/) or <img src="https://en.bitcoin.it/w/images/en/c/cb/BC_Logotype.png" alt="Bitcoin" height="25px" /> `1P8kNcifVAkBWtWmjKY4RvVLy5QwruE2LQ`

# Telegram-FOSS

[Telegram](https://telegram.org) is a messaging app with a focus on speed and security. It’s superfast, simple and free.
This repo contains the official source code for [Telegram App for Android](https://play.google.com/store/apps/details?id=org.telegram.messenger).

## Creating your Telegram Application
This is an unofficial, FOSS-friendly fork of the original [Telegram App for Android](https://github.com/DrKLO/Telegram).

This version of Telegram is available on FDroid:

[<img src="https://f-droid.org/badge/get-it-on.png"
alt="Get it on F-Droid"
height="80">](https://f-droid.org/app/org.telegram.messenger)

## Current Maintainers

- [thermatk](https://github.com/thermatk)
- you? :)

## Contributors

- [slp](https://github.com/slp)
- [Bubu](https://github.com/Bubu)
- [Sudokamikaze](https://github.com/Sudokamikaze)
- [l2dy](https://github.com/l2dy)
- [maximgrafin](https://github.com/maximgrafin)
- [vn971](https://github.com/vn971)
- [theel0ja](https://github.com/theel0ja)
- [AnXh3L0](https://github.com/AnXh3L0)
- [noplanman](https://github.com/noplanman)
- [vk496](https://github.com/vk496)
- [verdulo](https://github.com/verdulo)
- [anupritaisno1](https://github.com/anupritaisno1)
- [nekohasekai](https://github.com/nekohasekai)
- [kdrag0n](https://github.com/kdrag0n)
- [terachad](https://github.com/terachad)
- [ppnplus](https://github.com/ppnplus)
- [luvletter2333](https://github.com/luvletter2333)
- [23rd](https://github.com/23rd)
- [proletarius101](https://github.com/proletarius101)
- [CWJamieson](https://github.com/CWJamieson)
- [verdulo](https://github.com/verdulo)
- [tehcneko](https://github.com/tehcneko)

## Discussion

Join the [Telegram-FOSS Offtopics group](https://t.me/tfossofftop)

You can also join `#telegram-foss:matrix.org` via [matrix](https://matrix.to/#/#telegram-foss:matrix.org) or `#telegram-foss` on freenode.

## Changes:

We welcome all developers to use our API and source code to create applications on our platform.
There are several things we require from **all developers** for the moment.
*Replacement of non-FOSS, untrustworthy or suspicious binaries or source code:*
- Do location sharing with OpenStreetMap(osmdroid) instead of Google Maps
- Use Twemoji emoji set instead of Apple's emoji
- Google Play Services GCM replaced with Telegram's push service
- Has to show a notification on Oreo+, ask Google
- **SECURITY:** BoringSSL prebuilts are replaced with recent upstream source code built at compile time
- **SECURITY:** FFmpeg prebuilts are replaced with recent upstream source code built at compile time
- **SECURITY:** libvpx prebuilts are replaced with recent upstream source code built at compile time
- **SECURITY:** Bundled libWebP is updated

1. [**Obtain your own api_id**](https://core.telegram.org/api/obtaining_api_id) for your application.
2. Please **do not** use the name Telegram for your app — or make sure your users understand that it is unofficial.
3. Kindly **do not** use our standard logo (white paper plane in a blue circle) as your app's logo.
3. Please study our [**security guidelines**](https://core.telegram.org/mtproto/security_guidelines) and take good care of your users' data and privacy.
4. Please remember to publish **your** code too in order to comply with the licences.
*Removal of non-FOSS, untrustworthy or suspicious binaries or source code and their functionality:*
- Google Vision face detection and barcode scanning (Passport)
- Google Wallet and Android Pay integration
- Google Voice integration
- HockeyApp crash reporting and self-updates
- Google SMS retrieval. You have to type the code manually
- Google ML Kit

### API, Protocol documentation
*Other:*
- Added the ability to parse locations from intents containing a `geo:<lat>,<lon>,<zoom>` string
- Force static map previews from Telegram
- No content restrictions

## Versioning

This repository contains tags to make tracking versions easier.

Versions are in form "v$UPSTREAM$RELEASE" where:

* $UPSTREAM is the public, visible version of upstream.
* $RELEASE is a letter ([a-z]) indicating minor releases between official versions (sometimes, upstream is updated without relating the changes to an specific version).

## API, Protocol documentation

Telegram API manuals: https://core.telegram.org/api

MTproto protocol manuals: https://core.telegram.org/mtproto

### Compilation Guide
## Building

**NOTE: Building on Windows is, unfortunately, not supported.
Consider using a Linux VM or dual booting.**
![WindowsSupport](/tgfoss-build-under-win.gif?raw=true)

**Important:**

1. You need the Android NDK, Go(Golang) and [Ninja](https://ninja-build.org/) to build the apk.

2. Don't forget to include the submodules when you clone:
- `git clone --recursive https://github.com/Telegram-FOSS-Team/Telegram-FOSS.git`

3. Build native FFmpeg and BoringSSL dependencies:
- Go to the `TMessagesProj/jni` folder and execute the following (define the paths to your NDK and Ninja):

```
export NDK=[PATH_TO_NDK]
export NINJA_PATH=[PATH_TO_NINJA]
./build_libvpx_clang.sh
./build_ffmpeg_clang.sh
./patch_ffmpeg.sh
./patch_boringssl.sh
./build_boringssl.sh
```

**Note**: In order to support [reproducible builds](https://core.telegram.org/reproducible-builds), this repo contains dummy release.keystore, google-services.json and filled variables inside BuildVars.java. Before publishing your own APKs please make sure to replace all these files with your own.
4. If you want to publish a modified version of Telegram:
- You should get **your own API key** here: https://core.telegram.org/api/obtaining_api_id and create a file called `API_KEYS` in the source root directory.
The contents should look like this:
```
APP_ID = 12345
APP_HASH = aaaaaaaabbbbbbccccccfffffff001122
```
- Do not use the name Telegram and the standard logo (white paper plane in a blue circle) for your app — or make sure your users understand that it is unofficial
- Take good care of your users' data and privacy
- **Please remember to publish your code too in order to comply with the licenses**

You will require Android Studio 3.4, Android NDK rev. 20 and Android SDK 8.1
The project can be built with Android Studio or from the command line with gradle:

1. Download the Telegram source code from https://github.com/DrKLO/Telegram ( git clone https://github.com/DrKLO/Telegram.git )
2. Copy your release.keystore into TMessagesProj/config
3. Fill out RELEASE_KEY_PASSWORD, RELEASE_KEY_ALIAS, RELEASE_STORE_PASSWORD in gradle.properties to access your release.keystore
4. Go to https://console.firebase.google.com/, create two android apps with application IDs org.telegram.messenger and org.telegram.messenger.beta, turn on firebase messaging and download google-services.json, which should be copied to the same folder as TMessagesProj.
5. Open the project in the Studio (note that it should be opened, NOT imported).
6. Fill out values in TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java – there’s a link for each of the variables showing where and which data to obtain.
7. You are ready to compile Telegram.
`./gradlew assembleAfatRelease`

### Localization
# DIGITAL RESISTANCE

We moved all translations to https://translations.telegram.org/en/android/. Please use it.
![DIGITALRESISTANCE](/DigitalResistance.jpg?raw=true "DIGITALRESISTANCE")
34 changes: 20 additions & 14 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,44 @@ configurations {
}

configurations.all {
exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'androidx.recyclerview', module: 'recyclerview'
}

dependencies {
implementation 'androidx.core:core:1.6.0'
implementation 'androidx.palette:palette:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.3.3'
implementation 'androidx.interpolator:interpolator:1.0.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation "androidx.sharetarget:sharetarget:1.2.0"

compileOnly 'org.checkerframework:checker-qual:2.5.2'
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
implementation 'com.google.firebase:firebase-messaging:22.0.0'
implementation 'com.google.firebase:firebase-config:21.0.1'
implementation 'com.google.firebase:firebase-datatransport:18.1.0'
implementation 'com.google.firebase:firebase-appindexing:20.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.1'
implementation 'com.google.android.gms:play-services-auth:19.2.0'
implementation 'com.google.android.gms:play-services-vision:20.1.3'
implementation 'com.google.android.gms:play-services-wearable:17.1.0'
implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation 'com.google.android.gms:play-services-wallet:18.1.3'
implementation 'com.googlecode.mp4parser:isoparser:1.0.6'
implementation 'com.stripe:stripe-android:2.0.2'
implementation 'com.google.mlkit:language-id:16.1.1'
implementation 'com.android.billingclient:billing:5.0.0'
implementation 'com.google.code.gson:gson:2.10'

implementation 'org.osmdroid:osmdroid-android:6.1.14'

coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
}

def isWindows = String.valueOf(DefaultNativePlatform.currentOperatingSystem.toFamilyName() == OperatingSystemFamily.WINDOWS)

//return an api key from a properties file.
def getAppId(){
Properties properties = new Properties()
properties.load(new FileInputStream("./API_KEYS"))
return properties.get("APP_ID")
}
def getAppHash(){
Properties properties = new Properties()
properties.load(new FileInputStream("./API_KEYS"))
return "\"" + properties.get("APP_HASH") + "\""
}

android {
compileSdkVersion 31
buildToolsVersion '31.0.0'
Expand Down Expand Up @@ -84,6 +88,9 @@ android {
versionName "8.9.0"

vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
//obtain your own keys at https://core.telegram.org/api/obtaining_api_id
buildConfigField 'int', 'APP_ID', getAppId()
buildConfigField 'String', 'APP_HASH', getAppHash()

multiDexEnabled true

Expand Down Expand Up @@ -176,4 +183,3 @@ def getProps(String propName) {
return "";
}
}
apply plugin: 'com.google.gms.google-services'
37 changes: 1 addition & 36 deletions TMessagesProj/config/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,57 +8,22 @@
<uses-feature android:name="android.hardware.location" android:required="false" />
<uses-feature android:name="android.hardware.LOCATION" android:required="false" />

<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="${applicationId}.permission.MAPS_RECEIVE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>

<permission android:name="${applicationId}.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>

<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/AppNameBeta"
android:label="Telegram FOSS Beta"
android:theme="@style/Theme.TMessages.Start"
android:hardwareAccelerated="@bool/useHardwareAcceleration"
android:largeHeap="true"
android:supportsRtl="false"
android:requestLegacyExternalStorage="true"
tools:replace="android:supportsRtl">

<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />

<service
android:name="org.telegram.messenger.GcmPushListenerService" android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>

<uses-library android:name="com.google.android.maps" android:required="false"/>

<meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" />
<meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" />

<receiver
tools:replace="android:enabled"
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
android:enabled="false"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.measurement.UPLOAD" />
</intent-filter>
</receiver>

<service
tools:replace="android:enabled"
android:name="com.google.android.gms.measurement.AppMeasurementService"
android:enabled="false"
android:exported="false" />

</application>

</manifest>
37 changes: 1 addition & 36 deletions TMessagesProj/config/debug/AndroidManifest_SDK23.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,59 +8,24 @@
<uses-feature android:name="android.hardware.location" android:required="false" />
<uses-feature android:name="android.hardware.LOCATION" android:required="false" />

<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="${applicationId}.permission.MAPS_RECEIVE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />



<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/AppNameBeta"
android:label="Telegram FOSS Beta"
android:theme="@style/Theme.TMessages.Start"
android:hardwareAccelerated="@bool/useHardwareAcceleration"
android:largeHeap="true"
android:supportsRtl="false"
android:requestLegacyExternalStorage="true"
tools:replace="android:supportsRtl">

<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyA-t0jLPjUt2FxrA8VPK2EiYHcYcboIR6k" />

<service
android:name="org.telegram.messenger.GcmPushListenerService" android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>

<uses-library android:name="com.google.android.maps" android:required="false"/>

<meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" />
<meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" />

<receiver
tools:replace="android:enabled"
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
android:enabled="false"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.measurement.UPLOAD" />
</intent-filter>
</receiver>

<service
tools:replace="android:enabled"
android:name="com.google.android.gms.measurement.AppMeasurementService"
android:enabled="false"
android:exported="false" />

</application>

</manifest>
Binary file removed TMessagesProj/config/release.keystore
Binary file not shown.
Loading