aboutsummaryrefslogtreecommitdiff
path: root/systems/eldiron/websites/im
diff options
context:
space:
mode:
Diffstat (limited to 'systems/eldiron/websites/im')
-rw-r--r--systems/eldiron/websites/im/default.nix118
-rw-r--r--systems/eldiron/websites/im/www/converse.html57
-rw-r--r--systems/eldiron/websites/im/www/index.html47
3 files changed, 222 insertions, 0 deletions
diff --git a/systems/eldiron/websites/im/default.nix b/systems/eldiron/websites/im/default.nix
new file mode 100644
index 0000000..7755a5c
--- /dev/null
+++ b/systems/eldiron/websites/im/default.nix
@@ -0,0 +1,118 @@
1{ config, lib, pkgs, ... }:
2let
3 cfg = config.myServices.websites.tools.im;
4 converseVersion = "9.1.1";
5 www = pkgs.runCommand "www" {} ''
6 cp -a ${./www} $out
7 substituteInPlace $out/converse.html --replace {{converseVersion}} ${converseVersion}
8 '';
9in
10{
11 options.myServices.websites.tools.im = {
12 enable = lib.mkEnableOption "enable im website";
13 };
14
15 config = lib.mkIf cfg.enable {
16 myServices.chatonsProperties.services.converse = {
17 file.datetime = "2022-08-21T19:20:00";
18 service = {
19 name = "Converse";
20 description = "A free and open-source XMPP chat client in your browser";
21 website = "https://im.immae.fr/converse";
22 logo = "https://conversejs.org/docs/html/_static/favicon.ico";
23 status.level = "OK";
24 status.description = "OK";
25 registration."" = ["NONE" "FREE"];
26 registration.load = "OPEN";
27 install.type = "PACKAGE";
28 };
29 software = {
30 name = "Converse";
31 website = "https://conversejs.org/";
32 license.name = "Mozilla Public License 2.0";
33 license.url = "https://github.com/conversejs/converse.js/blob/master/LICENSE";
34 version = "9.1.1";
35 source.url = "https://github.com/conversejs/converse.js";
36 };
37 };
38 myServices.chatonsProperties.services.weechat-bridge = {
39 file.datetime = "2022-08-21T19:20:00";
40 service = {
41 name = "Weechat bridge";
42 description = "WeeChat web frontend";
43 website = "https://im.immae.fr/glowing-bear";
44 logo = "https://im.immae.fr/glowing-bear/assets/img/glowing_bear_128x128.png";
45 status.level = "OK";
46 status.description = "OK";
47 registration."" = ["NONE" "FREE"];
48 registration.load = "OPEN";
49 install.type = "PACKAGE";
50 };
51 software = {
52 name = "Glowing bear";
53 website = "https://www.ejabberd.im/";
54 license.name = "GNU General Public License v3.0";
55 license.url = "https://github.com/processone/ejabberd";
56 version = pkgs.glowing-bear.version;
57 source.url = "https://github.com/glowing-bear/glowing-bear";
58 };
59 };
60 myServices.chatonsProperties.services.xmpp = {
61 file.datetime = "2022-08-21T19:20:00";
62 service = {
63 name = "XMPP";
64 description = "Universal messaging standard";
65 website = "https://im.immae.fr/";
66 logo = "https://xmpp.org/favicon-32x32.png";
67 status.level = "OK";
68 status.description = "OK";
69 registration."" = ["MEMBER" "CLIENT"];
70 registration.load = "OPEN";
71 install.type = "PACKAGE";
72 };
73 software = {
74 name = "ejabberd";
75 website = "https://www.ejabberd.im/";
76 license.url = "https://github.com/processone/ejabberd/blob/master/COPYING";
77 license.name = "GNU GENERAL PUBLIC LICENSE Version 2";
78 version = pkgs.ejabberd.version;
79 source.url = "https://github.com/processone/ejabberd";
80 modules = "converse";
81 };
82 };
83 security.acme.certs.eldiron.extraDomainNames = [ "im.immae.fr" ];
84 services.websites.env.tools.vhostConfs.im = {
85 certName = "eldiron";
86 hosts = ["im.immae.fr"];
87 root = www;
88 extraConfig = [
89 ''
90 Alias /glowing-bear ${pkgs.glowing-bear}
91 Alias /converse ${www}/converse.html
92 ProxyPreserveHost On
93 <Location "/bosh">
94 ProxyPass http://localhost:5280/bosh
95 ProxyPassReverse http://localhost:5280/bosh
96 </Location>
97 <Location "/ws">
98 ProxyPass ws://localhost:5280/ws
99 </Location>
100 ProxyPass /upload http://localhost:5280/upload
101 ProxyPassReverse /upload http://localhost:5280/upload
102 ProxyPass /admin http://localhost:5280/admin
103 ProxyPassReverse /admin http://localhost:5280/admin
104 ProxyPass /api http://localhost:5280/api
105 ProxyPassReverse /api http://localhost:5280/api
106 <Directory ${pkgs.glowing-bear}>
107 AllowOverride none
108 Require all granted
109 </Directory>
110 <Directory ${www}>
111 Require all granted
112 AllowOverride none
113 </Directory>
114 ''
115 ];
116 };
117 };
118}
diff --git a/systems/eldiron/websites/im/www/converse.html b/systems/eldiron/websites/im/www/converse.html
new file mode 100644
index 0000000..4ca451d
--- /dev/null
+++ b/systems/eldiron/websites/im/www/converse.html
@@ -0,0 +1,57 @@
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/{{converseVersion}}/dist/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/{{converseVersion}}/3rdparty/libsignal-protocol.min.js"></script>
19 <script src="https://assets.immae.eu/converse/{{converseVersion}}/dist/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 </head>
23 <body>
24 <script>
25 var md = window.markdownit({
26 html: true,
27 });
28 converse.plugins.add('markdown', {
29 //initialize () {
30 // const { _converse } = this;
31 // _converse.api.listen.on('afterMessageBodyTransformed', (view, text) => {
32 // let newtext = text.replace(/<br\/>/g, '\n').replace(/```/g, "\n```\n");
33 // newtext = md.render(newtext).replace(/^<p>/, "").replace(/<\/p>\s*$/, "");
34 // view.model.save({'message': newtext}, {'silent': true });
35 // });
36 //}
37 overrides: {
38 MessageView: {
39 transformBodyText: async function(text) {
40 let newtext = await this.__super__.transformBodyText.apply(this, arguments);
41 newtext = newtext.replace(/<br\/>/g, '\n').replace(/```/g, "\n```\n");
42 return md.render(newtext).replace(/^<p>/, "").replace(/<\/p>\s*$/, "");
43 }
44 }
45 }
46 });
47 converse.initialize({
48 //bosh_service_url: 'https://im.immae.fr/bosh',
49 websocket_url: 'wss://im.immae.fr/ws',
50 view_mode: 'fullscreen',
51 show_controlbox_by_default: true,
52 whitelisted_plugins: ['markdown'],
53 });
54 </script>
55 </body>
56</html>
57
diff --git a/systems/eldiron/websites/im/www/index.html b/systems/eldiron/websites/im/www/index.html
new file mode 100644
index 0000000..90c5458
--- /dev/null
+++ b/systems/eldiron/websites/im/www/index.html
@@ -0,0 +1,47 @@
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>