Code Monkey home page Code Monkey logo

telegram-react's Introduction

Telegram Web App

Interface

Sample screenshot

Technical details

The app is based on the ReactJS JavaScript framework and TDLib (Telegram Database library) compiled to WebAssembly. Try it here.

Running locally

  1. Obtaining Telegram api keys.

Please visit this page for details.

  1. Setup .env file.

Manually copy Telegram api keys from previous step into REACT_TELEGRAM_API_ID and REACT_TELEGRAM_API_HASH at .env file.

  1. Install node.js & npm. Probably, you should use nvm.

  2. Install dependencies.

npm ci

All TDLib files will be installed into node_modules/tdweb/dist/ folder.

  1. Manually copy TDLib files into the public folder.
cp node_modules/tdweb/dist/* public/
  1. Run the app in development mode.
npm run start

Open http://localhost:3000 to view it in the browser.

Deploying to GitHub Pages

  1. Obtaining Telegram api keys.

Please visit this page for details.

  1. Setup .env file.

Manually copy Telegram api keys from previous step into REACT_TELEGRAM_API_ID and REACT_TELEGRAM_API_HASH at .env file.

  1. Update homepage property at the app's package.json file.

Define its value to be the string https://{username}.github.io/{repo-name}, where {username} is your GitHub username, and {repo-name} is the name of the GitHub repository. Since my GitHub username is evgeny-nadymov and the name of my GitHub repository is telegram-react, I added the following property:

//...
"homepage": "https://evgeny-nadymov.github.io/telegram-react"
  1. Generate a production build of your app and deploy it to GitHub Pages.
npm run deploy

Running in a Docker container

  1. Obtaining Telegram api keys.

Please visit this page for details.

  1. Provide your Telegram api keys as build arguments.
docker build . --build-arg TELEGRAM_API_ID=0000000 --build-arg TELEGRAM_API_HASH=00000000000000000

The Docker build will perform all the necessary steps to get a working build of Telegram-React.

References

  1. Deploying a React App (created using create-react-app) to GitHub Pages
  2. Facebook's tutorial on deploying a React app to GitHub Pages

telegram-react's People

Contributors

a-x- avatar arseny30 avatar dependabot[bot] avatar erayrafet avatar evgeny-nadymov avatar jasonkhew96 avatar leekeifuture avatar linqlover avatar robinj1995 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

telegram-react's Issues

Ошибка при восстановлении зависимостей

Первый раз работаю с node js
При попытке вызвать из корня, скопированного репозитория, npm install
Получаю ошибку:

npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/yallist-0a8a5093/package.json'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/webpack-dev-server-373b6925/package.json'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/execa-9d05926e/package.json'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/yallist-0a8a5093/README.md'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/webpack-dev-server-373b6925/CHANGELOG.md'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/execa-9d05926e/index.js'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/yallist-0a8a5093/LICENSE'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/webpack-dev-server-373b6925/LICENSE'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/yallist-0a8a5093/iterator.js'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/webpack-dev-server-373b6925/README.md'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/@babel/runtime-46e2b43a/LICENSE'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/yallist-0a8a5093/yallist.js'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/@babel/runtime-46e2b43a/README.md'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/react-router-dom-deccc8fa/umd/react-router-dom.min.js'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/emoji-mart-bc9fbe29/data/apple.json'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lottie-web-46017fee/build/player/lottie_canvas.min.js'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/libphonenumber-js-837d0a1a/metadata.min.json'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/react-dom-9577a55d/cjs/react-dom-unstable-fire.production.min.js'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/prettier-c4b6c290/index.js'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-0e73f158/lodash.min.js'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-98face60/lodash.min.js'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-eb16d848/lodash.min.js'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-f3bae6f6/lodash.min.js'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-321ef208/lodash.min.js'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-39260369/lodash.min.js'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-d51ebb7e/lodash.min.js'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-6c2be400/lodash.min.js'
npm WARN tar ENOENT: no such file or directory, open '/opt/telegram-react-master/node_modules/.staging/lodash-f1b494f5/lodash.min.js'
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@arseny30/tdweb/-/tdweb-1.4.6.tgz
npm ERR! 404
npm ERR! 404 '@arseny30/[email protected]' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'telegram-react-master'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-08-26T06_57_53_406Z-debug.log

Если помогут могу отправить логи указанные в конце сообщения.

Cannot login into TDWeb from Russia, need some special address for proxy addons

Telegram is blocked in Russia completely with it site, so I have to use VPN for access to *.telegram.org. Also I have to add this stroke (full Telegram domain) to sites list for browser proxy/VPN addons. Nevertheless I cannot login into your TDWeb (I get no verification code), even when I wrote *.telegram.org to sites list; proxies in browsers work in this mode. But when I Iaunch VPN for all sites (not only for exceptions list), I get verification code and can seamlessly use TDWeb.

So what web-address (associated with Telegram?) should I add to sites list for proxy addon only just for login?

Please, help. (In any case I can describe my issue in Russian, it's my native language.)

Not loading on Vivaldi

App version: 0.0.155
Browser: Vivaldi 2.2.1388.37
OS: Windows 10 Pro 1809

Infinte restart after this error:

[ 0][t 0][1546018831.841000080][Status.h:185][!DialogDbActor]	Unexpected Status [Error : 0 : Failed to prepare SQLite [statement:INSERT OR REPLACE INTO dialogs VALUES(?1, ?2, ?3)][Error : 0 : table dialogs has 5 columns but 3 values were supplied]] in file ../../../../td/telegram/DialogDb.cpp at line 81
    at wasm-function[21106]:93
    at wasm-function[94]:325
    at wasm-function[250]:184
    at wasm-function[30574]:136
    at wasm-function[30575]:32
    at wasm-function[30576]:31

Song Lyrics-Music Player

It can add a section that shows the lyrics of the songs while playing them using Genius (or others) for that purpose

where is @arseny30/tdweb

hey, i'm looking at your code with much interest, but can't build a thing because tdweb seems to be gone from the web, any idea on where i can find it ?

Support bot keyboard

I suppose you already know this to be hones but I'll just write it so we don't lose track of this functionality.
Basically what title says, add support for Bots' keyboard.
Regards.

Align self messages on right side

Currently on private chats, all messages are aligned on left side. Can you please add a setting or set by default, own messages on right side and person whom we are talking on left side? Thanks.

Pasting image from clipboard attaches it as a file.

When I'm creating a screenshot, for example, I want to send it as an image, but if I paste it to chat it is sent as a file. Desktop Telegram asks whether you want to send it as image or file, others are just sending images as images.

Support Electron

Well its will be nice if telegram-react support electron and ship as apps. Can you please make Telegram-react as Electron app? 😄

Markdown not supported.

When trying to use markdown elements they are simply ignored, editing and updating the same string without changes in different client activates markdown.

Implement Service Worker API

I believe implementation of the service worker API would be a great addition, especially for platforms that do not have a native Telegram client available. Fully implementing this API would allow people to "Install" the app with supported browsers, notably Chromium based browsers on desktop.
Information can be found about the Service Worker API here.

Marking messages as seen, even if in foreground

If the app is in foreground, it sets our status to offline from online (as expected).
However, if we leave a chat window open, and new messages arrive to it, they will be marked as read immediately. That leaves us with no notifications and trace that any messages in that thread had arrived until we look at it manually. (and we may forget and currently not be on a device we ran telegram-react on).
Expected behavior: do not mark incoming messages as read in open thread, if the app is in foreground/unfocused. (which would be consistent with Telegram Desktop's behavior)

Full-width and fluid UI

Please, add possibility to:

  1. Make UI use whole width of window.
  2. Change sidebar width.
  3. No to use "typography ideals".

Please, don't enforce stupid things like TDesktop and current telegram-web does. Thanks.

Show user list on supergroups

When the group is flagged as supergroup the user list is not shown.
This is not the behavior of official clients like Telegram Android, in which user list is show, at least on supergroups with few members.

#bug client does not currently load all the chats and messages

client does not currently load all the chats and messages, and when you scroll through a conversation, it comes back on its own without me touching anything.

Telegram React version 0.0.155 From Chrome for Android 71.0.3578.99 Android 8.1 Oreo Xiaomi Redmi Note 5 Pro (Whyred)

[Bug] After press logout app hangs. Page refresh doesn't help

Hey!

I think it's related
#26

Steps to reproduce

  • Open chrome incognito mode

  • Login

  • Wait for chats to load

  • Click "Logout" - app hangs with state "logging out" + "connecting"

  • Page refresh doesn't help - same state

  • Reopen incognito mode helps (webworker gets terminated?)

App should receive "authorizationStateClosed" and then reinit td client.
In webworker I expect to receive events - "close" -> "onClose" -> to reminate worker

4 different people experienced this issue.

Any help?

[Question] Embedded within an app using a transparent user session

For my business, I have built a custom in-app chat solution, very similar to telegram and Facebook messenger. After finding your library and experiencing the rate of innovating within the Telegram protocol/client - I've realised that using your solution would likely yield a better UX for my customers over time.

I wonder, is it possible to use this chat solution, without requiring each user to create a Telegram account and; have my application automate a Telegram account for each of my users so that they could use this Telegram client without having any knowledge/concern of Telegram?

Logout not properly implemented

When I click on logout, it kills the session but keeps the page as the attached screenshot. It should redirect back to login page.

image

Firefox connection issue. Is this normal? Or a bug?

Firefox can’t establish a connection to the server at wss://vesta.web.telegram.org/apiws.
The connection to wss://vesta.web.telegram.org/apiws was interrupted while the page was loading.

This I get in Firefox console. Thanks for this project.

Invalid localization in intro screen

YourPhone is displayed instead of "Your phone" and StartText is displayed instead of actual start text:

image

Maybe there are more localization issues, it's just an example (I didn't go further than that screen).

Bubbles

I see that this client features only the wide/plain chat screen format, and there are no chat bubbles, which are the default (or the only choice) on, I believe, all other platforms (besides current Telegram Web).
What are the reasons for selecting this design over bubbles here? Are bubbles planned for telegram-react as well?

Linked posts navigation missing.

When clicking on commented message whole current message is selected. In other clients, this action scrolls chat to the original message with the ability to return back to reply.

Self-render emojis

Currently emojis are being shown okay on emoji list, however, both on the text area and on the chat itself the rendering of said emojis is falling back to the system.
This may work on some configurations, but won't work in others. For example I have an old W10 build with Chrome and my W10 lacks some of the emojis available on the app

Undesired paste filtering

When pasting strings to input field anything that falls under "<[.*]+>" is silently removed from the input.

Better looking scrollbars

There is cool solution for scrollbars.

::-webkit-scrollbar {
height: 5px;
width: 5px;
background: #f0f0f0;
}

::-webkit-scrollbar-thumb {
background: #acacac;
-webkit-border-radius: 0ex;
-webkit-box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.75);
}

::-webkit-scrollbar-corner {
background: #f0f0f0;
}

Input field has visual glitches.

When trying to put the cursor into the input field you need to click in the higher part of the field or the cursor wouldn't appear.

When you start typing the text is correctly aligned vertically, but if the field is empty the cursor appears higher then background "Message" text.

For vim/emacs users, would there be a hotkey to start typing? Like typing '' to immediately put the cursor into the text field.

Cant use telegram-react

Hi,
I just tried to use your project by "Try it here" of the readme, but after completing the login,
the page just goes blank.
Looking up the console of the browser, there were way to many outputs but overreading a bit I found this one:
TypeError: "this.db is undefined"
value FileStore.js:590
value DialogsList.js:309
e DialogsList.js:304
React 5
unstable_runWithPriority scheduler.production.min.js:274
React 7
value DialogsList.js:316
e DialogsList.js:304
x runtime.js:63
_invoke runtime.js:282
t runtime.js:116
r asyncToGenerator.js:3
u asyncToGenerator.js:25

and this one:
InvalidStateError: A mutation operation was attempted on a database that did not allow mutations.

I do not know your project good enough but I guess it has to do with these two logs.

Update issue

When I select Update in menu later I've got error every time i start new session

default

Introduce fast update of messages

I had last opened the telegram-react app in February, so when I opened it, its just struck at connecting and I see lots of console activity. During these duration I had used tg via android app and tdesktop, so there is lots of update.
Other clients basically just update dialogues fast and don't get struck in loading all chats and messages.
Fixing this will be a great help and improve performance,
Thanks.

[Question] Payments + Bots

This is amazing work. I'm really excited to track your program. Well done!

Technically speaking, would it be possible to implement the Telegram payment flow and bots flow into this stack?

Is it possible to translate this project?

May I know is there any means to allow translations for this project? As it would be great to open up many possibilities, for other users to make use of this interface.

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.