fix cliamp panel header, home dir lookup, and go install path
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+7
-5
@@ -423,10 +423,12 @@ install_go() {
|
|||||||
esac
|
esac
|
||||||
echo " Installing Go ${GOLANG_VERSION} from official tarball..."
|
echo " Installing Go ${GOLANG_VERSION} from official tarball..."
|
||||||
curl -fsSL "https://go.dev/dl/go${GOLANG_VERSION}.linux-${GO_ARCH}.tar.gz" -o /tmp/go.tar.gz
|
curl -fsSL "https://go.dev/dl/go${GOLANG_VERSION}.linux-${GO_ARCH}.tar.gz" -o /tmp/go.tar.gz
|
||||||
sudo rm -rf /usr/local/go
|
rm -rf "$HOME/.local/go"
|
||||||
sudo tar -C /usr/local -xzf /tmp/go.tar.gz
|
mkdir -p "$HOME/.local"
|
||||||
|
tar -C "$HOME/.local" -xzf /tmp/go.tar.gz
|
||||||
rm /tmp/go.tar.gz
|
rm /tmp/go.tar.gz
|
||||||
export PATH="/usr/local/go/bin:$PATH"
|
export GOPATH="$HOME/.local/go-path"
|
||||||
|
export PATH="$HOME/.local/go/bin:$GOPATH/bin:$PATH"
|
||||||
;;
|
;;
|
||||||
brew)
|
brew)
|
||||||
brew install go
|
brew install go
|
||||||
@@ -503,7 +505,7 @@ fi
|
|||||||
echo ""
|
echo ""
|
||||||
echo "── cliamp ──"
|
echo "── cliamp ──"
|
||||||
|
|
||||||
GOPATH_BIN="${GOPATH:-$HOME/go}/bin"
|
GOPATH_BIN="${GOPATH:-$HOME/.local/go-path}/bin"
|
||||||
export PATH="$GOPATH_BIN:$PATH"
|
export PATH="$GOPATH_BIN:$PATH"
|
||||||
|
|
||||||
if has cliamp; then
|
if has cliamp; then
|
||||||
@@ -844,7 +846,7 @@ echo "════════════════════════
|
|||||||
echo ""
|
echo ""
|
||||||
echo "Notes:"
|
echo "Notes:"
|
||||||
echo " • PulseAudio null sink starts automatically with the server"
|
echo " • PulseAudio null sink starts automatically with the server"
|
||||||
echo " • Make sure ~/go/bin is in your PATH for cliamp"
|
echo " • Make sure ~/.local/go/bin and ~/.local/go-path/bin are in your PATH for Go tools"
|
||||||
echo " • Make sure ~/.cargo/bin is in your PATH for Rust tools"
|
echo " • Make sure ~/.cargo/bin is in your PATH for Rust tools"
|
||||||
echo " • sharp, whisper-cpp, mlx-audio can be installed from Settings > Applications"
|
echo " • sharp, whisper-cpp, mlx-audio can be installed from Settings > Applications"
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { ServerWebSocket } from 'bun';
|
|||||||
import { spawn, type Subprocess } from 'bun';
|
import { spawn, type Subprocess } from 'bun';
|
||||||
import { resolve, normalize, dirname, join } from 'node:path';
|
import { resolve, normalize, dirname, join } from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { getHomeDir } from '@@/data-path';
|
import { getHomeDirForRole } from '@@/data-path';
|
||||||
|
|
||||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||||
const ASOUNDRC_PATH = join(__dirname, 'asoundrc');
|
const ASOUNDRC_PATH = join(__dirname, 'asoundrc');
|
||||||
@@ -49,12 +49,18 @@ const validateFilePaths = (files: string[], homeDir: string): string[] | null =>
|
|||||||
const findCliamp = (): string | null => {
|
const findCliamp = (): string | null => {
|
||||||
const which = Bun.which('cliamp');
|
const which = Bun.which('cliamp');
|
||||||
if (which) return which;
|
if (which) return which;
|
||||||
const goPath = process.env.GOPATH ?? `${process.env.HOME}/go`;
|
const candidates = [
|
||||||
const goBin = `${goPath}/bin/cliamp`;
|
process.env.GOPATH ? `${process.env.GOPATH}/bin/cliamp` : null,
|
||||||
try {
|
`${process.env.HOME}/.local/go-path/bin/cliamp`,
|
||||||
const stat = Bun.spawnSync({ cmd: ['test', '-x', goBin], stdout: 'ignore', stderr: 'ignore' });
|
`${process.env.HOME}/go/bin/cliamp`,
|
||||||
if (stat.exitCode === 0) return goBin;
|
];
|
||||||
} catch { /* ignore */ }
|
for (const bin of candidates) {
|
||||||
|
if (!bin) continue;
|
||||||
|
try {
|
||||||
|
const stat = Bun.spawnSync({ cmd: ['test', '-x', bin], stdout: 'ignore', stderr: 'ignore' });
|
||||||
|
if (stat.exitCode === 0) return bin;
|
||||||
|
} catch { /* ignore */ }
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -62,7 +68,7 @@ const shellEscape = (s: string) => `'${s.replace(/'/g, "'\\''")}'`;
|
|||||||
|
|
||||||
export const cliampWebsocket = {
|
export const cliampWebsocket = {
|
||||||
async open(ws: ServerWebSocket<WSData>) {
|
async open(ws: ServerWebSocket<WSData>) {
|
||||||
const { email, files: filesParam } = ws.data;
|
const { email, role, files: filesParam } = ws.data;
|
||||||
|
|
||||||
if (!filesParam) {
|
if (!filesParam) {
|
||||||
sendOutput(ws, '\r\n[Error] No files specified.\r\n');
|
sendOutput(ws, '\r\n[Error] No files specified.\r\n');
|
||||||
@@ -75,7 +81,7 @@ export const cliampWebsocket = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const homeDir = getHomeDir(email);
|
const homeDir = getHomeDirForRole(email, role);
|
||||||
const rawFiles = [filesParam];
|
const rawFiles = [filesParam];
|
||||||
|
|
||||||
// Resolve paths relative to user home dir
|
// Resolve paths relative to user home dir
|
||||||
|
|||||||
@@ -1,34 +1,20 @@
|
|||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { useSearchParams } from 'react-router';
|
import { useSearchParams } from 'react-router';
|
||||||
import { X } from 'lucide-react';
|
import { Music } from 'lucide-react';
|
||||||
import { TerminalView } from '../Terminal/Terminal';
|
import { TerminalView } from '../Terminal/Terminal';
|
||||||
import { AudioStreamPlayer } from './AudioStreamPlayer';
|
import { AudioStreamPlayer } from './AudioStreamPlayer';
|
||||||
|
|
||||||
export const CliampPanelHeader = () => {
|
export const CliampPanelHeader = () => {
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const playPath = searchParams.get('play') ?? '';
|
const playPath = searchParams.get('play') ?? '';
|
||||||
const fileName = playPath.split('/').pop() ?? 'cliamp';
|
const fileName = playPath.split('/').pop() ?? 'cliamp';
|
||||||
|
|
||||||
const handleClose = useCallback(() => {
|
|
||||||
setSearchParams((prev) => {
|
|
||||||
const next = new URLSearchParams(prev);
|
|
||||||
next.delete('play');
|
|
||||||
return next;
|
|
||||||
});
|
|
||||||
}, [setSearchParams]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-2 px-3 py-1.5 border-b border-duck-dark/10 bg-background/95">
|
<>
|
||||||
<span className="text-sm font-medium text-duck-dark truncate flex-1">{fileName}</span>
|
<Music className="h-4 w-4 shrink-0 opacity-60" />
|
||||||
|
<span className="text-xs font-medium truncate flex-1">{fileName}</span>
|
||||||
<AudioStreamPlayer wsUrl="/api/cliamp/audio/ws" />
|
<AudioStreamPlayer wsUrl="/api/cliamp/audio/ws" />
|
||||||
<button
|
</>
|
||||||
onClick={handleClose}
|
|
||||||
className="p-1 rounded hover:bg-duck-dark/10 transition-colors cursor-pointer"
|
|
||||||
title="Close player"
|
|
||||||
>
|
|
||||||
<X className="h-4 w-4 text-duck-dark/60" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user