Compare commits
3 Commits
b7da837654
...
0a4a8e2009
Author | SHA1 | Date | |
---|---|---|---|
0a4a8e2009 | |||
94b624f312 | |||
b5a1ab29bc |
12
README.md
12
README.md
@ -4,16 +4,16 @@
|
||||
|
||||
- [x] Simple file server
|
||||
- [x] Serve static files
|
||||
- [ ] Search files
|
||||
- [ ] Preview files
|
||||
- [x] Search files
|
||||
- [x] Preview files
|
||||
- [ ] Plugin system
|
||||
- [ ] Support for multiple languages
|
||||
- [ ] Support for multiple themes
|
||||
- [ ] Upload files
|
||||
- [ ] Authentication
|
||||
- [ ] Sort files
|
||||
- [ ] Download files
|
||||
- [ ] DESCRIPTION.md for index
|
||||
- [x] Authentication
|
||||
- [x] Sort files
|
||||
- [x] Download files
|
||||
- [x] SUMMARY.md for index
|
||||
|
||||
### Usage
|
||||
|
||||
|
17
keyout.ts
17
keyout.ts
@ -5,10 +5,21 @@ import { prepareSecretKey } from "./util/secret.ts";
|
||||
export const key_out_cmd = new Command();
|
||||
key_out_cmd.name("keyout")
|
||||
.description("Output the secret key.")
|
||||
.action(async () => {
|
||||
.option("-f, --file <file:string>", "The file to output the key to. (default: stdout)")
|
||||
.option("--dotenv", "Output the key in dotenv format.")
|
||||
.action(async ({file, dotenv}) => {
|
||||
const key = await prepareSecretKey();
|
||||
const out = await crypto.subtle.exportKey("jwk", key);
|
||||
console.log(JSON.stringify(out));
|
||||
const keyout = await crypto.subtle.exportKey("jwk", key);
|
||||
let out = JSON.stringify(keyout);
|
||||
if (dotenv){
|
||||
out = [`SECRET_KEY='${out}'`].join("\n");
|
||||
}
|
||||
|
||||
if (file){
|
||||
await Deno.writeTextFile(file, out);
|
||||
} else {
|
||||
console.log(out);
|
||||
}
|
||||
});
|
||||
|
||||
if ( import.meta.main ){
|
||||
|
10
main.ts
10
main.ts
@ -17,6 +17,9 @@ import { fromFileUrl, join } from "path/mod.ts";
|
||||
import { prepareSecretKey } from "./util/secret.ts";
|
||||
import { serve } from "http/server.ts";
|
||||
|
||||
import { user_command } from "./user.ts";
|
||||
import { key_out_cmd } from "./keyout.ts";
|
||||
|
||||
const github_markdown= await Deno.readTextFile(join(fromFileUrl(import.meta.url), "..", "static", "github-markdown.css"))
|
||||
|
||||
const CSSPlugin: Plugin = {
|
||||
@ -45,7 +48,7 @@ async function startServer(manifest: Manifest, options: StartOptions = {}){
|
||||
}
|
||||
}
|
||||
|
||||
async function start({port = 8000, hostname = "localhost"}: {port?: number, hostname?: string}){
|
||||
async function start({port = 8000, hostname = "localhost"}: {port?: number, hostname?: string} = {}){
|
||||
await startServer(manifest, { plugins: [twindPlugin(twindConfig), CSSPlugin],
|
||||
port: port,
|
||||
hostname: hostname,
|
||||
@ -77,10 +80,11 @@ if (import.meta.main){
|
||||
});
|
||||
}
|
||||
)
|
||||
//.command("user")
|
||||
.command("user", user_command)
|
||||
.command("keyout", key_out_cmd)
|
||||
;
|
||||
await cmd.parse(Deno.args);
|
||||
}
|
||||
else {
|
||||
await start({});
|
||||
await start();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user