Compare commits
4 Commits
v0.1.0-dev
...
v0.1.0-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | 750a3bafd4 | |
Derrick Hammer | 49eb1bab8a | |
Derrick Hammer | 51618dfaf3 | |
Derrick Hammer | 632eb1351c |
|
@ -1,3 +1,11 @@
|
||||||
|
# [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.1",
|
"version": "0.1.0-develop.2",
|
||||||
"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.1",
|
"version": "0.1.0-develop.2",
|
||||||
"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.1",
|
"version": "0.1.0-develop.2",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"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,14 +4,20 @@ 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 { string } from "micro-packed";
|
import * as fs from "fs/promises";
|
||||||
|
|
||||||
const plugin = {
|
const plugin = {
|
||||||
name: "s5",
|
name: "s5",
|
||||||
async plugin(api: PluginAPI) {
|
async plugin(api: PluginAPI) {
|
||||||
const db = new Level<string, Uint8Array>(
|
const dbPath = api.pluginConfig.str("db") as string;
|
||||||
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