Skip to content

Commit

Permalink
(#147) Settings: document the new content proxy settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed Oct 31, 2021
1 parent bebb911 commit 463f3d1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
1 change: 0 additions & 1 deletion Emulsion/Settings.fs
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,3 @@ let read (config : IConfiguration) : EmulsionSettings =
Log = readLog <| config.GetSection "log"
Database = readDatabase <| config.GetSection "database"
Hosting = readHosting <| config.GetSection "hosting" }
// TODO: Document the new settings
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,32 @@ settings, there're defaults:
}
```

All the other settings are required.
All the other settings are required, except the `database` and `hosting` sections.

Note that `pingInterval` of `null` disables XMPP ping support.

### Telegram Content Proxy

There's **unfinished** Telegram content proxy support. To enable it, configure the `database` and `hosting` configuration file sections:

```json
{
"database": {
"dataSource": "sqliteDatabase.db"
},
"hosting": {
"baseUri": "https://example.com/api/content",
"hashIdSalt": "test"
}
}
```

`dataSource` may be a path to the SQLite database file on disk. If set, Emulsion will automatically apply necessary migrations to this database on startup.

If all the parameters are set, then Emulsion will save the incoming messages into the database, and will then insert links to `{baseUri}/content/{contentId}` instead of links to `https://t.me/{messageId}`.

The content identifiers in question are generated from the database ones using the [hashids.net][hashids.net] library, `hashIdSalt` is used in generation. This should complicate guessing of content ids for any external party not reading the chat directly.

Test
----

Expand Down Expand Up @@ -112,6 +134,7 @@ Developer documentation:
[dotnet-sdk]: https://www.microsoft.com/net/download/core
[telegram]: https://telegram.org/
[xmpp]: https://xmpp.org/
[hashids.net]: https://github.com/ullmark/hashids.net

[badge.docker]: https://img.shields.io/docker/v/codingteam/emulsion?sort=semver
[status-aquana]: https://img.shields.io/badge/status-aquana-yellowgreen.svg
7 changes: 7 additions & 0 deletions emulsion.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,12 @@
},
"log": {
"directory": "./logs/"
},
"database": {
"dataSource": "sqliteDatabase.db"
},
"hosting": {
"baseUri": "https://example.com/api/content",
"hashIdSalt": "test"
}
}

0 comments on commit 463f3d1

Please sign in to comment.