17 lines
558 B
TypeScript
Executable file
17 lines
558 B
TypeScript
Executable file
#!/usr/bin/env -S deno run -A
|
|
|
|
import { History } from "./lib/history.ts"
|
|
import { pick_name_for } from "./lib/names.ts"
|
|
import { listen } from "./lib/listen.ts"
|
|
import { session } from "./lib/session.ts"
|
|
|
|
const history_limit = 500
|
|
const history_path = "./history.json"
|
|
const port = 4800
|
|
|
|
async function main() {
|
|
const history = await History.load(history_path, history_limit) ?? await History.create(history_path, history_limit)
|
|
listen(port, (conn) => session(conn, pick_name_for(conn.remoteAddr.hostname), history))
|
|
}
|
|
|
|
if (import.meta.main) await main()
|