Skip to content

Commit c0671ca

Browse files
committed
Merge branch 'devel'
2 parents 662d647 + 6627fd8 commit c0671ca

File tree

22 files changed

+442
-319
lines changed

22 files changed

+442
-319
lines changed

INSTALL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ MongoDB should run as single node replicaset. See https://docs.mongodb.com/manua
127127

128128
2. Run DB initializer
129129
```
130-
$GOPATH/bin/init-db -config=./tinode-db/tinode.conf
130+
$GOPATH/bin/tinode-db -config=./tinode-db/tinode.conf
131131
```
132132
add `-data=./tinode-db/data.json` flag if you want sample data to be loaded:
133133
```
134-
$GOPATH/bin/init-db -config=./tinode-db/tinode.conf -data=./tinode-db/data.json
134+
$GOPATH/bin/tinode-db -config=./tinode-db/tinode.conf -data=./tinode-db/data.json
135135
```
136136

137137
DB initializer needs to be run only once per installation. See [instructions](tinode-db/README.md) for more options.
@@ -145,7 +145,7 @@ MongoDB should run as single node replicaset. See https://docs.mongodb.com/manua
145145

146146
5. Run the server
147147
```
148-
$GOPATH/bin/tinode -config=./server/tinode.conf -static_data=$HOME/tinode/webapp/
148+
$GOPATH/bin/server -config=./server/tinode.conf -static_data=$HOME/tinode/webapp/
149149
```
150150

151151
6. Test your installation by pointing your browser to [http://localhost:6060/](http://localhost:6060/). The static files from the `-static_data` path are served at web root `/`. You can change this by editing the line `static_mount` in the config file.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ When you register a new account you are asked for an email address to send valid
109109
* JSON or [protobuf version 3](https://developers.google.com/protocol-buffers/) wire protocols.
110110
* Bindings for various programming languages:
111111
* Javascript with no external dependencies.
112-
* Java with dependencies on [Jackson](https://github.com/FasterXML/jackson) and [Java-Websocket](https://github.com/TooTallNate/Java-WebSocket). Suitable for Android but with no Android SDK dependencies.
112+
* Java with dependencies on [Jackson](https://github.com/FasterXML/jackson), [Java-Websocket](https://github.com/TooTallNate/Java-WebSocket), [ICU4J](https://github.com/unicode-org/icu). Suitable for Android but with no Android SDK dependencies.
113113
* Swift with no external dependencies.
114114
* C/C++, C#, Go, Python, PHP, Ruby and many other languages using [gRPC](https://grpc.io/docs/languages/).
115-
* Choice of a database backend. Other databases can be added with by writing [adapters](server/db/adapter.go).
116-
* MySQL
115+
* Choice of a database backend. Other databases can be added by writing [adapters](server/db/adapter.go).
116+
* MySQL (and MariaDB, Percona as long as they remain SQL and wire protocol compatible)
117117
* PostgreSQL
118118
* MongoDB
119-
* [RethinkDB](http://rethinkdb.com/)
119+
* [RethinkDB](http://rethinkdb.com/). Support is deprecated because RethinkDB is no longer being developed
120120

121121
### Planned
122122

README_ko.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Tinode는 XMPP/ Jabber 가 아닙니다. Tinode는 XMPP와 호환되지 않습
1919

2020
XMPP: XML에 기반한 메시지 지향 통신 프로토콜
2121

22-
IM: Instant Messanger
22+
IM: Instant Messenger
2323

2424
## 설치 및 실행
2525

SECURITY.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## Reporting a Vulnerability
44

5-
Please report a vulnerability to [email protected]
5+
Please report a vulnerability to `[email protected]`.
6+
7+
## What not to report
8+
9+
* Firebase initialization tokens. The Firebase tokens are really public: they must be included into client applications and consequently are not private by design.
10+
* Exposed `/pprof` or `/expvar`. We know they are exposed. It's intentional and harmless.
11+
* Exposed Prometheus metrics `/metrics`. Like above, it's intentional and harmless.
612

7-
Please do not report Firebase initialization tokens. The Firebase tokens are really public: they must be included into client applications and consequently are not private by design.

chatbot/python/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.tn-cookie

chatbot/python/chatbot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,14 +301,15 @@ def read_auth_cookie(cookie_file_name):
301301
return schema, secret
302302

303303
def on_login(cookie_file_name, params):
304+
global botUID
304305
client_post(subscribe('me'))
305306

306307
"""Save authentication token to file"""
307308
if params == None or cookie_file_name == None:
308309
return
309310

310311
if 'user' in params:
311-
botUID = params['user'].decode("ascii")
312+
botUID = params['user'].decode("ascii")[1:-1]
312313

313314
# Protobuf map 'params' is not a python object or dictionary. Convert it.
314315
nice = {'schema': 'token'}

docs/API.md

Lines changed: 77 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,67 @@
1-
<!-- TOC depthFrom:1 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
1+
<!-- TOC depthfrom:1 depthto:6 withlinks:true updateonsave:true orderedlist:false -->
22

33
- [Server API](#server-api)
4-
- [How it Works?](#how-it-works)
5-
- [General Considerations](#general-considerations)
6-
- [Connecting to the Server](#connecting-to-the-server)
7-
- [gRPC](#grpc)
8-
- [WebSocket](#websocket)
9-
- [Long Polling](#long-polling)
10-
- [Out of Band Large Files](#out-of-band-large-files)
11-
- [Running Behind a Reverse Proxy](#running-behind-a-reverse-proxy)
12-
- [Users](#users)
13-
- [Authentication](#authentication)
14-
- [Creating an Account](#creating-an-account)
15-
- [Logging in](#logging-in)
16-
- [Changing Authentication Parameters](#changing-authentication-parameters)
17-
- [Resetting a Password, i.e. "Forgot Password"](#resetting-a-password-ie-forgot-password)
18-
- [Suspending a User](#suspending-a-user)
19-
- [Credential Validation](#credential-validation)
20-
- [Access Control](#access-control)
21-
- [Topics](#topics)
22-
- [`me` Topic](#me-topic)
23-
- [`fnd` and Tags: Finding Users and Topics](#fnd-and-tags-finding-users-and-topics)
24-
- [Query Language](#query-language)
25-
- [Incremental Updates to Queries](#incremental-updates-to-queries)
26-
- [Query Rewrite](#query-rewrite)
27-
- [Possible Use Cases](#possible-use-cases)
28-
- [Peer to Peer Topics](#peer-to-peer-topics)
29-
- [Group Topics](#group-topics)
30-
- [`sys` Topic](#sys-topic)
31-
- [Using Server-Issued Message IDs](#using-server-issued-message-ids)
32-
- [User Agent and Presence Notifications](#user-agent-and-presence-notifications)
33-
- [Trusted, Public, and Private Fields](#trusted-public-and-private-fields)
34-
- [Trusted](#trusted)
35-
- [Public](#public)
36-
- [Private](#private)
37-
- [Format of Content](#format-of-content)
38-
- [Out-of-Band Handling of Large Files](#out-of-band-handling-of-large-files)
39-
- [Uploading](#uploading)
40-
- [Downloading](#downloading)
41-
- [Push Notifications](#push-notifications)
42-
- [Tinode Push Gateway](#tinode-push-gateway)
43-
- [Google FCM](#google-fcm)
44-
- [Stdout](#stdout)
45-
- [Video Calls](#video-calls)
46-
- [Messages](#messages)
47-
- [Client to Server Messages](#client-to-server-messages)
48-
- [`{hi}`](#hi)
49-
- [`{acc}`](#acc)
50-
- [`{login}`](#login)
51-
- [`{sub}`](#sub)
52-
- [`{leave}`](#leave)
53-
- [`{pub}`](#pub)
54-
- [`{get}`](#get)
55-
- [`{set}`](#set)
56-
- [`{del}`](#del)
57-
- [`{note}`](#note)
58-
- [Server to Client Messages](#server-to-client-messages)
59-
- [`{data}`](#data)
60-
- [`{ctrl}`](#ctrl)
61-
- [`{meta}`](#meta)
62-
- [`{pres}`](#pres)
63-
- [`{info}`](#info)
4+
- [How it Works?](#how-it-works)
5+
- [General Considerations](#general-considerations)
6+
- [Connecting to the Server](#connecting-to-the-server)
7+
- [gRPC](#grpc)
8+
- [WebSocket](#websocket)
9+
- [Long Polling](#long-polling)
10+
- [Out of Band Large Files](#out-of-band-large-files)
11+
- [Running Behind a Reverse Proxy](#running-behind-a-reverse-proxy)
12+
- [Users](#users)
13+
- [Authentication](#authentication)
14+
- [Creating an Account](#creating-an-account)
15+
- [Logging in](#logging-in)
16+
- [Changing Authentication Parameters](#changing-authentication-parameters)
17+
- [Resetting a Password, i.e. "Forgot Password"](#resetting-a-password-ie-forgot-password)
18+
- [Suspending a User](#suspending-a-user)
19+
- [Credential Validation](#credential-validation)
20+
- [Access Control](#access-control)
21+
- [Topics](#topics)
22+
- [me Topic](#me-topic)
23+
- [fnd and Tags: Finding Users and Topics](#fnd-and-tags-finding-users-and-topics)
24+
- [Query Language](#query-language)
25+
- [Incremental Updates to Queries](#incremental-updates-to-queries)
26+
- [Query Rewrite](#query-rewrite)
27+
- [Possible Use Cases](#possible-use-cases)
28+
- [Peer to Peer Topics](#peer-to-peer-topics)
29+
- [Group Topics](#group-topics)
30+
- [sys Topic](#sys-topic)
31+
- [Using Server-Issued Message IDs](#using-server-issued-message-ids)
32+
- [User Agent and Presence Notifications](#user-agent-and-presence-notifications)
33+
- [Trusted, Public, and Private Fields](#trusted-public-and-private-fields)
34+
- [Trusted](#trusted)
35+
- [Public](#public)
36+
- [Private](#private)
37+
- [Format of Content](#format-of-content)
38+
- [Out-of-Band Handling of Large Files](#out-of-band-handling-of-large-files)
39+
- [Uploading](#uploading)
40+
- [Downloading](#downloading)
41+
- [Push Notifications](#push-notifications)
42+
- [Tinode Push Gateway](#tinode-push-gateway)
43+
- [Google FCM](#google-fcm)
44+
- [Stdout](#stdout)
45+
- [Video Calls](#video-calls)
46+
- [Link Previews](#link-previews)
47+
- [Messages](#messages)
48+
- [Client to Server Messages](#client-to-server-messages)
49+
- [{hi}](#hi)
50+
- [{acc}](#acc)
51+
- [{login}](#login)
52+
- [{sub}](#sub)
53+
- [{leave}](#leave)
54+
- [{pub}](#pub)
55+
- [{get}](#get)
56+
- [{set}](#set)
57+
- [{del}](#del)
58+
- [{note}](#note)
59+
- [Server to Client Messages](#server-to-client-messages)
60+
- [{data}](#data)
61+
- [{ctrl}](#ctrl)
62+
- [{meta}](#meta)
63+
- [{pres}](#pres)
64+
- [{info}](#info)
6465

6566
<!-- /TOC -->
6667

@@ -601,6 +602,21 @@ The `stdout` adapter is mostly useful for debugging and logging. It writes push
601602

602603
[See separate document](call-establishment.md).
603604

605+
## Link Previews
606+
607+
Tinode provides an optional service which helps client applications generate link (URL) previews for inclusion into messages. The enpoint of this service (if enabled) is located at `/v0/urlpreview`. The service takes a single parameter `url`:
608+
609+
```
610+
/v0/urlpreview?url=https%3A%2F%2Ftinode.co
611+
```
612+
The first several kilobytes of the document at the given URL is fetched by issuing an HTTP(S) GET request. If the returned document has content-type `text/html`, the HTML is parsed for page title, description, and image URL. The result is formatted as JSON and returned as
613+
614+
```json
615+
{"title": "Page title", "description": "This is a page description", "image_url": "https://tinode.co/img/logo64x64.png"}
616+
```
617+
618+
The link preview service requires authentication. It's exactly the same as authentication for [Out of Band Large Files](#out-of-band-handling-of-large-files).
619+
604620
## Messages
605621

606622
A message is a logically associated set of data. Messages are passed as JSON-formatted UTF-8 text.

docs/drafty.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ _IMPORTANT Security Consideration_: the `val` and `ref` fields may contain malic
192192
{ "tp":"EX", "data":{ "mime":"application/json", "val": { "seq": 3, "resp": { "confirmation": "some-value" } } } }
193193
```
194194
* `url`: issue an `HTTP GET` request to the URL from the `data.ref` field. The following query parameters are appended to the URL: `<name>=<val>`, `uid=<current-user-ID>`, `topic=<topic name>`, `seq=<message sequence ID>`.
195-
* `note`: send a `{note}` message to the current topic with `what` set to `data`.
195+
* `note`: send a `{note}` message to the current topic with `what` set to `data` (not currently implemented, contact us if you need it).
196196
```js
197197
{ "what": "data", "data": { "mime": "application/json", "val": { "seq": 3, "resp": { "confirmation": "some-value" } } }
198198
```

docs/faq.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,12 @@ The test database has a stock user `xena` which has root access.
9898

9999
### Q: What is the proper way to format gRPC {pub content}?<br/>
100100
**A**: The gPRC sends `content` field of a `{pub}` message as a byte array while the client applications expect it to be valid JSON. Consequently, you have to format the field to be valid JSON before passing it to gRPC. For example, to send a plain text `Hello world` message you have to send a quoted string `"Hello world"`. In most cases the string you pass to the gRPC call would look like `"\"Hello world\""` or `'"Hello world"'`.
101+
102+
103+
### Q: How to fix PostgreSQL initialization failing with 'missing database' error?<br/>
104+
**A**: PostgreSQL has a (mis)feature: a DB connection must always select a database. If the connection tries to use a database (even with intent to create it) which does not exist, the connection fails. When Tinode is started for the first time, it tries to create a database, usually `tinode` (see `tinode.conf`, `"store_config": {"adapters": {"postgres": {"DBName": "tinode"}}}`. The database `tinode` obviously does not exist, so Tinode connection falls back to 'default' database which has the same name as the name of the connecting PostgreSQL user. The default configuration specifies user as `postgres` (`"User": "postgres"`), the database `postgres` always exists, so the connection succeeds and everything works as expected. But if you change the user to anything other than `postgres`, let's say `tinodeadmin`, then trouble starts: the database with the name `tinodeadmin` does not exist and the connection fails. If you want to change the user name to anything other than `postgres`, then you must create either a database `tinode` (or whatever you named your Tinode database) or an empty database with the same name as your user `tinodeadmin`. For example:
105+
```
106+
$ psql
107+
postgres=# create database tinode;
108+
exit
109+
```

0 commit comments

Comments
 (0)