Skip to content

Commit

Permalink
Linux Support, Updates & Bugfixes (tejado#6)
Browse files Browse the repository at this point in the history
* Specify web.js script as module to fix parcel v2

* Fix minor bugs

* Upgrade dependencies

* Add Linux support
  • Loading branch information
tejado committed Nov 13, 2021
1 parent 9261713 commit 355e7e4
Show file tree
Hide file tree
Showing 13 changed files with 11,995 additions and 6,524 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Telegram Nearby Map

Telegram Nearby Map uses OpenStreetMap and the official Telegram library to locate nearby users.
Telegram Nearby Map uses OpenStreetMap and the official Telegram library to find the position of nearby users.

Inspired by [Ahmed's blog post](https://blog.ahmed.nyc/2021/01/if-you-use-this-feature-on-telegram.html) and a [Hacker News discussion](https://news.ycombinator.com/item?id=25641399).
Developed by [github.com/tejado](https://github.com/tejado).
Expand All @@ -10,7 +10,7 @@ Developed by [github.com/tejado](https://github.com/tejado).
## How does it work?
Every 25 seconds all nearby users will be received with [TDLib](https://core.telegram.org/tdlib) from Telegram. This includes the distance of every nearby user to "my" location. With three distances from three different points, it is possible to calculate the position of the nearby user.

This only works if the users have activated the nearby feature inside Telegram. Per default it is deactivated.
This only finds Telegram users which have activated the nearby feature. Per default it is deactivated.

## Installation

Expand All @@ -24,4 +24,12 @@ Requirements: node.js and an Telegram account
6. Look carefully at the output: you will need to confirm your Telegram login
7. Go to http:https://localhost:3000 and have fun

Linux users: you will need to compile TDLib yourself and put it into the lib/tdlib folder.
## Dependencies
To avoid that you have to build TDLib yourself (https://github.com/tdlib/td#building), I added [tdlib.native](https://github.com/ForNeVeR/tdlib.native/releases) in the lib/tdlib folder. Please note that this is an external dependency that has not been fully reviewed by me!

## Changelog

### 2021-11-13
- Added [tdlib.native](https://github.com/ForNeVeR/tdlib.native/releases) for Linux (now it works in GitHub Codespaces)
- Updated all dependencies
- Bugfixes
Binary file modified lib/tdlib/libcrypto-1_1-x64.dll
Binary file not shown.
Binary file modified lib/tdlib/libssl-1_1-x64.dll
Binary file not shown.
Binary file added lib/tdlib/libtdjson.so
Binary file not shown.
Binary file modified lib/tdlib/tdjson.dll
Binary file not shown.
Binary file modified lib/tdlib/zlib1.dll
Binary file not shown.
12 changes: 10 additions & 2 deletions lib/telegram-nearby.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@ function sleep(ms) {
class TelegramNearby {
constructor(apiId, apiHash) {
let root = process.cwd();
process.chdir('lib/tdlib');
process.chdir('lib/tdlib/');

this.client = new Client(new TDLib(), {
let tdLibraryPath = "./libtdjson.so";
if (process.platform === "win32") {
tdLibraryPath = "tdjson.dll";
}

console.log(`Current WD: ${process.cwd()}`)
console.log(`Lib Path: ${tdLibraryPath}`)
this.client = new Client(new TDLib(tdLibraryPath), {
apiId: apiId,
apiHash: apiHash,
});

process.chdir(root);

this.client.connectAndLogin();
Expand Down
Loading

0 comments on commit 355e7e4

Please sign in to comment.