some stuff
This commit is contained in:
parent
e88627693c
commit
dda1cc1f21
|
|
@ -5,7 +5,6 @@ import { readdirSync } from "fs"
|
|||
import { join, extname } from "path"
|
||||
|
||||
import type { CommandOutput } from "@/shared/types"
|
||||
import { NOSE_WWW } from "@/config"
|
||||
import { isBinaryFile } from "@/utils"
|
||||
import { projectName, projectDir } from "@/project"
|
||||
import { sessionGet } from "@/session"
|
||||
|
|
@ -21,10 +20,6 @@ export default async function (path: string) {
|
|||
files.push(file.name)
|
||||
}
|
||||
|
||||
if (root === NOSE_WWW) {
|
||||
files = files.filter(file => file.endsWith(`${project}.ts`) || file.endsWith(`${project}.tsx`))
|
||||
}
|
||||
|
||||
if (!files.includes(path))
|
||||
return { error: `file not found: ${path}` }
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import { readdirSync } from "fs"
|
|||
import { join, extname } from "path"
|
||||
|
||||
import type { CommandOutput } from "@/shared/types"
|
||||
import { NOSE_WWW } from "@/config"
|
||||
import { isBinaryFile } from "@/utils"
|
||||
import { countChar } from "@/shared/utils"
|
||||
import { projectName, projectDir } from "@/project"
|
||||
|
|
@ -20,10 +19,6 @@ export default async function (path: string) {
|
|||
files.push(file.name)
|
||||
}
|
||||
|
||||
if (root === NOSE_WWW) {
|
||||
files = files.filter(file => file.endsWith(`${project}.ts`) || file.endsWith(`${project}.tsx`))
|
||||
}
|
||||
|
||||
if (files.includes(path))
|
||||
return await readFile(join(root, path))
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
// Look around.
|
||||
|
||||
import { readdirSync } from "fs"
|
||||
import { NOSE_WWW } from "@/config"
|
||||
import { projectName, projectDir } from "@/project"
|
||||
import { sessionGet } from "@/session"
|
||||
|
||||
export default function () {
|
||||
const project = projectName()
|
||||
const root = sessionGet("cwd") || projectDir()
|
||||
|
||||
let files: string[] = []
|
||||
|
|
@ -15,10 +13,6 @@ export default function () {
|
|||
files.push(file.isDirectory() ? `${file.name}/` : file.name)
|
||||
}
|
||||
|
||||
if (root === NOSE_WWW) {
|
||||
files = files.filter(file => file.endsWith(`${project}.ts`) || file.endsWith(`${project}.tsx`))
|
||||
}
|
||||
|
||||
return <>
|
||||
{root !== projectDir() && <a href="#cd ..;ls">..</a>}
|
||||
{files.map(file =>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
export default async function reboot() {
|
||||
setTimeout(async () => await Bun.$`reboot`, 1000)
|
||||
console.log("REBOOTING...")
|
||||
|
||||
return {
|
||||
text: "Rebooting... This will take about 10 seconds.",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
export default function restart() {
|
||||
setTimeout(() => process.exit(), 1000)
|
||||
console.log("RESTARTING...")
|
||||
|
||||
return {
|
||||
text: "Restarting... This will take a second or two.",
|
||||
|
|
|
|||
|
|
@ -65,9 +65,6 @@ export function draw(game: GameContext) {
|
|||
const offsetX = (game.width - boardW) / 2
|
||||
const offsetY = (game.height - boardH) / 2
|
||||
|
||||
console.log("X", offsetX)
|
||||
console.log("Y", offsetY)
|
||||
|
||||
const c = game.ctx
|
||||
c.save()
|
||||
c.translate(offsetX, offsetY)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ export function routes(def: Record<string, Handler>): Hono {
|
|||
const method = parts[0] || "GET"
|
||||
const path = parts[1] || "/"
|
||||
|
||||
console.log(method, path, def[key])
|
||||
//@ts-ignore
|
||||
app.on(method, path, async c => toResponse(await def[key](c)))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ let ws: WebSocket | null = null
|
|||
|
||||
// open our websocket connection
|
||||
export function startConnection() {
|
||||
const url = new URL('/ws', location.href)
|
||||
const url = new URL(`/ws?session=${sessionId}`, location.href)
|
||||
url.protocol = url.protocol.replace('http', 'ws')
|
||||
ws = new WebSocket(url)
|
||||
|
||||
|
|
|
|||
|
|
@ -33,4 +33,9 @@ export function randomElement<T>(list: T[]): T | undefined {
|
|||
export function randomIndex<T>(list: T[]): number | undefined {
|
||||
if (!list.length) return
|
||||
return rng(0, list.length - 1)
|
||||
}
|
||||
|
||||
// unique([1,1,2,2,3,3]) #=> [1,2,3]
|
||||
export function unique<T>(array: T[]): T[] {
|
||||
return [...new Set(array)]
|
||||
}
|
||||
|
|
@ -31,7 +31,6 @@ export function expectDir(path: string): boolean {
|
|||
export async function expectShellCmd(cmd: string): Promise<boolean> {
|
||||
try {
|
||||
await $`which ${cmd}`
|
||||
console.log("WHICH", cmd)
|
||||
return true
|
||||
} catch {
|
||||
setFatal(`Missing critical dependency: avahi-publish`)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user