Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeny-nadymov authored Nov 17, 2020
1 parent ade7d7e commit b3b0d04
Showing 1 changed file with 34 additions and 23 deletions.
57 changes: 34 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,64 +7,75 @@

The app is based on the ReactJS JavaScript framework and TDLib (Telegram Database library) compiled to WebAssembly. Try it [here](https://evgeny-nadymov.github.io/telegram-react/).

### Obtaining api keys (mandatory step for local run & deployment)
Go to https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md

### Running locally
Install node.js & npm. Probably, you should use [nvm](https://github.com/nvm-sh/nvm).
1. **Obtaining Telegram api keys.**

Please visit this [page](https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md) for details.

2. **Setup .env file.**

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

3. **Install node.js & npm.**
Probably, you should use [nvm](https://github.com/nvm-sh/nvm).

Install dependencies with:
4. **Install dependencies.**

```bash
npm ci
```
All TDLib files will be installed into node_modules/tdweb/dist/ folder.

This will install all the needed dependencies.

All TDLib files will be installed into node_modules/tdweb/dist/ folder. Manually copy them into the public folder with:
5. **Manually copy TDLib files into the public folder.**

```bash
cp node_modules/tdweb/dist/* public/
```

[Obtain api keys](https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md).

Run the app in development mode with:
6. **Run the app in development mode.**

```bash
REACT_APP_TELEGRAM_API_ID=... REACT_APP_TELEGRAM_API_HASH=... npm run start
npm run start
```

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

### Deploying to GitHub Pages

1. **Update *homepage* property at the app's `package.json` file.**
1. **Obtaining Telegram api keys.**

Please visit this [page](https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md) for details.

2. **Setup .env file.**

Define its value to be the string `http://{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:
Manually copy Telegram api keys from previous step into REACT_TELEGRAM_API_ID and REACT_TELEGRAM_API_HASH at .env file.

3. **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:

```js
//...
"homepage": "https://evgeny-nadymov.github.io/telegram-react"
```

2. **Obtain api_id & api_hash**
Go to https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md

3. **Generate a *production build* of your app and deploy it to GitHub Pages.**
4. **Generate a *production build* of your app and deploy it to GitHub Pages.**

```
$ REACT_APP_TELEGRAM_API_ID=... REACT_APP_TELEGRAM_API_HASH=... npm run deploy
```bash
npm run deploy
```

### Running in a Docker container

In order to run Telegram-React inside a Docker container, you need to provide your Telegram API key as build arguments.
1. **Obtaining Telegram api keys.**

```
Please visit this [page](https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md) for details.

2. **Provide your Telegram api keys as build arguments.**

```bash
docker build . --build-arg TELEGRAM_API_ID=0000000 --build-arg TELEGRAM_API_HASH=00000000000000000
```
Replace these values with your own Telegram API key information, which you can obtain [here](https://my.telegram.org/apps).

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

Expand Down

0 comments on commit b3b0d04

Please sign in to comment.