@sockethub/platform-xmpp 5.0.0-beta.1 → 5.0.0-beta.2
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 +48 -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.2",
|
|
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: "1f74d4e07311496f0acc021855137bc197d79eab",
|
|
51761
51761
|
types: "./dist/index.d.ts"
|
|
51762
51762
|
};
|
|
51763
51763
|
|
|
@@ -51862,8 +51862,11 @@ 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",
|
|
51867
51870
|
"@sockethub/platform-xmpp"
|
|
51868
51871
|
]
|
|
51869
51872
|
},
|
|
@@ -51879,7 +51882,8 @@ var SockethubConfigSchema = {
|
|
|
51879
51882
|
connectTimeoutMs: { type: "integer", minimum: 1 },
|
|
51880
51883
|
allowPrivateAddresses: { type: "boolean" },
|
|
51881
51884
|
allowInsecureHttp: { type: "boolean" },
|
|
51882
|
-
concurrency: { type: "integer", minimum: 1 }
|
|
51885
|
+
concurrency: { type: "integer", minimum: 1 },
|
|
51886
|
+
discoveryCacheTtlMs: { type: "integer", minimum: 0 }
|
|
51883
51887
|
}
|
|
51884
51888
|
},
|
|
51885
51889
|
"@sockethub/platform-caldav": {
|
|
@@ -51889,7 +51893,20 @@ var SockethubConfigSchema = {
|
|
|
51889
51893
|
connectTimeoutMs: { type: "integer", minimum: 1 },
|
|
51890
51894
|
allowPrivateAddresses: { type: "boolean" },
|
|
51891
51895
|
allowInsecureHttp: { type: "boolean" },
|
|
51892
|
-
concurrency: { type: "integer", minimum: 1 }
|
|
51896
|
+
concurrency: { type: "integer", minimum: 1 },
|
|
51897
|
+
discoveryCacheTtlMs: { type: "integer", minimum: 0 }
|
|
51898
|
+
}
|
|
51899
|
+
},
|
|
51900
|
+
"@sockethub/platform-email": {
|
|
51901
|
+
type: "object",
|
|
51902
|
+
additionalProperties: false,
|
|
51903
|
+
properties: {
|
|
51904
|
+
connectTimeoutMs: {
|
|
51905
|
+
type: "integer",
|
|
51906
|
+
minimum: 5000,
|
|
51907
|
+
maximum: 120000
|
|
51908
|
+
},
|
|
51909
|
+
allowPrivateAddresses: { type: "boolean" }
|
|
51893
51910
|
}
|
|
51894
51911
|
},
|
|
51895
51912
|
"@sockethub/platform-dummy": {
|
|
@@ -51912,7 +51929,8 @@ var SockethubConfigSchema = {
|
|
|
51912
51929
|
type: "object",
|
|
51913
51930
|
additionalProperties: false,
|
|
51914
51931
|
properties: {
|
|
51915
|
-
connectTimeoutMs: { type: "number" }
|
|
51932
|
+
connectTimeoutMs: { type: "number" },
|
|
51933
|
+
allowPrivateAddresses: { type: "boolean" }
|
|
51916
51934
|
}
|
|
51917
51935
|
},
|
|
51918
51936
|
"@sockethub/platform-xmpp": {
|
|
@@ -52022,6 +52040,12 @@ var SockethubConfigSchema = {
|
|
|
52022
52040
|
default: 20,
|
|
52023
52041
|
description: "Maximum persistent instances per client IP, including HTTP actions. 0 disables the cap."
|
|
52024
52042
|
},
|
|
52043
|
+
maxStartsPerIpPerMinute: {
|
|
52044
|
+
type: "integer",
|
|
52045
|
+
minimum: 0,
|
|
52046
|
+
default: 60,
|
|
52047
|
+
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."
|
|
52048
|
+
},
|
|
52025
52049
|
maxPlatformInstances: {
|
|
52026
52050
|
type: "number",
|
|
52027
52051
|
minimum: 0,
|
|
@@ -52592,7 +52616,7 @@ function createGuardedLookup(allowPrivateAddresses) {
|
|
|
52592
52616
|
if (!allowPrivateAddresses) {
|
|
52593
52617
|
for (const { address } of addresses) {
|
|
52594
52618
|
if (isBlockedAddress(address)) {
|
|
52595
|
-
callback(new Error(`blocked non-public address
|
|
52619
|
+
callback(new Error(`blocked non-public address for ${hostname}`));
|
|
52596
52620
|
return;
|
|
52597
52621
|
}
|
|
52598
52622
|
}
|
|
@@ -52644,7 +52668,7 @@ function guardXmppConnections(client, allowPrivateAddresses) {
|
|
|
52644
52668
|
var package_default2 = {
|
|
52645
52669
|
name: "@sockethub/platform-xmpp",
|
|
52646
52670
|
description: "A sockethub platform module implementing XMPP functionality",
|
|
52647
|
-
version: "5.0.0-beta.
|
|
52671
|
+
version: "5.0.0-beta.2",
|
|
52648
52672
|
private: false,
|
|
52649
52673
|
type: "module",
|
|
52650
52674
|
author: "Nick Jennings <nick@silverbucket.net>",
|
|
@@ -52688,12 +52712,12 @@ var package_default2 = {
|
|
|
52688
52712
|
doc: "typedoc --options typedoc.json"
|
|
52689
52713
|
},
|
|
52690
52714
|
dependencies: {
|
|
52691
|
-
"@sockethub/util": "^1.0.0-beta.
|
|
52715
|
+
"@sockethub/util": "^1.0.0-beta.2",
|
|
52692
52716
|
"@xmpp/client": "^0.13.6",
|
|
52693
52717
|
"@xmpp/resolve": "^0.13.3"
|
|
52694
52718
|
},
|
|
52695
52719
|
devDependencies: {
|
|
52696
|
-
"@sockethub/schemas": "^3.0.0-beta.
|
|
52720
|
+
"@sockethub/schemas": "^3.0.0-beta.2",
|
|
52697
52721
|
"@types/bun": "latest",
|
|
52698
52722
|
"@xmpp/xml": "^0.13.2",
|
|
52699
52723
|
ajv: "^8.17.1",
|
|
@@ -52701,14 +52725,14 @@ var package_default2 = {
|
|
|
52701
52725
|
typedoc: "^0.28.14"
|
|
52702
52726
|
},
|
|
52703
52727
|
peerDependencies: {
|
|
52704
|
-
"@sockethub/server": "^5.0.0-beta.
|
|
52728
|
+
"@sockethub/server": "^5.0.0-beta.2"
|
|
52705
52729
|
},
|
|
52706
52730
|
peerDependenciesMeta: {
|
|
52707
52731
|
"@sockethub/server": {
|
|
52708
52732
|
optional: true
|
|
52709
52733
|
}
|
|
52710
52734
|
},
|
|
52711
|
-
gitHead: "
|
|
52735
|
+
gitHead: "1f74d4e07311496f0acc021855137bc197d79eab",
|
|
52712
52736
|
types: "./dist/index.d.ts"
|
|
52713
52737
|
};
|
|
52714
52738
|
|
|
@@ -53443,6 +53467,10 @@ class IncomingHandlers {
|
|
|
53443
53467
|
this.notifyError(stanza);
|
|
53444
53468
|
} else if (stanza.is("message")) {
|
|
53445
53469
|
this.notifyChatMessage(stanza);
|
|
53470
|
+
} else if (stanza.is("presence") && stanza.attrs.type === "subscribe") {
|
|
53471
|
+
this.subscribe({ id: this.session?.__bareJid ?? "", type: "person" }, (stanza.attrs.from ?? "").split("/")[0]);
|
|
53472
|
+
} else if (stanza.is("presence") && ["subscribed", "unsubscribe", "unsubscribed"].includes(stanza.attrs.type ?? "")) {
|
|
53473
|
+
this.session?.log.debug(`ignoring ${stanza.attrs.type} presence from ${stanza.attrs.from}`);
|
|
53446
53474
|
} else if (stanza.is("presence")) {
|
|
53447
53475
|
this.presence(stanza);
|
|
53448
53476
|
} else if (stanza.is("iq")) {
|
|
@@ -53460,6 +53488,10 @@ class IncomingHandlers {
|
|
|
53460
53488
|
const from = stanza.attrs.from;
|
|
53461
53489
|
if (query && (!from || from === this.session?.__bareJid)) {
|
|
53462
53490
|
const entries = query.getChildren("item");
|
|
53491
|
+
const self2 = {
|
|
53492
|
+
id: this.session?.__bareJid ?? "",
|
|
53493
|
+
type: "person"
|
|
53494
|
+
};
|
|
53463
53495
|
for (const e in entries) {
|
|
53464
53496
|
if (!Object.hasOwn(entries, e)) {
|
|
53465
53497
|
continue;
|
|
@@ -53474,13 +53506,9 @@ class IncomingHandlers {
|
|
|
53474
53506
|
name: entries[e].attrs.name,
|
|
53475
53507
|
type: "person"
|
|
53476
53508
|
},
|
|
53477
|
-
target:
|
|
53478
|
-
id: "",
|
|
53479
|
-
type: "person"
|
|
53480
|
-
},
|
|
53509
|
+
target: self2,
|
|
53481
53510
|
object: {
|
|
53482
53511
|
type: "presence",
|
|
53483
|
-
status: "",
|
|
53484
53512
|
presence: getPresence(entries[e])
|
|
53485
53513
|
}
|
|
53486
53514
|
});
|
|
@@ -53493,18 +53521,14 @@ class IncomingHandlers {
|
|
|
53493
53521
|
name: entries[e].attrs.name,
|
|
53494
53522
|
type: "person"
|
|
53495
53523
|
},
|
|
53496
|
-
target:
|
|
53497
|
-
id: "",
|
|
53498
|
-
type: "person"
|
|
53499
|
-
},
|
|
53524
|
+
target: self2,
|
|
53500
53525
|
object: {
|
|
53501
53526
|
type: "presence",
|
|
53502
|
-
statusText: "",
|
|
53503
53527
|
presence: "notauthorized"
|
|
53504
53528
|
}
|
|
53505
53529
|
});
|
|
53506
53530
|
} else {
|
|
53507
|
-
this.subscribe(
|
|
53531
|
+
this.subscribe(self2, entries[e].attrs.jid ?? "", entries[e].attrs.name);
|
|
53508
53532
|
}
|
|
53509
53533
|
}
|
|
53510
53534
|
}
|
|
@@ -53851,7 +53875,7 @@ class XMPP {
|
|
|
53851
53875
|
}
|
|
53852
53876
|
this.log.debug(`make-friend() called for ${job.actor.id}`);
|
|
53853
53877
|
this.__client.send(this.__xml("presence", {
|
|
53854
|
-
type: "
|
|
53878
|
+
type: "subscribed",
|
|
53855
53879
|
to: job.target?.id
|
|
53856
53880
|
})).then(() => done()).catch(done);
|
|
53857
53881
|
}
|
|
@@ -53914,4 +53938,4 @@ export {
|
|
|
53914
53938
|
setTlsServername
|
|
53915
53939
|
};
|
|
53916
53940
|
|
|
53917
|
-
//# debugId=
|
|
53941
|
+
//# debugId=5D52A025A2E831CE64756E2164756E21
|