Compare commits
No commits in common. "1b876bb78f1f434ec0a76496cf2be9a56064157b" and "4264ca099e420bf6d6d2fa295c17626baecde6d0" have entirely different histories.
1b876bb78f
...
4264ca099e
23
src/index.ts
23
src/index.ts
|
@ -91,7 +91,10 @@ const plugin: Plugin = {
|
||||||
api = _api;
|
api = _api;
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
if (api.pluginConfig.bool("store.memory")) {
|
if (
|
||||||
|
api.pluginConfig.bool("storememory") &&
|
||||||
|
!api.pluginConfig.bool("store")
|
||||||
|
) {
|
||||||
memStore = new NodeCache();
|
memStore = new NodeCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,15 +111,15 @@ const plugin: Plugin = {
|
||||||
}
|
}
|
||||||
let entry = (await getEntry(newEntry.pk)) as SignedRegistryEntry;
|
let entry = (await getEntry(newEntry.pk)) as SignedRegistryEntry;
|
||||||
|
|
||||||
async function setAndRespond(entry: SignedRegistryEntry) {
|
async function setAndRespond() {
|
||||||
await setEntry(newEntry);
|
await setEntry(newEntry);
|
||||||
sendDirectOrBroadcast(
|
sendDirectOrBroadcast(
|
||||||
Message.create({
|
Message.create({
|
||||||
type: MessageType.CREATED,
|
type: MessageType.CREATED,
|
||||||
pubkey: entry.pk,
|
pubkey: newEntry.pk,
|
||||||
revision: entry.revision,
|
revision: newEntry.revision,
|
||||||
signature: entry.signature,
|
signature: newEntry.signature,
|
||||||
data: entry.data,
|
data: newEntry.data,
|
||||||
}),
|
}),
|
||||||
origin
|
origin
|
||||||
);
|
);
|
||||||
|
@ -124,13 +127,11 @@ const plugin: Plugin = {
|
||||||
|
|
||||||
if (entry) {
|
if (entry) {
|
||||||
if (newEntry.revision <= entry.revision) {
|
if (newEntry.revision <= entry.revision) {
|
||||||
setAndRespond(newEntry);
|
setAndRespond();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
setAndRespond(entry);
|
} else {
|
||||||
return;
|
setAndRespond();
|
||||||
}
|
}
|
||||||
setAndRespond(newEntry);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
events.on("query", async (query: Query, origin: Buffer) => {
|
events.on("query", async (query: Query, origin: Buffer) => {
|
||||||
|
|
Reference in New Issue