eed3806efb
Server: list_directory returns a directory_listing (path, home, parent, entries with is_dir/is_git_repo/hidden, truncated) confined to the server user's home subtree after cleaning and resolving symlinks, refusing pseudo filesystems and capping entries at 2000. Documented in docs/cli.md. App: "Choose folder…" in the create dialog opens a picker (full-screen page on phones, large dialog on wide windows, Material and Cupertino) with breadcrumbs, filter, Show hidden, git badges, dimmed files, recent folders, inline errors and "Start chat here". The probe app gains a folder fixture for captures.
32 lines
810 B
Go
32 lines
810 B
Go
//go:build linux
|
|
|
|
package server
|
|
|
|
import "syscall"
|
|
|
|
// Filesystem magic numbers (linux/magic.h) for kernel pseudo filesystems that
|
|
// a folder picker must never list.
|
|
var specialFilesystemMagic = map[int64]struct{}{
|
|
0x9fa0: {}, // proc
|
|
0x62656572: {}, // sysfs
|
|
0x1cd1: {}, // devpts
|
|
0x64626720: {}, // debugfs
|
|
0x74726163: {}, // tracefs
|
|
0x27e0eb: {}, // cgroup
|
|
0x63677270: {}, // cgroup2
|
|
0xf97cff8c: {}, // selinuxfs
|
|
0x73636673: {}, // securityfs
|
|
0xcafe4a11: {}, // bpf
|
|
0x65735546: {}, // fuse control
|
|
}
|
|
|
|
// specialFilesystem reports whether path lives on a kernel pseudo filesystem.
|
|
func specialFilesystem(path string) bool {
|
|
var stat syscall.Statfs_t
|
|
if err := syscall.Statfs(path, &stat); err != nil {
|
|
return false
|
|
}
|
|
_, ok := specialFilesystemMagic[int64(stat.Type)]
|
|
return ok
|
|
}
|