This commit is contained in:
odysseusmax
2020-12-12 22:01:59 +05:30
parent 873c5ff361
commit 360ac462bd

View File

@@ -13,79 +13,73 @@
## Demo ## Demo
Hosted demo site: https://tg-index-demo.herokuapp.com Hosted demo site: <https://tg-index-demo.herokuapp.com>
## Deploy Guide ## Deploy Guide
* **Clone to local machine.** * **Clone to local machine.**
``` bash ``` bash
$ git clone https://github.com/odysseusmax/tg-index.git git clone https://github.com/odysseusmax/tg-index.git
$ cd tg-index cd tg-index
``` ```
* **Create and activate virtual environment.** * **Create and activate virtual environment.**
``` bash ``` bash
$ pip3 install virtualenv pip3 install virtualenv
$ virtualenv venv virtualenv venv
$ source venv/bin/activate source venv/bin/activate
``` ```
* **Install dependencies.** * **Install dependencies.**
``` bash ``` bash
$ pip3 install -U -r requirements.txt pip3 install -U -r requirements.txt
``` ```
* **Environment Variables.** * **Environment Variables.**
| Variable Name | Value | Variable Name | Value
|------------- | ------------- |------------- | -------------
| `API_ID` (required) | Telegram api_id obtained from https://my.telegram.org/apps. | `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. | `API_HASH` (required) | Telegram api_hash obtained from <https://my.telegram.org/apps>.
| `INDEX_SETTINGS` (required) | See the below description. | `INDEX_SETTINGS` (required) | See the below description.
| `SESSION_STRING` (required) | String obtained by running `$ python3 app/generate_session_string.py`. (Login with the telegram account which is a participant of the given channel (or chat). | `SESSION_STRING` (required) | String obtained by running `$ python3 app/generate_session_string.py`. (Login with the telegram account which is a participant of the given channel (or chat).
| `PORT` (optional) | Port on which app should listen to, defaults to 8080. | `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. | `HOST` (optional) | Host name on which app should listen to, defaults to 0.0.0.0.
| `DEBUG` (optional) | Give some value to set logging level to debug, info by default. | `DEBUG` (optional) | Give some value to set logging level to debug, info by default.
| `BLOCK_DOWNLOADS` (optional) | Enable downloads or not. If provided, downloads will be disabled.
| `RESULTS_PER_PAGE` (optional) | Number of results to be returned per page defaults to 20.
* **Setting value for `INDEX_SETTINGS`** * **Setting value for `INDEX_SETTINGS`**
This is the general format, change the values of corresponding fields as your requirements. Remember to remove spaces. This is the general format, change the values of corresponding fields as your requirements. Remember to remove spaces.
``` ``` json
{ {
"index_all": true, "index_all": true,
"index_private":false, "index_private":false,
"index_group": false, "index_group": false,
"index_channel": true, "index_channel": true,
"exclude_chats": [], "exclude_chats": [],
"include_chats": [], "include_chats": []
"otg": {
"enable": false,
"include_private": false,
"include_group": true,
"include_channel": true
}
} }
``` ```
>
> * `index_all` - Whether to consider all the chats associated with the telegram account. Value should either be `true` or `false`. > * `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_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_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`. > * `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`. > * `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`. > * `include_chats` - An array/list of chat id's to index. Only considered if `index_all` is set to `false`.
> * `otg` - On-The-Go Indexing settings. Whether to allow indexing channels/chats other than the specified chats dynamically on the go.
* **Run app.** * **Run app.**
``` bash ``` bash
$ python3 -m app python3 -m app
``` ```
## API ## API
Here's the api description. [API](https://github.com/odysseusmax/tg-index/wiki/API) Here's the api description. [API](https://github.com/odysseusmax/tg-index/wiki/API)
@@ -99,4 +93,5 @@ Contributions are welcome.
You can contact me [@odysseusmax](https://tx.me/odysseusmax). You can contact me [@odysseusmax](https://tx.me/odysseusmax).
## License ## License
Code released under [The GNU General Public License](LICENSE). Code released under [The GNU General Public License](LICENSE).