Compare commits

..

No commits in common. "0a4a8e2009ce3adcd2c350cd8ef76c86bb0366a4" and "b7da837654004fee3e267add35527bab377eaeb1" have entirely different histories.

3 changed files with 12 additions and 27 deletions

View File

@ -4,16 +4,16 @@
- [x] Simple file server
- [x] Serve static files
- [x] Search files
- [x] Preview files
- [ ] Search files
- [ ] Preview files
- [ ] Plugin system
- [ ] Support for multiple languages
- [ ] Support for multiple themes
- [ ] Upload files
- [x] Authentication
- [x] Sort files
- [x] Download files
- [x] SUMMARY.md for index
- [ ] Authentication
- [ ] Sort files
- [ ] Download files
- [ ] DESCRIPTION.md for index
### Usage

View File

@ -5,21 +5,10 @@ import { prepareSecretKey } from "./util/secret.ts";
export const key_out_cmd = new Command();
key_out_cmd.name("keyout")
.description("Output the secret key.")
.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}) => {
.action(async () => {
const key = await prepareSecretKey();
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);
}
const out = await crypto.subtle.exportKey("jwk", key);
console.log(JSON.stringify(out));
});
if ( import.meta.main ){

10
main.ts
View File

@ -17,9 +17,6 @@ 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 = {
@ -48,7 +45,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,
@ -80,11 +77,10 @@ if (import.meta.main){
});
}
)
.command("user", user_command)
.command("keyout", key_out_cmd)
//.command("user")
;
await cmd.parse(Deno.args);
}
else {
await start();
await start({});
}