Compare commits

...

3 Commits

Author SHA1 Message Date
semantic-release-bot 329ab925ce chore(release): 0.1.0-develop.4 [skip ci]
# [0.1.0-develop.4](https://git.lumeweb.com/LumeWeb/publish-webapp/compare/v0.1.0-develop.3...v0.1.0-develop.4) (2023-09-02)

### Bug Fixes

* only submit a new registry entry if the data has changed ([421cf81](421cf81f36))
2023-09-02 12:59:15 +00:00
Derrick Hammer f26fa8a6a9
Merge remote-tracking branch 'origin/develop' into develop 2023-09-02 08:58:22 -04:00
Derrick Hammer 421cf81f36
fix: only submit a new registry entry if the data has changed 2023-09-02 08:58:18 -04:00
4 changed files with 33 additions and 16 deletions

View File

@ -1,3 +1,10 @@
# [0.1.0-develop.4](https://git.lumeweb.com/LumeWeb/publish-webapp/compare/v0.1.0-develop.3...v0.1.0-develop.4) (2023-09-02)
### Bug Fixes
* only submit a new registry entry if the data has changed ([421cf81](https://git.lumeweb.com/LumeWeb/publish-webapp/commit/421cf81f362455b607373097a4173eda5780f060))
# [0.1.0-develop.3](https://git.lumeweb.com/LumeWeb/publish-webapp/compare/v0.1.0-develop.2...v0.1.0-develop.3) (2023-09-02)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@lumeweb/publish-webapp",
"version": "0.1.0-develop.3",
"version": "0.1.0-develop.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/publish-webapp",
"version": "0.1.0-develop.3",
"version": "0.1.0-develop.4",
"dependencies": {
"@lumeweb/libweb": "0.2.0-develop.36",
"@scure/bip39": "^1.2.1",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/publish-webapp",
"version": "0.1.0-develop.3",
"version": "0.1.0-develop.4",
"type": "module",
"main": "lib/index.js",
"bin": "./lib/index.js",

View File

@ -7,6 +7,7 @@ import {
createNode,
REGISTRY_TYPES,
S5NodeConfig,
SignedRegistryEntry,
} from "@lumeweb/libs5";
import KeyPairEd25519 from "@lumeweb/libs5/lib/ed25519.js";
import fs from "fs/promises";
@ -20,6 +21,7 @@ import * as util from "util";
import {
CID,
concatBytes,
equalBytes,
hexToBytes,
loginActivePortals,
maybeInitDefaultPortals,
@ -176,6 +178,7 @@ await peerDefer.promise;
{
const cidBytes = base58btc.decode(cid);
const key = hdKey as HDKey;
let sre: SignedRegistryEntry;
let revision = 0;
@ -186,20 +189,27 @@ await peerDefer.promise;
if (ret) {
revision = ret.revision + 1;
}
const sre = node.services.registry.signRegistryEntry({
kp: new KeyPairEd25519((hdKey as HDKey).privateKey),
data: concatBytes(
Uint8Array.from([
REGISTRY_TYPES.CID,
CID_TYPES.RESOLVER,
CID_HASH_TYPES.BLAKE3,
]),
cidBytes,
),
revision,
});
await node.services.registry.set(sre);
const newEntry = concatBytes(
Uint8Array.from([
REGISTRY_TYPES.CID,
CID_TYPES.RESOLVER,
CID_HASH_TYPES.BLAKE3,
]),
cidBytes,
);
if (!equalBytes(ret?.data ?? new Uint8Array(), newEntry)) {
sre = node.services.registry.signRegistryEntry({
kp: new KeyPairEd25519((hdKey as HDKey).privateKey),
data: newEntry,
revision,
});
await node.services.registry.set(sre);
} else {
sre = ret as SignedRegistryEntry;
}
console.log(
util.format(