Compare commits
No commits in common. "v0.1.0-develop.4" and "v0.1.0-develop.3" have entirely different histories.
v0.1.0-dev
...
v0.1.0-dev
|
@ -1,10 +1,3 @@
|
||||||
# [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)
|
# [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)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/publish-webapp",
|
"name": "@lumeweb/publish-webapp",
|
||||||
"version": "0.1.0-develop.4",
|
"version": "0.1.0-develop.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lumeweb/publish-webapp",
|
"name": "@lumeweb/publish-webapp",
|
||||||
"version": "0.1.0-develop.4",
|
"version": "0.1.0-develop.3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lumeweb/libweb": "0.2.0-develop.36",
|
"@lumeweb/libweb": "0.2.0-develop.36",
|
||||||
"@scure/bip39": "^1.2.1",
|
"@scure/bip39": "^1.2.1",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/publish-webapp",
|
"name": "@lumeweb/publish-webapp",
|
||||||
"version": "0.1.0-develop.4",
|
"version": "0.1.0-develop.3",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"bin": "./lib/index.js",
|
"bin": "./lib/index.js",
|
||||||
|
|
18
src/index.ts
18
src/index.ts
|
@ -7,7 +7,6 @@ import {
|
||||||
createNode,
|
createNode,
|
||||||
REGISTRY_TYPES,
|
REGISTRY_TYPES,
|
||||||
S5NodeConfig,
|
S5NodeConfig,
|
||||||
SignedRegistryEntry,
|
|
||||||
} from "@lumeweb/libs5";
|
} from "@lumeweb/libs5";
|
||||||
import KeyPairEd25519 from "@lumeweb/libs5/lib/ed25519.js";
|
import KeyPairEd25519 from "@lumeweb/libs5/lib/ed25519.js";
|
||||||
import fs from "fs/promises";
|
import fs from "fs/promises";
|
||||||
|
@ -21,7 +20,6 @@ import * as util from "util";
|
||||||
import {
|
import {
|
||||||
CID,
|
CID,
|
||||||
concatBytes,
|
concatBytes,
|
||||||
equalBytes,
|
|
||||||
hexToBytes,
|
hexToBytes,
|
||||||
loginActivePortals,
|
loginActivePortals,
|
||||||
maybeInitDefaultPortals,
|
maybeInitDefaultPortals,
|
||||||
|
@ -178,7 +176,6 @@ await peerDefer.promise;
|
||||||
{
|
{
|
||||||
const cidBytes = base58btc.decode(cid);
|
const cidBytes = base58btc.decode(cid);
|
||||||
const key = hdKey as HDKey;
|
const key = hdKey as HDKey;
|
||||||
let sre: SignedRegistryEntry;
|
|
||||||
|
|
||||||
let revision = 0;
|
let revision = 0;
|
||||||
|
|
||||||
|
@ -189,27 +186,20 @@ await peerDefer.promise;
|
||||||
if (ret) {
|
if (ret) {
|
||||||
revision = ret.revision + 1;
|
revision = ret.revision + 1;
|
||||||
}
|
}
|
||||||
|
const sre = node.services.registry.signRegistryEntry({
|
||||||
const newEntry = concatBytes(
|
kp: new KeyPairEd25519((hdKey as HDKey).privateKey),
|
||||||
|
data: concatBytes(
|
||||||
Uint8Array.from([
|
Uint8Array.from([
|
||||||
REGISTRY_TYPES.CID,
|
REGISTRY_TYPES.CID,
|
||||||
CID_TYPES.RESOLVER,
|
CID_TYPES.RESOLVER,
|
||||||
CID_HASH_TYPES.BLAKE3,
|
CID_HASH_TYPES.BLAKE3,
|
||||||
]),
|
]),
|
||||||
cidBytes,
|
cidBytes,
|
||||||
);
|
),
|
||||||
|
|
||||||
if (!equalBytes(ret?.data ?? new Uint8Array(), newEntry)) {
|
|
||||||
sre = node.services.registry.signRegistryEntry({
|
|
||||||
kp: new KeyPairEd25519((hdKey as HDKey).privateKey),
|
|
||||||
data: newEntry,
|
|
||||||
revision,
|
revision,
|
||||||
});
|
});
|
||||||
|
|
||||||
await node.services.registry.set(sre);
|
await node.services.registry.set(sre);
|
||||||
} else {
|
|
||||||
sre = ret as SignedRegistryEntry;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
util.format(
|
util.format(
|
||||||
|
|
Loading…
Reference in New Issue