@sockethub/platform-xmpp 5.0.0-beta.1 → 5.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -1
- package/dist/index.js +49 -24
- package/dist/index.js.map +7 -7
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ This requirement also applies to automatic reconnections.
|
|
|
34
34
|
### Credentials object
|
|
35
35
|
|
|
36
36
|
| Field | Type | Required | Description |
|
|
37
|
-
|
|
37
|
+
| --- | --- | --- | --- |
|
|
38
38
|
| `type` | string | yes | Must be `"credentials"`. |
|
|
39
39
|
| `userAddress` | string | yes | Bare JID, e.g. `user@jabber.net`. |
|
|
40
40
|
| `resource` | string | yes | XMPP resource identifier (e.g. `"phone"`). |
|
|
@@ -317,6 +317,31 @@ non-recoverable connection error.
|
|
|
317
317
|
}
|
|
318
318
|
```
|
|
319
319
|
|
|
320
|
+
## Incoming presence and roster
|
|
321
|
+
|
|
322
|
+
Live presence arrives as an `update` with `object.type` `presence`. `actor.id`
|
|
323
|
+
is the sender's full JID, with `actor.type` `room` for a joined room and
|
|
324
|
+
`person` otherwise; when the stanza has no `to`, `actor.name` is the resource
|
|
325
|
+
part. `object.presence` is the `<show>` value, `offline` for an `unavailable`
|
|
326
|
+
stanza, and `online` otherwise. A `<status>` element is copied to
|
|
327
|
+
`object.content`. The responses schema accepts only `away`, `chat`, `dnd`,
|
|
328
|
+
`xa`, `offline`, `online`, and `notauthorized`; a stanza with any other
|
|
329
|
+
`<show>` value is dropped and the server logs
|
|
330
|
+
`dropping malformed outbound message`.
|
|
331
|
+
|
|
332
|
+
Roster data (`jabber:iq:roster`) is trusted only from the server (a stanza
|
|
333
|
+
with no `from`) or from this account's own bare JID, per
|
|
334
|
+
[RFC 6121 section 2.1.6](https://www.rfc-editor.org/rfc/rfc6121#section-2.1.6).
|
|
335
|
+
Any other sender, including this account's full JID, is ignored and produces
|
|
336
|
+
no client event. Roster items with subscription `none`, `to`, or `from`
|
|
337
|
+
without a pending request are delivered as `request-friend`, with the contact
|
|
338
|
+
JID and roster name in `actor`. Items with a mutual (`both`) subscription are
|
|
339
|
+
delivered as a presence `update` with `object.presence` `online`; items where
|
|
340
|
+
this account's own subscription request is still pending (`from` with
|
|
341
|
+
`ask="subscribe"`) are delivered as a presence `update` with
|
|
342
|
+
`object.presence` `notauthorized`. Every roster
|
|
343
|
+
activity carries this account's bare JID in `target.id`.
|
|
344
|
+
|
|
320
345
|
## Features
|
|
321
346
|
|
|
322
347
|
* **Instant messaging**: Send and receive one-on-one messages
|
package/dist/index.js
CHANGED
|
@@ -51687,7 +51687,7 @@ var ActivityStreamSchema = {
|
|
|
51687
51687
|
var package_default = {
|
|
51688
51688
|
name: "@sockethub/schemas",
|
|
51689
51689
|
description: "JSON schema files for validating Sockethub Activity Streams",
|
|
51690
|
-
version: "3.0.0-beta.
|
|
51690
|
+
version: "3.0.0-beta.3",
|
|
51691
51691
|
type: "module",
|
|
51692
51692
|
private: false,
|
|
51693
51693
|
author: "Nick Jennings <nick@silverbucket.net>",
|
|
@@ -51757,7 +51757,7 @@ var package_default = {
|
|
|
51757
51757
|
"ajv-formats": "^2.1.1",
|
|
51758
51758
|
"ajv-formats-draft2019": "^1.6.1"
|
|
51759
51759
|
},
|
|
51760
|
-
gitHead: "
|
|
51760
|
+
gitHead: "bc04522d60d1e2fa1b3098b339897de62c3b0549",
|
|
51761
51761
|
types: "./dist/index.d.ts"
|
|
51762
51762
|
};
|
|
51763
51763
|
|
|
@@ -51862,8 +51862,12 @@ var SockethubConfigSchema = {
|
|
|
51862
51862
|
"@sockethub/platform-caldav",
|
|
51863
51863
|
"@sockethub/platform-dummy",
|
|
51864
51864
|
"@sockethub/platform-feeds",
|
|
51865
|
+
"@sockethub/platform-email",
|
|
51865
51866
|
"@sockethub/platform-irc",
|
|
51866
51867
|
"@sockethub/platform-metadata",
|
|
51868
|
+
"@sockethub/platform-messenger",
|
|
51869
|
+
"@sockethub/platform-instagram",
|
|
51870
|
+
"@sockethub/platform-whatsapp",
|
|
51867
51871
|
"@sockethub/platform-xmpp"
|
|
51868
51872
|
]
|
|
51869
51873
|
},
|
|
@@ -51879,7 +51883,8 @@ var SockethubConfigSchema = {
|
|
|
51879
51883
|
connectTimeoutMs: { type: "integer", minimum: 1 },
|
|
51880
51884
|
allowPrivateAddresses: { type: "boolean" },
|
|
51881
51885
|
allowInsecureHttp: { type: "boolean" },
|
|
51882
|
-
concurrency: { type: "integer", minimum: 1 }
|
|
51886
|
+
concurrency: { type: "integer", minimum: 1 },
|
|
51887
|
+
discoveryCacheTtlMs: { type: "integer", minimum: 0 }
|
|
51883
51888
|
}
|
|
51884
51889
|
},
|
|
51885
51890
|
"@sockethub/platform-caldav": {
|
|
@@ -51889,7 +51894,20 @@ var SockethubConfigSchema = {
|
|
|
51889
51894
|
connectTimeoutMs: { type: "integer", minimum: 1 },
|
|
51890
51895
|
allowPrivateAddresses: { type: "boolean" },
|
|
51891
51896
|
allowInsecureHttp: { type: "boolean" },
|
|
51892
|
-
concurrency: { type: "integer", minimum: 1 }
|
|
51897
|
+
concurrency: { type: "integer", minimum: 1 },
|
|
51898
|
+
discoveryCacheTtlMs: { type: "integer", minimum: 0 }
|
|
51899
|
+
}
|
|
51900
|
+
},
|
|
51901
|
+
"@sockethub/platform-email": {
|
|
51902
|
+
type: "object",
|
|
51903
|
+
additionalProperties: false,
|
|
51904
|
+
properties: {
|
|
51905
|
+
connectTimeoutMs: {
|
|
51906
|
+
type: "integer",
|
|
51907
|
+
minimum: 5000,
|
|
51908
|
+
maximum: 120000
|
|
51909
|
+
},
|
|
51910
|
+
allowPrivateAddresses: { type: "boolean" }
|
|
51893
51911
|
}
|
|
51894
51912
|
},
|
|
51895
51913
|
"@sockethub/platform-dummy": {
|
|
@@ -51912,7 +51930,8 @@ var SockethubConfigSchema = {
|
|
|
51912
51930
|
type: "object",
|
|
51913
51931
|
additionalProperties: false,
|
|
51914
51932
|
properties: {
|
|
51915
|
-
connectTimeoutMs: { type: "number" }
|
|
51933
|
+
connectTimeoutMs: { type: "number" },
|
|
51934
|
+
allowPrivateAddresses: { type: "boolean" }
|
|
51916
51935
|
}
|
|
51917
51936
|
},
|
|
51918
51937
|
"@sockethub/platform-xmpp": {
|
|
@@ -52022,6 +52041,12 @@ var SockethubConfigSchema = {
|
|
|
52022
52041
|
default: 20,
|
|
52023
52042
|
description: "Maximum persistent instances per client IP, including HTTP actions. 0 disables the cap."
|
|
52024
52043
|
},
|
|
52044
|
+
maxStartsPerIpPerMinute: {
|
|
52045
|
+
type: "integer",
|
|
52046
|
+
minimum: 0,
|
|
52047
|
+
default: 60,
|
|
52048
|
+
description: "Maximum new persistent instances a client IP may start per minute, " + "including HTTP actions. Bounds fork/teardown churn that the " + "concurrent caps allow. Reusing a running instance does not count. " + "0 disables the cap."
|
|
52049
|
+
},
|
|
52025
52050
|
maxPlatformInstances: {
|
|
52026
52051
|
type: "number",
|
|
52027
52052
|
minimum: 0,
|
|
@@ -52592,7 +52617,7 @@ function createGuardedLookup(allowPrivateAddresses) {
|
|
|
52592
52617
|
if (!allowPrivateAddresses) {
|
|
52593
52618
|
for (const { address } of addresses) {
|
|
52594
52619
|
if (isBlockedAddress(address)) {
|
|
52595
|
-
callback(new Error(`blocked non-public address
|
|
52620
|
+
callback(new Error(`blocked non-public address for ${hostname}`));
|
|
52596
52621
|
return;
|
|
52597
52622
|
}
|
|
52598
52623
|
}
|
|
@@ -52644,7 +52669,7 @@ function guardXmppConnections(client, allowPrivateAddresses) {
|
|
|
52644
52669
|
var package_default2 = {
|
|
52645
52670
|
name: "@sockethub/platform-xmpp",
|
|
52646
52671
|
description: "A sockethub platform module implementing XMPP functionality",
|
|
52647
|
-
version: "5.0.0-beta.
|
|
52672
|
+
version: "5.0.0-beta.3",
|
|
52648
52673
|
private: false,
|
|
52649
52674
|
type: "module",
|
|
52650
52675
|
author: "Nick Jennings <nick@silverbucket.net>",
|
|
@@ -52688,12 +52713,12 @@ var package_default2 = {
|
|
|
52688
52713
|
doc: "typedoc --options typedoc.json"
|
|
52689
52714
|
},
|
|
52690
52715
|
dependencies: {
|
|
52691
|
-
"@sockethub/util": "^1.0.0-beta.
|
|
52716
|
+
"@sockethub/util": "^1.0.0-beta.3",
|
|
52692
52717
|
"@xmpp/client": "^0.13.6",
|
|
52693
52718
|
"@xmpp/resolve": "^0.13.3"
|
|
52694
52719
|
},
|
|
52695
52720
|
devDependencies: {
|
|
52696
|
-
"@sockethub/schemas": "^3.0.0-beta.
|
|
52721
|
+
"@sockethub/schemas": "^3.0.0-beta.3",
|
|
52697
52722
|
"@types/bun": "latest",
|
|
52698
52723
|
"@xmpp/xml": "^0.13.2",
|
|
52699
52724
|
ajv: "^8.17.1",
|
|
@@ -52701,14 +52726,14 @@ var package_default2 = {
|
|
|
52701
52726
|
typedoc: "^0.28.14"
|
|
52702
52727
|
},
|
|
52703
52728
|
peerDependencies: {
|
|
52704
|
-
"@sockethub/server": "^5.0.0-beta.
|
|
52729
|
+
"@sockethub/server": "^5.0.0-beta.3"
|
|
52705
52730
|
},
|
|
52706
52731
|
peerDependenciesMeta: {
|
|
52707
52732
|
"@sockethub/server": {
|
|
52708
52733
|
optional: true
|
|
52709
52734
|
}
|
|
52710
52735
|
},
|
|
52711
|
-
gitHead: "
|
|
52736
|
+
gitHead: "bc04522d60d1e2fa1b3098b339897de62c3b0549",
|
|
52712
52737
|
types: "./dist/index.d.ts"
|
|
52713
52738
|
};
|
|
52714
52739
|
|
|
@@ -53443,6 +53468,10 @@ class IncomingHandlers {
|
|
|
53443
53468
|
this.notifyError(stanza);
|
|
53444
53469
|
} else if (stanza.is("message")) {
|
|
53445
53470
|
this.notifyChatMessage(stanza);
|
|
53471
|
+
} else if (stanza.is("presence") && stanza.attrs.type === "subscribe") {
|
|
53472
|
+
this.subscribe({ id: this.session?.__bareJid ?? "", type: "person" }, (stanza.attrs.from ?? "").split("/")[0]);
|
|
53473
|
+
} else if (stanza.is("presence") && ["subscribed", "unsubscribe", "unsubscribed"].includes(stanza.attrs.type ?? "")) {
|
|
53474
|
+
this.session?.log.debug(`ignoring ${stanza.attrs.type} presence from ${stanza.attrs.from}`);
|
|
53446
53475
|
} else if (stanza.is("presence")) {
|
|
53447
53476
|
this.presence(stanza);
|
|
53448
53477
|
} else if (stanza.is("iq")) {
|
|
@@ -53460,6 +53489,10 @@ class IncomingHandlers {
|
|
|
53460
53489
|
const from = stanza.attrs.from;
|
|
53461
53490
|
if (query && (!from || from === this.session?.__bareJid)) {
|
|
53462
53491
|
const entries = query.getChildren("item");
|
|
53492
|
+
const self2 = {
|
|
53493
|
+
id: this.session?.__bareJid ?? "",
|
|
53494
|
+
type: "person"
|
|
53495
|
+
};
|
|
53463
53496
|
for (const e in entries) {
|
|
53464
53497
|
if (!Object.hasOwn(entries, e)) {
|
|
53465
53498
|
continue;
|
|
@@ -53474,13 +53507,9 @@ class IncomingHandlers {
|
|
|
53474
53507
|
name: entries[e].attrs.name,
|
|
53475
53508
|
type: "person"
|
|
53476
53509
|
},
|
|
53477
|
-
target:
|
|
53478
|
-
id: "",
|
|
53479
|
-
type: "person"
|
|
53480
|
-
},
|
|
53510
|
+
target: self2,
|
|
53481
53511
|
object: {
|
|
53482
53512
|
type: "presence",
|
|
53483
|
-
status: "",
|
|
53484
53513
|
presence: getPresence(entries[e])
|
|
53485
53514
|
}
|
|
53486
53515
|
});
|
|
@@ -53493,18 +53522,14 @@ class IncomingHandlers {
|
|
|
53493
53522
|
name: entries[e].attrs.name,
|
|
53494
53523
|
type: "person"
|
|
53495
53524
|
},
|
|
53496
|
-
target:
|
|
53497
|
-
id: "",
|
|
53498
|
-
type: "person"
|
|
53499
|
-
},
|
|
53525
|
+
target: self2,
|
|
53500
53526
|
object: {
|
|
53501
53527
|
type: "presence",
|
|
53502
|
-
statusText: "",
|
|
53503
53528
|
presence: "notauthorized"
|
|
53504
53529
|
}
|
|
53505
53530
|
});
|
|
53506
53531
|
} else {
|
|
53507
|
-
this.subscribe(
|
|
53532
|
+
this.subscribe(self2, entries[e].attrs.jid ?? "", entries[e].attrs.name);
|
|
53508
53533
|
}
|
|
53509
53534
|
}
|
|
53510
53535
|
}
|
|
@@ -53851,7 +53876,7 @@ class XMPP {
|
|
|
53851
53876
|
}
|
|
53852
53877
|
this.log.debug(`make-friend() called for ${job.actor.id}`);
|
|
53853
53878
|
this.__client.send(this.__xml("presence", {
|
|
53854
|
-
type: "
|
|
53879
|
+
type: "subscribed",
|
|
53855
53880
|
to: job.target?.id
|
|
53856
53881
|
})).then(() => done()).catch(done);
|
|
53857
53882
|
}
|
|
@@ -53914,4 +53939,4 @@ export {
|
|
|
53914
53939
|
setTlsServername
|
|
53915
53940
|
};
|
|
53916
53941
|
|
|
53917
|
-
//# debugId=
|
|
53942
|
+
//# debugId=771E268E89A992DB64756E2164756E21
|