Skip to content

Commit 7723efa

Browse files
committed
demo link; version info; better ingest
1 parent 03b8184 commit 7723efa

File tree

4 files changed

+76
-28
lines changed

4 files changed

+76
-28
lines changed

README.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ delivery, and easily hosted on static blogs (Hugo, Jekyll, etc).
88
You encrypt and manage your files locally, then deploy the encrypted vault. A lightweight
99
browser-based app (included) allows in-browser decryption and previews of text and images.
1010

11+
[Demo vault](https://sean.fun/staticvault-demo/) (password: `hello`).
12+
1113
Features
1214
--------
1315

14-
- 💾 Encrypt files locally
15-
- 🌐 Host anywhere: S3, Netlify, GitHub Pages, etc
16-
- 🖼️ In-browser decryption and preview for text/images
17-
- 🗂️ CLI for creating, ingesting, listing, and extracting files
16+
- Encrypt files locally
17+
- Host anywhere: S3, Netlify, GitHub Pages, etc
18+
- In-browser decryption and preview for text/images
19+
- Share a subset of your files/folders with friends (no server needed!)
20+
- CLI for creating, ingesting, listing, and extracting files
1821

1922
Quick Start
2023
-----------
@@ -23,7 +26,7 @@ You don't need to install anything globally - just use `npx`:
2326

2427
```bash
2528
npx staticvault init path/to/vault
26-
npx staticvault ingest path/to/files path/to/vault
29+
npx staticvault ingest path/to/vault path/to/files
2730
```
2831

2932
Then upload the contents of `path/to/vault` to your static site host.
@@ -51,7 +54,7 @@ npx staticvault init <vault> [-p password] [-d difficulty]
5154
Encrypt and add files to an existing vault.
5255

5356
```bash
54-
npx staticvault ingest <source> <vault> [-p password]
57+
npx staticvault ingest <vault> <source> [-p password]
5558
```
5659

5760
## `dump`
@@ -86,13 +89,21 @@ Run internal tests.
8689
npx staticvault test
8790
```
8891

92+
## `version`
93+
94+
Output version
95+
96+
```bash
97+
npx staticvault version
98+
```
99+
89100
Example Workflow
90101
----------------
91102

92103
```bash
93-
npx staticvault init myvault -p mypassword
94-
npx staticvault ingest ./blog-attachments myvault -p mypassword
95-
npx staticvault tree myvault -p mypassword
104+
npx staticvault init myvault
105+
npx staticvault ingest myvault ./blog-attachments
106+
npx staticvault tree myvault
96107
```
97108

98109
Then upload the contents of `myvault/` to your static host.

dist/cli.js

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -833,12 +833,12 @@ Current command:`);
833833
}
834834
if (!filter || filter === "ingest") {
835835
console.log(`
836-
- ingest <source> <vault> [-p password]
836+
- ingest <vault> <source> [-p password]
837837
838838
Encrypt and copy source folders/files into vault
839839
840-
<source> Source directory
841840
<vault> Vault directory
841+
<source> Source directory
842842
[-p password] Encryption password`);
843843
}
844844
if (!filter || filter === "init") {
@@ -876,6 +876,12 @@ Current command:`);
876876
<vault> Vault directory
877877
[-p password] Encryption password`);
878878
}
879+
if (!filter || filter === "version") {
880+
console.log(`
881+
- version
882+
883+
Output version of staticvault`);
884+
}
879885
}
880886
function promptPassword(prompt) {
881887
const cmd = `read -s -p "${prompt}: " pwd && echo $pwd`;
@@ -968,8 +974,8 @@ Missing destination directory`);
968974
return 0;
969975
}
970976
async function cmdIngest(args) {
971-
let source = null;
972977
let target = null;
978+
let source = null;
973979
let password = null;
974980
for (; ; ) {
975981
const arg = args.shift();
@@ -990,27 +996,27 @@ Missing password`);
990996
Cannot specify password more than once`);
991997
return 1;
992998
}
993-
} else if (source === null) {
994-
source = arg;
995999
} else if (target === null) {
9961000
target = arg;
1001+
} else if (source === null) {
1002+
source = arg;
9971003
} else {
9981004
printUsage("ingest");
9991005
console.error(`
10001006
Unknown argument: ${arg}`);
10011007
return 1;
10021008
}
10031009
}
1004-
if (source === null) {
1010+
if (target === null) {
10051011
printUsage("ingest");
10061012
console.error(`
1007-
Missing source directory`);
1013+
Missing vault directory`);
10081014
return 1;
10091015
}
1010-
if (target === null) {
1016+
if (source === null) {
10111017
printUsage("ingest");
10121018
console.error(`
1013-
Missing vault directory`);
1019+
Missing source directory`);
10141020
return 1;
10151021
}
10161022
if (password === null) {
@@ -1446,6 +1452,16 @@ Missing vault directory`);
14461452
await walk(0);
14471453
return 0;
14481454
}
1455+
async function cmdVersion(args) {
1456+
const data = await fs2.readFile(path.join(__dirname, "..", "package.json"), { encoding: "utf8" });
1457+
const pack = JSON.parse(data);
1458+
console.log(`StaticVault v${pack.version}
1459+
Encrypt, host, and share files on a static website
1460+
by Sean Connelly (@velipso), https://sean.fun
1461+
Project Home: https://github.com/velipso/staticvault
1462+
SPDX-License-Identifier: 0BSD`);
1463+
return 0;
1464+
}
14491465
async function main(args) {
14501466
if (args.length <= 0) {
14511467
printUsage();
@@ -1465,6 +1481,8 @@ async function main(args) {
14651481
return cmdTest(args);
14661482
case "tree":
14671483
return cmdTree(args);
1484+
case "version":
1485+
return cmdVersion(args);
14681486
default:
14691487
printUsage();
14701488
console.error(`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "staticvault",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"author": "velipso",
55
"license": "0BSD",
66
"type": "module",

src/cli.ts

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ function printUsage(filter?: string) {
3737
}
3838
if (!filter || filter === 'ingest') {
3939
console.log(`
40-
- ingest <source> <vault> [-p password]
40+
- ingest <vault> <source> [-p password]
4141
4242
Encrypt and copy source folders/files into vault
4343
44-
<source> Source directory
4544
<vault> Vault directory
45+
<source> Source directory
4646
[-p password] Encryption password`);
4747
}
4848
if (!filter || filter === 'init') {
@@ -80,6 +80,12 @@ function printUsage(filter?: string) {
8080
<vault> Vault directory
8181
[-p password] Encryption password`);
8282
}
83+
if (!filter || filter === 'version') {
84+
console.log(`
85+
- version
86+
87+
Output version of staticvault`);
88+
}
8389
}
8490

8591
function promptPassword(prompt: string): string {
@@ -173,8 +179,8 @@ async function cmdDump(args: string[]): Promise<number> {
173179
}
174180

175181
async function cmdIngest(args: string[]): Promise<number> {
176-
let source: string | null = null;
177182
let target: string | null = null;
183+
let source: string | null = null;
178184
let password: string | null = null;
179185
for (;;) {
180186
const arg = args.shift();
@@ -193,24 +199,24 @@ async function cmdIngest(args: string[]): Promise<number> {
193199
console.error(`\nCannot specify password more than once`);
194200
return 1;
195201
}
196-
} else if (source === null) {
197-
source = arg;
198202
} else if (target === null) {
199203
target = arg;
204+
} else if (source === null) {
205+
source = arg;
200206
} else {
201207
printUsage('ingest');
202208
console.error(`\nUnknown argument: ${arg}`);
203209
return 1;
204210
}
205211
}
206-
if (source === null) {
212+
if (target === null) {
207213
printUsage('ingest');
208-
console.error(`\nMissing source directory`);
214+
console.error(`\nMissing vault directory`);
209215
return 1;
210216
}
211-
if (target === null) {
217+
if (source === null) {
212218
printUsage('ingest');
213-
console.error(`\nMissing vault directory`);
219+
console.error(`\nMissing source directory`);
214220
return 1;
215221
}
216222
if (password === null) {
@@ -656,6 +662,17 @@ async function cmdTree(args: string[]): Promise<number> {
656662
return 0;
657663
}
658664

665+
async function cmdVersion(args: string[]): Promise<number> {
666+
const data = await fs.readFile(path.join(__dirname, '..', 'package.json'), { encoding: 'utf8' });
667+
const pack = JSON.parse(data);
668+
console.log(`StaticVault v${pack.version}
669+
Encrypt, host, and share files on a static website
670+
by Sean Connelly (@velipso), https://sean.fun
671+
Project Home: https://github.com/velipso/staticvault
672+
SPDX-License-Identifier: 0BSD`);
673+
return 0;
674+
}
675+
659676
async function main(args: string[]): Promise<number> {
660677
if (args.length <= 0) {
661678
printUsage();
@@ -675,6 +692,8 @@ async function main(args: string[]): Promise<number> {
675692
return cmdTest(args);
676693
case 'tree':
677694
return cmdTree(args);
695+
case 'version':
696+
return cmdVersion(args);
678697
default:
679698
printUsage();
680699
console.error(`\nUnknown command: ${cmd}`);

0 commit comments

Comments
 (0)