forked from cory/tildefriends
Eh?
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4037 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -30,6 +30,14 @@ tfrpc.register(async function getBroadcasts() {
|
||||
tfrpc.register(async function getConnections() {
|
||||
return ssb.connections();
|
||||
});
|
||||
tfrpc.register(async function connectionSendJson(id, message) {
|
||||
return ssb.connectionSendJson(id, message);
|
||||
});
|
||||
tfrpc.register(async function createTunnel(portal, request_number, target) {
|
||||
print('createTunnel', portal, request_number, target);
|
||||
let t = ssb.createTunnel(portal, request_number, target);
|
||||
return t;
|
||||
});
|
||||
tfrpc.register(async function connect(token) {
|
||||
await ssb.connect(token);
|
||||
});
|
||||
|
@ -52,12 +52,28 @@ class TfTabConnectionsElement extends LitElement {
|
||||
if (peers.length) {
|
||||
return html`
|
||||
<ul>
|
||||
${peers.map(x => html`${self.render_broadcast(x)}`)}
|
||||
${peers.map(x => html`${self.render_room_peer(x)}`)}
|
||||
</ul>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
async _tunnel(portal, target) {
|
||||
let request_number = await tfrpc.rpc.connectionSendJson(portal, {name: ['tunnel', 'connect'], args: [{portal: portal, target: target}], type: 'duplex'});
|
||||
return tfrpc.rpc.createTunnel(portal, request_number, target);
|
||||
}
|
||||
|
||||
render_room_peer(connection) {
|
||||
let self = this;
|
||||
return html`
|
||||
<li>
|
||||
<input type="button" @click=${() => self._tunnel(connection.tunnel.id, connection.pubkey)} value="Connect"></input>
|
||||
<tf-user id=${connection.pubkey} .users=${this.users}></tf-user>
|
||||
(room peer)
|
||||
</li>
|
||||
`;
|
||||
}
|
||||
|
||||
render_broadcast(connection) {
|
||||
return html`
|
||||
<li>
|
||||
|
Reference in New Issue
Block a user