website/templates/services/bridges.html.ep

115 lines
3.3 KiB
Plaintext

% title 'UNIX.dog Services';
% layout 'default';
<article>
<h1>Legacy Service Bridging</h1>
<p>
UNIX.dog runs a few bridges to other services, documented on
this page.
</p>
<section>
<h2>Matrix Bifrost</h2>
<p>
The ARIA-net fork of Bifrost is set up to provide access to
XMPP MUCs and Matrix rooms to users of both services. Use
the <a href="#bridgehelper">bridge helper</a> below to
quickly get the correct address.
</p>
<p>
The Bifrost instance on UNIX.dog is set up as follows:
</p>
<p>
From XMPP, use #roomname#domain@matrix.unix.dog for rooms
and username_host@matrix.unix.dog for users.
</p>
<p>
From Matrix, use @_xmpp_user=40domain:unix.dog for users and
#_xmpp_roomname_domain:unix.dog for MUCs.
</p>
</section>
<section>
<h2>Biboumi IRC Bridge</h2>
<p>
Biboumi provides access to IRC networks from XMPP. The
component domain is biboumi.unix.dog.
</p>
<p>
You can connect to IRC channels using the syntax
#roomname%domain@biboumi.unix.dog.
</p>
</section>
<section id="bridgehelper">
<h2>XMPP and Matrix Bridge Helper</h2>
<p id="result">
</p>
<noscript>Since JS is disabled, this form will send the addresses to
the UNIX.dog server to convert.</noscript>
<form id="bridging" method="post">
<div>
<label for="bridge_service">Bridge:</label>
<select name="bridge" id="bridge_service">
<option value="unix.dog">UNIX.dog</option>
<option value="aria-net">ARIA-net</option>
</select>
</div>
<div>
<select name="type" id="bridge_type">
<option value="muc">XMPP MUC:</option>
<option value="room">Matrix Room:</option>
<option value="jid">XMPP User:</option>
<option value="user">Matrix User:</option>
</select>
<input type="text" id="handle" name="handle" required />
</div>
<div>
<input type="submit"/>
</div>
</form>
</section>
<script>
const conversion = {
"unix.dog": {
"muc": jid => (s => `#_xmpp_${s[0]}_${s[1]}:unix.dog`)(jid.split("@")),
"room": rm => `${rm.replace(":","#")}@matrix.unix.dog`,
"jid": jid => `@_xmpp_${jid.replace("@", "=40")}:unix.dog`,
"user": u => `${u.slice(1).replace(":","_")}@matrix.unix.dog`
},
"aria-net": {
"muc": jid => (s => `#_bifrost_${s[0]}_${s[1]}:aria-net.org`)(jid.split("@")),
"room": rm => `${rm.replace(":","#")}@aria-net.org`,
"jid": jid => `@_bifrost_${jid.replace("@", "=40")}:aria-net.org`,
"user": u => `${u.slice(1).replace(":", "_")}@aria-net.org`
},
};
const urlify = {
"room": jid => `xmpp:${encodeURI(jid)}?join`,
"muc": room => `https://matrix.to/#/%23${encodeURI(room.slice(1))}`,
"user": jid => `xmpp:${encodeURI(jid)}?roster`,
"jid": u => `https://matrix.to/#/${encodeURI(u)}`,
};
const form = document.getElementById("bridging");
const output = document.getElementById("result");
form.addEventListener("submit", e => {
e.preventDefault();
const formData = new FormData(form);
let service = formData.get("bridge");
let type = formData.get("type");
let handle = formData.get("handle");
let bridged = conversion[service][type](handle);
output.textContent = `Use address `
let link = document.createElement("a");
link.href = urlify[type](bridged);
link.textContent = bridged;
output.appendChild(link);
});
</script>
</article>