Compare commits

...

3 Commits

Author SHA1 Message Date
henrygd
ca4988951f add SKIP_SYSTEMD env var (#1448) 2025-11-19 17:21:30 -05:00
zjkal
c7a50dd74d fix: Fix issue where the Add System button is visible to read-only users (#1442)
移除按钮的hidden类并提前检查只读用户状态返回null
2025-11-19 16:38:37 -05:00
Frederik Ring
00fbf5c9c3 Font ligatures create unwanted artifacts in random ids (#1434) 2025-11-19 16:36:48 -05:00
3 changed files with 31 additions and 26 deletions

View File

@@ -17,9 +17,7 @@ import (
"github.com/henrygd/beszel/internal/entities/systemd" "github.com/henrygd/beszel/internal/entities/systemd"
) )
var ( var errNoActiveTime = errors.New("no active time")
errNoActiveTime = errors.New("no active time")
)
// systemdManager manages the collection of systemd service statistics. // systemdManager manages the collection of systemd service statistics.
type systemdManager struct { type systemdManager struct {
@@ -32,9 +30,12 @@ type systemdManager struct {
// newSystemdManager creates a new systemdManager. // newSystemdManager creates a new systemdManager.
func newSystemdManager() (*systemdManager, error) { func newSystemdManager() (*systemdManager, error) {
if skipSystemd, _ := GetEnv("SKIP_SYSTEMD"); skipSystemd == "true" {
return nil, nil
}
conn, err := dbus.NewSystemConnectionContext(context.Background()) conn, err := dbus.NewSystemConnectionContext(context.Background())
if err != nil { if err != nil {
slog.Warn("Error connecting to systemd", "err", err, "ref", "https://beszel.dev/guide/systemd") slog.Debug("Error connecting to systemd", "err", err, "ref", "https://beszel.dev/guide/systemd")
return nil, err return nil, err
} }

View File

@@ -36,28 +36,31 @@ import { AppleIcon, DockerIcon, FreeBsdIcon, TuxIcon, WindowsIcon } from "./ui/i
import { InputCopy } from "./ui/input-copy" import { InputCopy } from "./ui/input-copy"
export function AddSystemButton({ className }: { className?: string }) { export function AddSystemButton({ className }: { className?: string }) {
const [open, setOpen] = useState(false) if (isReadOnlyUser()) {
const opened = useRef(false) return null
if (open) { }
opened.current = true const [open, setOpen] = useState(false)
} const opened = useRef(false)
if (open) {
opened.current = true
}
return ( return (
<Dialog open={open} onOpenChange={setOpen}> <Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild> <DialogTrigger asChild>
<Button <Button
variant="outline" variant="outline"
className={cn("flex gap-1 max-xs:h-[2.4rem]", className, isReadOnlyUser() && "hidden")} className={cn("flex gap-1 max-xs:h-[2.4rem]", className)}
> >
<PlusIcon className="h-4 w-4 -ms-1" /> <PlusIcon className="h-4 w-4 -ms-1" />
<Trans> <Trans>
Add <span className="hidden sm:inline">System</span> Add <span className="hidden sm:inline">System</span>
</Trans> </Trans>
</Button> </Button>
</DialogTrigger> </DialogTrigger>
{opened.current && <SystemDialog setOpen={setOpen} />} {opened.current && <SystemDialog setOpen={setOpen} />}
</Dialog> </Dialog>
) )
} }
/** /**

View File

@@ -142,6 +142,7 @@
body { body {
@apply bg-background text-foreground; @apply bg-background text-foreground;
font-variant-ligatures: no-contextual;
} }
button { button {
@@ -174,4 +175,4 @@
.recharts-yAxis { .recharts-yAxis {
@apply tabular-nums; @apply tabular-nums;
} }