TelegramIndex-Fork/README.md

96 lines
5.0 KiB
Markdown
Raw Permalink Normal View History

2020-08-10 09:23:19 +02:00
# Telegram Index
> Python Web App which indexes a telegram channel(or a chat) and serves its files for download.
2021-07-17 06:35:14 +02:00
[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.png?v=103)](.) [![GPLv3 license](https://img.shields.io/badge/License-GPLv3-blue.svg)](LICENSE)
2020-08-10 09:23:19 +02:00
2020-08-20 07:22:08 +02:00
## Highlights
2021-07-17 06:35:14 +02:00
- Index one or more telegram channels/chats.
- View messages and media files on the browser.
- Search through the channel/chat.
- Download media files through browser/download managers.
2021-07-05 17:24:17 +02:00
2020-08-10 09:23:19 +02:00
## Deploy Guide
2021-07-17 06:35:14 +02:00
- **Clone to local machine.**
```sh
git clone https://github.com/odysseusmax/tg-index.git
cd tg-index
2020-08-10 09:23:19 +02:00
```
2021-07-17 06:35:14 +02:00
- **Create and activate virtual environment.**
2020-08-10 09:23:19 +02:00
```sh
python -m venv venv
source venv/bin/activate
2020-08-10 09:23:19 +02:00
```
2021-07-17 06:35:14 +02:00
- **Install dependencies.**
2020-08-10 09:23:19 +02:00
```sh
pip3 install -U -r requirements.txt
2020-08-10 09:23:19 +02:00
```
2021-07-17 06:35:14 +02:00
- **Environment Variables.**
| Variable Name | Value |
| ------------------------------------ | --------------------------------------------------------------------------------------------------------------------- |
| `API_ID` (required) | Telegram api_id obtained from <https://my.telegram.org/apps>. |
| `API_HASH` (required) | Telegram api_hash obtained from <https://my.telegram.org/apps>. |
| `INDEX_SETTINGS` (required) | See the below description. |
| `PORT` (optional) | Port on which app should listen to, defaults to 8080. |
| `HOST` (optional) | Host name on which app should listen to, defaults to 0.0.0.0. |
| `DEBUG` (optional) | Give `true` to set logging level to debug, info by default. |
| `BLOCK_DOWNLOADS` (optional) | Enable downloads or not. If any value is provided, downloads will be disabled. |
| `RESULTS_PER_PAGE` (optional) | Number of results to be returned per page defaults to 20. |
| `TGINDEX_USERNAME` (optional) | Username for authentication, defaults to `''`. |
| `PASSWORD` (optional) | Password for authentication, defaults to `''`. |
| `SHORT_URL_LEN` (optional) | Url length for aliases |
| `SESSION_COOKIE_LIFETIME` (optional) | Number of minutes, for which authenticated session is valid for, after which user has to login again. defaults to 60. |
| `SECRET_KEY` (optional) | 32 characters long string for signing the session cookies, required if authentication is enabled. |
2021-07-17 06:35:14 +02:00
- **Setting value for `INDEX_SETTINGS`**
This is the general format, change the values of corresponding fields as your requirements. You can copy paste this as is to index all the channels available in your account.
**Remember to remove newlines.**
2021-07-17 06:35:14 +02:00
```json
2020-08-17 09:44:02 +02:00
{
2021-07-17 06:35:14 +02:00
"index_all": true,
"index_private": false,
"index_group": false,
"index_channel": true,
"exclude_chats": [],
"include_chats": []
2020-08-17 09:44:02 +02:00
}
```
2021-07-17 06:35:14 +02:00
> - `index_all` - Whether to consider all the chats associated with the telegram account. Value should either be `true` or `false`.
> - `index_private` - Whether to index private chats. Only considered if `index_all` is set to `true`. Value should either be `true` or `false`.
> - `index_group` - Whether to index group chats. Only considered if `index_all` is set to `true`. Value should either be `true` or `false`.
> - `index_channel` - Whether to index channels. Only considered if `index_all` is set to `true`. Value should either be `true` or `false`.
> - `exclude_chats` - An array/list of chat id's that should be ignored for indexing. Only considered if `index_all` is set to `true`.
> - `include_chats` - An array/list of chat id's to index. Only considered if `index_all` is set to `false`.
- **Run app.**
2020-08-10 09:23:19 +02:00
2021-07-17 06:35:14 +02:00
```bash
2020-12-12 17:31:59 +01:00
python3 -m app
2020-08-10 09:25:42 +02:00
```
2020-08-10 09:23:19 +02:00
Note: you will be asked to **log in** the first time. (Login with the telegram account which is a participant of the chats you want to index).
After that, a `tg-index.session` file will be stored in the current working directory. **Keep it secret and secure**.
2021-07-17 06:35:14 +02:00
## Deploy Guide (Repl.it)
A detailed and beginner friendly guide on how to deploy this project on a free instance of <https://repl.it> can be found [here](./repl-config/replit-deploy-guide.md).
## License, Credits
2020-08-10 09:23:19 +02:00
This program is forked from [odysseusmax/tg-index](https://github.com/odysseusmax/tg-index).
2020-12-12 17:31:59 +01:00
As per the original, code is released under [The GNU General Public License](LICENSE).