Mercurial > eldonilo > avatar
annotate configuration.js.example @ 25:ba0edeb9ba05 default tip
Put the repository more in evidence, add an in-memory s2s blacklist and fix a few minor stuff.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 02 Dec 2012 13:19:54 +0100 |
parents | d63a2784564d |
children |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright (C) 2011 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | |
3 * | |
4 * This file is the source code of an XMPP avatar retriever. | |
5 * | |
6 * This program is free software: you can redistribute it and/or modify | |
7 * it under the terms of the GNU Affero General Public License as | |
8 * published by the Free Software Foundation, version 3 of the License. | |
9 * | |
10 * This program is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 * GNU Affero General Public License for more details. | |
14 * | |
15 * You should have received a copy of the GNU Affero General Public License | |
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 */ | |
18 | |
19 'use strict'; | |
20 | |
21 var config = exports; | |
22 | |
13
38ddd5888b8d
It’s now a client instead of a component. :)
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
10
diff
changeset
|
23 // The JID and password of the account used. |
20
e4916f1763e5
Deactivable debug; fix a stupid bug in gravatar; add a better default image and make it configurable.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
19
diff
changeset
|
24 config.jid = 'avatar@example.org'; |
8
e0cd5ede76af
Better documentation.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
25 config.password = 'hellohello'; |
e0cd5ede76af
Better documentation.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
26 |
e0cd5ede76af
Better documentation.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
27 // Root of the webservice, useful if you want to proxy it. |
20
e4916f1763e5
Deactivable debug; fix a stupid bug in gravatar; add a better default image and make it configurable.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
19
diff
changeset
|
28 config.webRoot = '/avatar/'; |
8
e0cd5ede76af
Better documentation.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
29 |
9
9360b78c7a5b
Add WebHost configuration, and default it to both IPv6 and IPv4.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
30 // These are the host and the port on which the web service will |
9360b78c7a5b
Add WebHost configuration, and default it to both IPv6 and IPv4.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
31 // listen. If you want IPv4 connection only, instead of both IPv4 and |
9360b78c7a5b
Add WebHost configuration, and default it to both IPv6 and IPv4.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
32 // IPv6, replace '::' by '0.0.0.0'. If you want a port < 1024, you |
9360b78c7a5b
Add WebHost configuration, and default it to both IPv6 and IPv4.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
33 // have to start it as root, use a proxy or redirect it using a |
9360b78c7a5b
Add WebHost configuration, and default it to both IPv6 and IPv4.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
34 // firewall like iptables. |
9360b78c7a5b
Add WebHost configuration, and default it to both IPv6 and IPv4.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
8
diff
changeset
|
35 config.webHost = '::'; |
8
e0cd5ede76af
Better documentation.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
36 config.webPort = 8032; |
e0cd5ede76af
Better documentation.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
37 |
e0cd5ede76af
Better documentation.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
38 // Directory for the cache of the images. |
e0cd5ede76af
Better documentation.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
39 config.directory = 'data'; |
e0cd5ede76af
Better documentation.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
7
diff
changeset
|
40 |
16
27eaec05cfd0
Expire the avatar after a configurable amount of time.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
13
diff
changeset
|
41 // Time after which the avatar will be retrieved again, in seconds. |
27eaec05cfd0
Expire the avatar after a configurable amount of time.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
13
diff
changeset
|
42 config.expire = 24*60*60; |
18
92d6e1b40df5
Move available extensions into configuration.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
16
diff
changeset
|
43 |
23
d63a2784564d
Set a timeout for the vCard stanza.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
20
diff
changeset
|
44 // Time to wait for a response to a stanza, in milliseconds. This is |
d63a2784564d
Set a timeout for the vCard stanza.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
20
diff
changeset
|
45 // needed for inexistent domain because with some XMPP servers, the |
d63a2784564d
Set a timeout for the vCard stanza.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
20
diff
changeset
|
46 // default is to wait one minute. |
d63a2784564d
Set a timeout for the vCard stanza.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
20
diff
changeset
|
47 config.timeout = 1000; |
d63a2784564d
Set a timeout for the vCard stanza.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
20
diff
changeset
|
48 |
18
92d6e1b40df5
Move available extensions into configuration.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
16
diff
changeset
|
49 // Allowed extensions, associated with their MIME type. |
92d6e1b40df5
Move available extensions into configuration.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
16
diff
changeset
|
50 config.extensions = { |
92d6e1b40df5
Move available extensions into configuration.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
16
diff
changeset
|
51 png: 'image/png', |
92d6e1b40df5
Move available extensions into configuration.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
16
diff
changeset
|
52 svg: 'image/svg+xml', |
92d6e1b40df5
Move available extensions into configuration.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
16
diff
changeset
|
53 jpg: 'image/jpeg', |
92d6e1b40df5
Move available extensions into configuration.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
16
diff
changeset
|
54 gif: 'image/gif' |
92d6e1b40df5
Move available extensions into configuration.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
16
diff
changeset
|
55 }; |
19
9ff8f951da99
Add Gravatar fallback.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
18
diff
changeset
|
56 |
20
e4916f1763e5
Deactivable debug; fix a stupid bug in gravatar; add a better default image and make it configurable.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
19
diff
changeset
|
57 // Image to use as fallback when there is no usable avatar. If not set, |
e4916f1763e5
Deactivable debug; fix a stupid bug in gravatar; add a better default image and make it configurable.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
19
diff
changeset
|
58 // a SVG image will be displayed. |
e4916f1763e5
Deactivable debug; fix a stupid bug in gravatar; add a better default image and make it configurable.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
19
diff
changeset
|
59 //config.defaultImage = 'http://example.org/default.svg'; |
e4916f1763e5
Deactivable debug; fix a stupid bug in gravatar; add a better default image and make it configurable.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
19
diff
changeset
|
60 |
23
d63a2784564d
Set a timeout for the vCard stanza.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
20
diff
changeset
|
61 // When true, assume that the TYPE of the avatar is image/png if not |
d63a2784564d
Set a timeout for the vCard stanza.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
20
diff
changeset
|
62 // specified. Warning: it doesn’t follow the spec and is only a |
d63a2784564d
Set a timeout for the vCard stanza.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
20
diff
changeset
|
63 // workaround for buggy clients. |
d63a2784564d
Set a timeout for the vCard stanza.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
20
diff
changeset
|
64 config.guessType = false; |
d63a2784564d
Set a timeout for the vCard stanza.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
20
diff
changeset
|
65 |
19
9ff8f951da99
Add Gravatar fallback.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
18
diff
changeset
|
66 // Try Gravatar if there is a problem during XMPP avatar retrieving. |
23
d63a2784564d
Set a timeout for the vCard stanza.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
20
diff
changeset
|
67 config.useGravatar = false; |
20
e4916f1763e5
Deactivable debug; fix a stupid bug in gravatar; add a better default image and make it configurable.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
19
diff
changeset
|
68 |
e4916f1763e5
Deactivable debug; fix a stupid bug in gravatar; add a better default image and make it configurable.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
19
diff
changeset
|
69 // Prints XMPP stanzas |
e4916f1763e5
Deactivable debug; fix a stupid bug in gravatar; add a better default image and make it configurable.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
19
diff
changeset
|
70 config.debug = false; |