diff --git a/bin/cat.ts b/bin/cat.ts
index 1f3c41a..47b8d3c 100644
--- a/bin/cat.ts
+++ b/bin/cat.ts
@@ -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}` }
diff --git a/bin/edit.tsx b/bin/edit.tsx
index a46f893..2c2b8a8 100644
--- a/bin/edit.tsx
+++ b/bin/edit.tsx
@@ -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
diff --git a/bin/ls.tsx b/bin/ls.tsx
index 24669a1..add7a76 100644
--- a/bin/ls.tsx
+++ b/bin/ls.tsx
@@ -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() && ..}
{files.map(file =>
diff --git a/bin/reboot.ts b/bin/reboot.ts
index 3cffbb6..b31fd99 100644
--- a/bin/reboot.ts
+++ b/bin/reboot.ts
@@ -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.",
diff --git a/bin/restart.ts b/bin/restart.ts
index e28bac3..1730180 100644
--- a/bin/restart.ts
+++ b/bin/restart.ts
@@ -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.",
diff --git a/bin/snake.ts b/bin/snake.ts
index d697e2e..b3fa9ea 100644
--- a/bin/snake.ts
+++ b/bin/snake.ts
@@ -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)
diff --git a/src/helpers.tsx b/src/helpers.tsx
index 23b16c7..7cc9e70 100644
--- a/src/helpers.tsx
+++ b/src/helpers.tsx
@@ -58,7 +58,6 @@ export function routes(def: Record): 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)))
}
diff --git a/src/js/websocket.ts b/src/js/websocket.ts
index 5a57240..8e20da4 100644
--- a/src/js/websocket.ts
+++ b/src/js/websocket.ts
@@ -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)
diff --git a/src/shared/utils.ts b/src/shared/utils.ts
index 319e7b5..7f19216 100644
--- a/src/shared/utils.ts
+++ b/src/shared/utils.ts
@@ -33,4 +33,9 @@ export function randomElement(list: T[]): T | undefined {
export function randomIndex(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(array: T[]): T[] {
+ return [...new Set(array)]
}
\ No newline at end of file
diff --git a/src/utils.tsx b/src/utils.tsx
index d0c5814..07e432f 100644
--- a/src/utils.tsx
+++ b/src/utils.tsx
@@ -31,7 +31,6 @@ export function expectDir(path: string): boolean {
export async function expectShellCmd(cmd: string): Promise {
try {
await $`which ${cmd}`
- console.log("WHICH", cmd)
return true
} catch {
setFatal(`Missing critical dependency: avahi-publish`)