diff options
Diffstat (limited to 'modules/private/websites/tools/im')
-rw-r--r-- | modules/private/websites/tools/im/default.nix | 42 | ||||
-rw-r--r-- | modules/private/websites/tools/im/www/converse.html | 57 | ||||
-rw-r--r-- | modules/private/websites/tools/im/www/index.html | 47 |
3 files changed, 0 insertions, 146 deletions
diff --git a/modules/private/websites/tools/im/default.nix b/modules/private/websites/tools/im/default.nix deleted file mode 100644 index 94dc4f8..0000000 --- a/modules/private/websites/tools/im/default.nix +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | { config, lib, pkgs, ... }: | ||
2 | let | ||
3 | cfg = config.myServices.websites.tools.im; | ||
4 | in | ||
5 | { | ||
6 | options.myServices.websites.tools.im = { | ||
7 | enable = lib.mkEnableOption "enable im website"; | ||
8 | }; | ||
9 | |||
10 | config = lib.mkIf cfg.enable { | ||
11 | services.websites.env.tools.vhostConfs.im = { | ||
12 | certName = "eldiron"; | ||
13 | addToCerts = true; | ||
14 | hosts = ["im.immae.fr"]; | ||
15 | root = ./www; | ||
16 | extraConfig = [ | ||
17 | '' | ||
18 | Alias /glowing-bear ${pkgs.glowing-bear} | ||
19 | Alias /converse ${./www}/converse.html | ||
20 | ProxyPreserveHost On | ||
21 | <Location "/bosh"> | ||
22 | ProxyPass http://localhost:5280/bosh | ||
23 | ProxyPassReverse http://localhost:5280/bosh | ||
24 | </Location> | ||
25 | <Location "/ws"> | ||
26 | ProxyPass ws://localhost:5280/ws | ||
27 | </Location> | ||
28 | ProxyPass /upload http://localhost:5280/upload | ||
29 | ProxyPassReverse /upload http://localhost:5280/upload | ||
30 | ProxyPass /admin http://localhost:5280/admin | ||
31 | ProxyPassReverse /admin http://localhost:5280/admin | ||
32 | ProxyPass /api http://localhost:5280/api | ||
33 | ProxyPassReverse /api http://localhost:5280/api | ||
34 | <Directory ${pkgs.glowing-bear}> | ||
35 | AllowOverride none | ||
36 | Require all granted | ||
37 | </Directory> | ||
38 | '' | ||
39 | ]; | ||
40 | }; | ||
41 | }; | ||
42 | } | ||
diff --git a/modules/private/websites/tools/im/www/converse.html b/modules/private/websites/tools/im/www/converse.html deleted file mode 100644 index 936dde4..0000000 --- a/modules/private/websites/tools/im/www/converse.html +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <html lang="en"> | ||
3 | <head> | ||
4 | <title>Converse</title> | ||
5 | <meta charset="utf-8"> | ||
6 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
7 | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
8 | <meta name="description" content="Converse: An XMPP chat client which can be integrated into any website" /> | ||
9 | <meta name="keywords" content="xmpp chat webchat converse.js Converse" /> | ||
10 | |||
11 | <link type="text/css" rel="stylesheet" media="screen" href="https://assets.immae.eu/converse/5.0.4/converse.min.css" /> | ||
12 | <style type="text/css"> | ||
13 | #conversejs div.chat-msg__text pre { | ||
14 | background-color: #eee; | ||
15 | padding: 10px; | ||
16 | } | ||
17 | </style> | ||
18 | <script src="https://assets.immae.eu/converse/5.0.4/libsignal-protocol.min.js"></script> | ||
19 | <script src="https://assets.immae.eu/converse/5.0.4/converse.min.js"></script> | ||
20 | <script src="https://assets.immae.eu/marked/1.2.6/marked.min.js"></script> | ||
21 | <script src="https://assets.immae.eu/markdown-it/10.0.0/markdown-it.min.js"></script> | ||
22 | <script> | ||
23 | var md = window.markdownit({ | ||
24 | html: true, | ||
25 | }); | ||
26 | converse.plugins.add('markdown', { | ||
27 | //initialize () { | ||
28 | // const { _converse } = this; | ||
29 | // _converse.api.listen.on('afterMessageBodyTransformed', (view, text) => { | ||
30 | // let newtext = text.replace(/<br\/>/g, '\n').replace(/```/g, "\n```\n"); | ||
31 | // newtext = md.render(newtext).replace(/^<p>/, "").replace(/<\/p>\s*$/, ""); | ||
32 | // view.model.save({'message': newtext}, {'silent': true }); | ||
33 | // }); | ||
34 | //} | ||
35 | overrides: { | ||
36 | MessageView: { | ||
37 | transformBodyText: async function(text) { | ||
38 | let newtext = await this.__super__.transformBodyText.apply(this, arguments); | ||
39 | newtext = newtext.replace(/<br\/>/g, '\n').replace(/```/g, "\n```\n"); | ||
40 | return md.render(newtext).replace(/^<p>/, "").replace(/<\/p>\s*$/, ""); | ||
41 | } | ||
42 | } | ||
43 | } | ||
44 | }); | ||
45 | converse.initialize({ | ||
46 | //bosh_service_url: 'https://im.immae.fr/bosh', | ||
47 | websocket_url: 'wss://im.immae.fr/ws', | ||
48 | view_mode: 'fullscreen', | ||
49 | show_controlbox_by_default: true, | ||
50 | whitelisted_plugins: ['markdown'], | ||
51 | }); | ||
52 | </script> | ||
53 | </head> | ||
54 | <body> | ||
55 | </body> | ||
56 | </html> | ||
57 | |||
diff --git a/modules/private/websites/tools/im/www/index.html b/modules/private/websites/tools/im/www/index.html deleted file mode 100644 index 90c5458..0000000 --- a/modules/private/websites/tools/im/www/index.html +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | <!doctype html> | ||
2 | <html lang="fr"> | ||
3 | <head> | ||
4 | <meta charset="UTF-8"> | ||
5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
6 | <title>Instant messaging configuration (Jabber/XMPP)</title> | ||
7 | <style type="text/css"> | ||
8 | body { | ||
9 | padding-top: 1em; | ||
10 | padding-left: 5px; | ||
11 | padding-right: 5px; | ||
12 | text-align: left; | ||
13 | margin: auto; | ||
14 | font: 20px Helvetica, sans-serif; | ||
15 | color: #333; | ||
16 | height: 100%; | ||
17 | min-height: 100%; | ||
18 | } | ||
19 | article { | ||
20 | text-align: justify; | ||
21 | display: block; | ||
22 | max-width: 850px; | ||
23 | margin: 0 auto; | ||
24 | padding-top: 30px; | ||
25 | } | ||
26 | span.code { | ||
27 | font-family: monospace; | ||
28 | } | ||
29 | </style> | ||
30 | </head> | ||
31 | <body> | ||
32 | <p> | ||
33 | Pre-configured clients: | ||
34 | <ul> | ||
35 | <li><a href="converse">Converse client</a></li> | ||
36 | <li><a href="glowing-bear">Weechat relay client</a></li> | ||
37 | </ul> | ||
38 | </p> | ||
39 | <p> | ||
40 | Technical details: | ||
41 | <ul> | ||
42 | <li>HTTP-bind/BOSH access (XEP-0124 / XEP-0206): <span class="code">https://im.immae.fr/bosh</span></li> | ||
43 | <li>WS access (RFC 7395): <span class="code">wss://im.immae.fr/ws</span></li> | ||
44 | </ul> | ||
45 | </p> | ||
46 | </body> | ||
47 | </html> | ||