Compare commits
No commits in common. "v0.1.0-develop.2" and "v0.1.0-develop.1" have entirely different histories.
v0.1.0-dev
...
v0.1.0-dev
|
@ -1,11 +1,3 @@
|
||||||
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.1.0-develop.1...v0.1.0-develop.2) (2023-08-31)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* ensure db path exists, create if not ([632eb13](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/commit/632eb1351c92825c10681487efc7cfa3f5cebac6))
|
|
||||||
* set default db path ([51618df](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/commit/51618dfaf38c4dc9ad70fc6a76ca11ef37fad0f5))
|
|
||||||
|
|
||||||
# [0.1.0-develop.1](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.0.1...v0.1.0-develop.1) (2023-08-31)
|
# [0.1.0-develop.1](https://git.lumeweb.com/LumeWeb/relay-plugin-s5/compare/v0.0.1...v0.1.0-develop.1) (2023-08-31)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/relay-plugin-s5",
|
"name": "@lumeweb/relay-plugin-s5",
|
||||||
"version": "0.1.0-develop.2",
|
"version": "0.1.0-develop.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lumeweb/relay-plugin-s5",
|
"name": "@lumeweb/relay-plugin-s5",
|
||||||
"version": "0.1.0-develop.2",
|
"version": "0.1.0-develop.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lumeweb/interface-relay": "^0.0.2-develop.3",
|
"@lumeweb/interface-relay": "^0.0.2-develop.3",
|
||||||
"@lumeweb/libs5": "^0.1.0-develop.9",
|
"@lumeweb/libs5": "^0.1.0-develop.9",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/relay-plugin-s5",
|
"name": "@lumeweb/relay-plugin-s5",
|
||||||
"version": "0.1.0-develop.2",
|
"version": "0.1.0-develop.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
{
|
{
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"s5": {
|
"s5": {
|
||||||
"db": "/etc/lumeweb/relay/plugins/s5/db",
|
|
||||||
"p2p": {
|
"p2p": {
|
||||||
"peers": {
|
"peers": {
|
||||||
"initial": [
|
"initial": [
|
||||||
|
|
14
src/index.ts
14
src/index.ts
|
@ -4,20 +4,14 @@ import { Level } from "level";
|
||||||
import { PROTOCOL } from "./constants.js";
|
import { PROTOCOL } from "./constants.js";
|
||||||
import HyperTransportPeer from "./hyperTransport.js";
|
import HyperTransportPeer from "./hyperTransport.js";
|
||||||
import { NodeId } from "@lumeweb/libs5";
|
import { NodeId } from "@lumeweb/libs5";
|
||||||
import * as fs from "fs/promises";
|
import { string } from "micro-packed";
|
||||||
|
|
||||||
const plugin = {
|
const plugin = {
|
||||||
name: "s5",
|
name: "s5",
|
||||||
async plugin(api: PluginAPI) {
|
async plugin(api: PluginAPI) {
|
||||||
const dbPath = api.pluginConfig.str("db") as string;
|
const db = new Level<string, Uint8Array>(
|
||||||
|
api.pluginConfig.str("db") as string,
|
||||||
try {
|
);
|
||||||
await fs.access(dbPath);
|
|
||||||
} catch {
|
|
||||||
await fs.mkdir(dbPath, { recursive: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
const db = new Level<string, Uint8Array>(dbPath);
|
|
||||||
await db.open();
|
await db.open();
|
||||||
let config = {
|
let config = {
|
||||||
keyPair: createKeyPair(api.identity.publicKeyRaw),
|
keyPair: createKeyPair(api.identity.publicKeyRaw),
|
||||||
|
|
Loading…
Reference in New Issue