Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update bonjour-service to v1.2.1 #475

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -119,7 +119,7 @@
"better-sqlite3": "^8.7.0",
"big-sparse-array": "^1.0.3",
"bogon": "^1.1.0",
"bonjour-service": "^1.1.1",
"bonjour-service": "^1.2.1",
"compact-encoding": "^2.12.0",
"corestore": "^6.8.4",
"debug": "^4.3.4",
116 changes: 0 additions & 116 deletions patches/bonjour-service+1.1.1.patch

This file was deleted.

77 changes: 77 additions & 0 deletions patches/bonjour-service+1.2.1.patch
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
diff --git a/node_modules/bonjour-service/dist/lib/registry.js b/node_modules/bonjour-service/dist/lib/registry.js
index 5462ca2..662486d 100644
--- a/node_modules/bonjour-service/dist/lib/registry.js
+++ b/node_modules/bonjour-service/dist/lib/registry.js
@@ -15,14 +15,18 @@ class Registry {
this.server = server;
}
publish(config) {
- function start(service, registry, opts) {
+ const configProbe = config.probe !== false;
+
+ const service = new service_1.default(config, start.bind(null, this), stop.bind(null, this));
+
+ function start(registry, { probe = configProbe } = {}) {
if (service.activated)
return;
service.activated = true;
registry.services.push(service);
if (!(service instanceof service_1.default))
return;
- if (opts === null || opts === void 0 ? void 0 : opts.probe) {
+ if (probe) {
registry.probe(registry.server.mdns, service, (exists) => {
if (exists) {
if (service.stop !== undefined)
@@ -37,7 +41,7 @@ class Registry {
registry.announce(registry.server, service);
}
}
- function stop(service, registry, callback) {
+ function stop(registry, callback) {
if (!callback)
callback = noop;
if (!service.activated)
@@ -49,10 +53,7 @@ class Registry {
if (index !== -1)
registry.services.splice(index, 1);
}
- const service = new service_1.default(config);
- service.start = start.bind(null, service, this);
- service.stop = stop.bind(null, service, this);
- service.start({ probe: config.probe !== false });
+ service.start();
return service;
}
unpublishAll(callback) {
diff --git a/node_modules/bonjour-service/dist/lib/service.d.ts b/node_modules/bonjour-service/dist/lib/service.d.ts
index 2c711f9..c459a07 100644
--- a/node_modules/bonjour-service/dist/lib/service.d.ts
+++ b/node_modules/bonjour-service/dist/lib/service.d.ts
@@ -41,8 +41,8 @@ export declare class Service extends EventEmitter {
published: boolean;
activated: boolean;
destroyed: boolean;
- start?: CallableFunction;
- stop?: CallableFunction;
+ start: CallableFunction;
+ stop: CallableFunction;
private txtService;
constructor(config: ServiceConfig);
records(): Array<ServiceRecord>;
diff --git a/node_modules/bonjour-service/dist/lib/service.js b/node_modules/bonjour-service/dist/lib/service.js
index 41da95a..ac71665 100644
--- a/node_modules/bonjour-service/dist/lib/service.js
+++ b/node_modules/bonjour-service/dist/lib/service.js
@@ -10,8 +10,10 @@ const events_1 = require("events");
const service_types_1 = require("./service-types");
const TLD = '.local';
class Service extends events_1.EventEmitter {
- constructor(config) {
+ constructor(config, start, stop) {
super();
+ this.start = start;
+ this.stop = stop;
this.probe = true;
this.published = false;
this.activated = false;
2 changes: 1 addition & 1 deletion src/discovery/dns-sd.js
Original file line number Diff line number Diff line change
@@ -119,7 +119,7 @@ export class DnsSd extends TypedEmitter {
host: this.#name + '.local',
port,
type: SERVICE_NAME,
disableIpv6: this.#disableIpv6,
disableIPv6: this.#disableIpv6,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our old patch used a slightly different name than the "real" version upstream.

})
}
this.#advertisingStarting = once(this.#service, 'up')
Loading