GithubHelp home page GithubHelp logo

ajaxy / telegram-tt Goto Github PK

View Code? Open in Web Editor NEW
2.1K 2.1K 438.0 1.01 GB

Telegram Web A, GPL v3

Home Page: https://web.telegram.org/a

License: GNU General Public License v3.0

Shell 0.01% TypeScript 57.38% JavaScript 12.70% CSS 0.11% SCSS 6.13% HTML 23.66% Handlebars 0.01%
javascript telegram weba webapp webz

telegram-tt's Introduction

Telegram Web A

This project won the first prize ๐Ÿฅ‡ at Telegram Lightweight Client Contest and now is an official Telegram client available to anyone at web.telegram.org/a.

According to the original contest rules, it has nearly zero dependencies and is fully based on its own Teact framework (which re-implements React paradigm). It also uses a custom version of GramJS as an MTProto implementation.

The project incorporates lots of technologically advanced features, modern Web APIs and techniques: WebSockets, Web Workers and WebAssembly, multi-level caching and PWA, voice recording and media streaming, cryptography and raw binary data operations, optimistic and progressive interfaces, complicated CSS/Canvas/SVG animations, reactive data streams, and so much more.

Feel free to explore, provide feedback and contribute.

Local setup

mv .env.example .env

npm i

Obtain API ID and API hash on my.telegram.org and populate the .env file.

Dev mode

npm run dev

Invoking API from console

Start your dev server and locate GramJS worker in console context.

All constructors and functions available in global GramJs variable.

Run npm run gramjs:tl full to get access to all available Telegram requests.

Example usage:

await invoke(new GramJs.help.GetAppConfig())

Electron

Electron allows building a native application that can be installed on Windows, macOS, and Linux.

NPM scripts

  • npm run dev:electron

Run Electron in development mode, concurrently starts 3 processes with watch for changes: main (main Electron process), renderer (FE code) and Webpack for Electron (compiles main Electron process from TypeScript).

  • npm run electron:webpack

The main process code for Electron, which includes preload functionality, is written in TypeScript and is compiled using the webpack-electron.config.js configuration to generate JavaScript code.

  • npm run electron:build

Prepare renderer (FE code) build, compile Electron main process code, install and build native dependencies, is used before packaging or publishing.

  • npm run electron:staging

Create packages for macOS, Windows and Linux in dist-electron folders with APP_ENV as staging (allows to open DevTools, includes sourcemaps and does not minify built JavaScript code), can be used for manual distribution and testing packaged application.

  • npm run electron:production

Create packages for macOS, Windows and Linux in dist-electron folders with APP_ENV as production (disabled DevTools, minified built JavaScript code), can be used for manual distribution and testing packaged application.

  • npm run deploy:electron

Create packages for macOS, Windows and Linux in dist-electron folder and publish release to GitHub, which allows supporting autoupdates. See GitHub release workflow for more info.

Code signing on MacOS

To sign the code of your application, follow these steps:

  • Install certificates from /certs folder to login folder of your Keychain.
  • Download and install Developer ID - G2 certificate from the Apple PKI page.
  • Under the Keychain application, go to the private key associated with your developer certificate. Then do key > Get Info > Access Control. Down there, make sure your application (Xcode) is in the list Always allow access by these applications and make sure Confirm before allowing access is turned on.
  • A valid and appropriate identity from your keychain will be automatically used when you publish your application.

More info in the official documentation.

Notarize on MacOS

Application notarization is done automatically in electron-builder module, which requires APPLE_ID and APPLE_APP_SPECIFIC_PASSWORD environment variables to be passed.

How to obtain app-specific password:

  • Sign in to appleid.apple.com.
  • In the "Sign-In and Security" section, select "App-Specific Passwords".
  • Select "Generate an app-specific password" or select the Add button, then follow the steps on your screen.

GitHub release

GitHub access token

In order to publish new release, you need to add GitHub access token to .env. Generate a GitHub access token by going to https://github.com/settings/tokens/new. The access token should have the repo scope/permission. Once you have the token, assign it to an environment variable:

# .env
GH_TOKEN="{YOUR_TOKEN_HERE}"
Publish settings

Publish configuration in src/electron/config.yml config file allows to set GitHub repository owner/name.

Release workflow
  • Run npm run electron:publish, which will create new draft release and upload build artefacts to newly reated release. Version of created release will be the same as in package.json.
  • Once you are done, publish the release. GitHub will tag the latest commit.

Dependencies

Bug reports and Suggestions

If you find an issue with this app, let Telegram know using the Suggestions Platform.

telegram-tt's People

Contributors

a0eoc avatar abolfazl-omidvarr avatar ajaxy avatar alexeimoisseev avatar durof avatar iib0011 avatar kikobeats avatar korenskoy avatar linqlover avatar mattrosedev avatar milichev avatar muaath5 avatar wubenqi avatar y0ung3r avatar zubiden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

telegram-tt's Issues

Opening website from notification asks to login every time

Hello there,

Thank you for this cool web version!
Notification works fine but when clicking on them it ask to do a login every time.

Versions

OS: Ubuntu 20.04
Browser: Firefox 88.0.1

I'll try do some tests on other browsers

Update

on Chrome Version 90.0.4430.212 works fine

Enable an option for sticky sticker panel

On desktop brwosers with legacy telegram web, the sticker panel will still be hovered after a sticker is sent.
This behaviour is not possible on telegram web z, please consider adding an option to do so.

Let user disable background notifications

In the legacy webapp, there was a switch to disable background notifications (i.e. desktop notifications when telegram's tab is not open). In the new webapps, it does not appear to be implemented yet.

Is there a workaround by playing with Chrome/Firefox permissions?

fast options for left menu

I would like that the buttons of contacts, saved messages and archived chats to be put like the image below.

image

With this, you could also remove these buttons from the dropdown menu and save some space for future options.

Add full RTL support

Hebrew, Arabic, Persian, Urdu and several others use scripts written from right to left.

This is a blog post about adjusting Spotify to support these languages:
https://engineering.atspotify.com/2019/04/15/right-to-left-the-mirror-world/

I will start testing it myself and see if I can contribute without breaking the UI completely.

Currently the most important thing is to add dir=auto to the input boxes so typing in these languages will be more coherent.

Thank you.

Connection is extremely unstable

"Waiting for network..."
and in the console says "WebSocket connection to 'wss://flora.web.telegram.org/apiws' failed: "
The connection is extremely unstable on UTC -4 09:00 onwards.

Bugs in emoji input

  1. After I paste or delete an emoji, the cursor position is resetted to the beginning:
RecApp-2021-08-29-02.16.19.mp4
  1. Emojis in the beginning of the message are not deleted on backspace key press and hold:
RecApp-2021-08-28-22.42.02.mp4
  1. Emojis selected from quick selection menu are not displayed correctly (default system font is used) and don't trigger sticker popover:
RecApp-2021-08-29-02.08.48.mp4

[Feature Request] Resize left column with chats

In the macOS version of Telegram, there is a great opportunity to collapse the chat window to the size of icons, so that a window with groups appears on the left (with a large number, this is more convenient than using tabs)

Writing a colon ":" followed by "D" results in an unexpected behaviour

Hello,

Nice project!

When I am writing a message, which starts with a colon ":", I got a pop-up with emojis:
Screenshot from 2021-06-16 14-07-09
This would be probably OK for a colon, but when I am writing ":D" smiley, it offers as a first emoji the ๐Ÿ’ฏ (100) or a ๐Ÿ‘— (dress):
Screenshot from 2021-06-16 14-05-32

This results into situation, when I can either press ESC and close the pop-up, or I will mistakenly send the ๐Ÿ’ฏ / ๐Ÿ‘— emoji:, while I wanted to send classical ":D" or ๐Ÿ˜ƒ :
Screenshot from 2021-06-16 14-14-34

Is there a way how to disable this functionality?

EDIT: Just found that Telegram has own bug site, and found a user with similar question resolved to fixed: https://bugs.telegram.org/c/5838

App refreshes on launching keyboard

Device: Mi A2
Aspect Ratio: 18:9
Android: 10
Chrome: v90.0.4430.91
Keyboard: Gboard

App reloads when screen dimensions change due to soft keyboard launch, making the app unusable.

Might have been triggered by changes in baffa92 @Ajaxy

For example, on the login screen, on tapping the phone number text box, the soft keyboard launches. As soon as the keyboard launches, src/util/windowSize.ts::handleResize() refreshes the window and takes the focus off the text box. On tapping the phone number text box, the problem repeats.

Couldn't load QR login

I got this bug when running server, and QR login couldn't show
[2021-07-21T13:31:47.172Z] [ERROR] - [WebSocket connection failed attempt: 6. Cause: Cannot read property 'digest' of undefined]

Cannot read property 'digest' of undefined]

Wrong colors in dark theme

Some colors are taken from the hardcoded -rgb variables in _variables.scss. For example, button hover color:

Also some elements in Composer, Audio, etc.

.JPEG has no "send in a quick way" option but .JPG has

When I'm trying to attach picture with .JPG suffix I see these 2 options (and most of the time choose the last one)
Screen Shot 2021-07-14 at 00 11 23
but Firefox 89.0.2 (64-bit) on macOS saves images as .JPEG and I don't have the second option while trying to attach them and that's odd.

Parameters for bot commands (e.g. /alert 30min Check groceries list) are not passed when pressing ENTER key

As in a185fd9 there's a new tooltip for bot commands. However, if I type the message box like this (e.g. in a group chat) and press the ENTER key:

/command@bot parameters

The app will only send the

/command@bot

message instead.

Some bots such as @AlertBot require parameters to be passed along the command, such as /alert 30min Check groceries list, so this could distract the workflow for some Telegram users.

This issue does not occur on WebK and mobile apps as well.

Nginx reverse proxy API error: WebSocket connection to'wss://...' failed: Error during WebSocket handshake: Unexpected response code: 404

When I want to reverse proxy the website, I cannot reverse proxy the WSS:// link, and the browser prompts the following error:

WebSocket connection to'wss://pluto.web.telegram.org/apiws' failed: Error during WebSocket handshake: Unexpected response code: 404

02

Nginx has added the following:

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';

Hope you can help me!

Error: Could not find a matching Constructor ID

[ERROR] - [Unhandled error while receiving data]
[ERROR] - [Error: Could not find a matching Constructor ID for the TLObject that was supposed to be
        read with ID 253890367. Most likely, a TLObject was trying to be read when
         it should not be read. Remaining bytes: 480]

This error needs to be handled, because it can cause very serious problems in some places (e.g. chat list or message history not being loaded).

Fun fact: this error also often happens in Telethon, which GramJS is based on.

React devtools not working

Hi
I have a problem with devtools.
React extension can't dedicate I'm running a react project therefore react devtools is not working.
How should I enable devtools ?

Copy Paste image

When copying and pasting an image, it is pasted into the input message
Screenshot 2021-08-12 at 07-57-08 Telegram

On Firefox Nightly sometimes https://webz.telegram.org/ goes into "Waiting for network..." state and never recovers

Platform:

Firefox Nightly on Windows 10 Pro Insider Dev Channel Build 21387

Steps:

  • Log into https://webz.telegram.org/
    
  • Use Telegram as per normal
    

Result:
After some time https://webz.telegram.org/ goes into a "Waiting for network..." state and never recovers

Expected result:
https://webz.telegram.org/ works normally

No other program nor tabs show signs of any networking issue.

Profile:
https://share.firefox.dev/3y7k8p8

Filing here as requested on https://bugzilla.mozilla.org/show_bug.cgi?id=1711335#c2

No Hint For Bot Commands

In old web telegram and webk version, when you type / there will be some hints for the available bot commands in the channel. It would be nice to see this feature gets added ๐Ÿ˜„

Why create treact instead of using react?

This is more of a discussion than a gh issue tbh, but I didn't know where to ask this and I'm very curious about this choice. Reading the codebase of treact I found that it only supports function components with hooks, but apart from that I didn't understand the choice; why go through the hassle of maintaining a UI library when React works perfectly fine.

P.S: Web Z is frickin' awesome!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.