shogun-core 4.0.2 → 4.0.4
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.
|
@@ -148187,25 +148187,22 @@ class CoreInitializer {
|
|
|
148187
148187
|
/**
|
|
148188
148188
|
* Initialize Gun instance
|
|
148189
148189
|
*/
|
|
148190
|
+
// Sì, è corretto.
|
|
148190
148191
|
async initializeGun(config) {
|
|
148191
148192
|
try {
|
|
148192
148193
|
let peers = await (0, shogun_relays_1.forceListUpdate)();
|
|
148193
|
-
if (config.gunOptions?.peers && config.
|
|
148194
|
+
if (!config.gunOptions?.peers && !config.gunInstance) {
|
|
148195
|
+
console.log("Using peers from forceListUpdate", peers);
|
|
148194
148196
|
config.gunOptions.peers = peers;
|
|
148195
148197
|
}
|
|
148196
|
-
if (config.gunInstance
|
|
148198
|
+
if (config.gunInstance) {
|
|
148197
148199
|
this.core._gun = config.gunInstance;
|
|
148198
148200
|
}
|
|
148199
148201
|
else if (config.gunOptions && config.gunInstance === undefined) {
|
|
148200
148202
|
this.core._gun = (0, gundb_1.createGun)(config.gunOptions);
|
|
148201
148203
|
}
|
|
148202
148204
|
else if (config.gunInstance && config.gunOptions) {
|
|
148203
|
-
|
|
148204
|
-
}
|
|
148205
|
-
else {
|
|
148206
|
-
this.core._gun = (0, gundb_1.createGun)({
|
|
148207
|
-
peers: config.gunOptions?.peers || peers,
|
|
148208
|
-
});
|
|
148205
|
+
throw new Error("Gun instance and gun options cannot be provided together");
|
|
148209
148206
|
}
|
|
148210
148207
|
}
|
|
148211
148208
|
catch (error) {
|