Skip to content

Commit 8238a75

Browse files
committed
config section added
1 parent 05fa0c4 commit 8238a75

39 files changed

+481
-281
lines changed

api/qwer/oplog

-8 KB
Binary file not shown.

api/stores.js

+14-12
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const dbs = []
66

77
const prepDb = async (name) => {
88
if (dbs[name]) return dbs[name];
9-
const core = new Hypercore('./' + name)
9+
const core = new Hypercore('../db/' + name)
1010
await core.ready()
1111
const db = new Hyperbee(core, { keyEncoding: 'utf-8', valueEncoding: 'binary' })
1212
dbs[name] = db;
@@ -19,7 +19,7 @@ const prepDb = async (name) => {
1919
const init = () => {
2020

2121
const save = async (req, res) => {
22-
const db = await prepDb('./' + req.params.db)
22+
const db = await prepDb(req.params.db)
2323
console.log(req.body, req.params)
2424
await db.put(req.params.name, JSON.stringify(req.body))
2525
res.write(`{"success":"true"}`)
@@ -28,19 +28,21 @@ const init = () => {
2828

2929
const key = async (req, res) => {
3030
console.log('key')
31-
const db = await prepDb('./' + req.params.db)
32-
const out = db.core.key
33-
console.log({publicKey:out.toString('hex')})
34-
res.write(JSON.stringify({publicKey:out.toString('hex')}))
35-
res.status(200).end()
31+
const db = await prepDb(req.params.db)
32+
const out = db.core.key
33+
console.log({ publicKey: out.toString('hex') })
34+
res.write(JSON.stringify({ publicKey: out.toString('hex') }))
35+
res.status(200).end()
3636
}
3737
const load = async (req, res) => {
3838
console.log('load')
39-
const db = await prepDb('./' + req.params.db)
39+
const db = await prepDb(req.params.db)
40+
console.log(req.params.db, 'prepped')
4041
try {
42+
console.log(req.params.name, 'fetching')
4143
const lookup = await db.get(req.params.name);
42-
console.log(lookup.value.toString('utf-8'))
43-
res.write(lookup.value)
44+
console.log(lookup)
45+
res.write(lookup ? lookup.value : `{ "error": "not found" }`)
4446
res.status(200).end();
4547
} catch (e) {
4648
console.error(e);
@@ -52,12 +54,12 @@ const init = () => {
5254
};
5355
const loadAll = async (req, res) => {
5456
console.log('loadAll')
55-
const db = await prepDb('./' + req.params.db)
57+
const db = await prepDb(req.params.db)
5658
try {
5759
const lookup = { values: {} };
5860
for await (const node of db.createReadStream()) {
5961
console.log(node)
60-
lookup.values[node.key] =node.value.toString()
62+
lookup.values[node.key] = node.value.toString()
6163
}
6264
console.log(lookup)
6365
res.write(JSON.stringify(lookup))

api/task/bitfield

-4 KB
Binary file not shown.

api/task/data

-81
This file was deleted.

api/task/oplog

-8.26 KB
Binary file not shown.

api/task/tree

-1.91 KB
Binary file not shown.

api/tasks/data

-17
This file was deleted.

api/tasks/oplog

-8 KB
Binary file not shown.

api/tasks/tree

-440 Bytes
Binary file not shown.

api/test/oplog

-8 KB
Binary file not shown.

api/vcxz/oplog

-8 KB
Binary file not shown.

api/zxcv/oplog

-8 KB
Binary file not shown.
4 KB
Binary file not shown.

db/task/data

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
hyperbee
3+

4+

5+
test�[{"name":"test","before":"console.log('before:', params);","after":"console.log('after', out);","output":[],"sub":{"publicKey":"6dad715dc12d7d4d7b10054f7aada631143e023c3dbeddd5e96bbcc351a5697d"}}]

api/asdf/oplog db/task/oplog

8 KB
Binary file not shown.

db/task/tree

40 Bytes
Binary file not shown.

api/undefined/oplog db/test/oplog

8 KB
Binary file not shown.

gui/src/lib/clickToCopy.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const copy = async (text) => {
2+
await navigator.clipboard.writeText(text);
3+
}
4+
export {
5+
copy,
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script lang="ts">
2+
import { cn } from "$lib/utils";
3+
import type { HTMLAttributes } from "svelte/elements";
4+
5+
type $$Props = HTMLAttributes<HTMLDivElement>;
6+
7+
let className: $$Props["class"] = undefined;
8+
export { className as class };
9+
</script>
10+
11+
<div class={cn("p-6 pt-0", className)} {...$$restProps}>
12+
<slot />
13+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script lang="ts">
2+
import type { HTMLAttributes } from "svelte/elements";
3+
import { cn } from "$lib/utils";
4+
5+
type $$Props = HTMLAttributes<HTMLParagraphElement>;
6+
7+
let className: $$Props["class"] = undefined;
8+
export { className as class };
9+
</script>
10+
11+
<p class={cn("text-sm text-muted-foreground", className)} {...$$restProps}>
12+
<slot />
13+
</p>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script lang="ts">
2+
import type { HTMLAttributes } from "svelte/elements";
3+
import { cn } from "$lib/utils";
4+
5+
type $$Props = HTMLAttributes<HTMLDivElement>;
6+
7+
let className: $$Props["class"] = undefined;
8+
export { className as class };
9+
</script>
10+
11+
<div class={cn("flex items-center p-6 pt-0", className)} {...$$restProps}>
12+
<slot />
13+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script lang="ts">
2+
import type { HTMLAttributes } from "svelte/elements";
3+
import { cn } from "$lib/utils";
4+
5+
type $$Props = HTMLAttributes<HTMLDivElement>;
6+
7+
let className: $$Props["class"] = undefined;
8+
export { className as class };
9+
</script>
10+
11+
<div class={cn("flex flex-col space-y-1.5 p-6", className)} {...$$restProps}>
12+
<slot />
13+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<script lang="ts">
2+
import type { HTMLAttributes } from "svelte/elements";
3+
import { cn } from "$lib/utils";
4+
import type { HeadingLevel } from ".";
5+
6+
type $$Props = HTMLAttributes<HTMLHeadingElement> & {
7+
tag?: HeadingLevel;
8+
};
9+
10+
let className: $$Props["class"] = undefined;
11+
export let tag: $$Props["tag"] = "h3";
12+
export { className as class };
13+
</script>
14+
15+
<svelte:element
16+
this={tag}
17+
class={cn("text-lg font-semibold leading-none tracking-tight", className)}
18+
{...$$restProps}
19+
>
20+
<slot />
21+
</svelte:element>
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<script lang="ts">
2+
import type { HTMLAttributes } from "svelte/elements";
3+
import { cn } from "$lib/utils";
4+
5+
type $$Props = HTMLAttributes<HTMLDivElement>;
6+
7+
let className: $$Props["class"] = undefined;
8+
export { className as class };
9+
</script>
10+
11+
<div
12+
class={cn(
13+
"rounded-lg border bg-card text-card-foreground shadow-sm",
14+
className
15+
)}
16+
{...$$restProps}
17+
>
18+
<slot />
19+
</div>
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import Root from "./card.svelte";
2+
import Content from "./card-content.svelte";
3+
import Description from "./card-description.svelte";
4+
import Footer from "./card-footer.svelte";
5+
import Header from "./card-header.svelte";
6+
import Title from "./card-title.svelte";
7+
8+
export {
9+
Root,
10+
Content,
11+
Description,
12+
Footer,
13+
Header,
14+
Title,
15+
//
16+
Root as Card,
17+
Content as CardContent,
18+
Description as CardDescription,
19+
Footer as CardFooter,
20+
Header as CardHeader,
21+
Title as CardTitle
22+
};
23+
24+
export type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";

gui/src/lib/seed.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,9 @@ const setKeyFromSeed = (seed) => {
3030
rootKey = crypto.keyPair(crypto.data(b4a.from(seed)))
3131
setKey(rootKey)
3232
}
33+
const set = (key) => {
34+
rootKey.publicKey = key.publicKey
35+
rootKey.secretKey = key.secretKey
36+
}
3337

34-
export { rootKey, setKeyFromSeed };
38+
export { rootKey, setKeyFromSeed, set };

gui/src/routes/+layout.svelte

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
/></svg
6969
>Stores
7070
</a>
71+
<a href="/configuration"> ⚙️ Configuration </a>
7172
</nav>
7273
<div class="w-full h-full">
7374
<slot />
File renamed without changes.

0 commit comments

Comments
 (0)