LCOV - code coverage report
Current view: top level - pkg/lib - logins.ts Coverage Total Hit
Test: cockpit Lines: 100.0 % 4 4
Test Date: 2026-06-16 14:09:37

            Line data    Source code
       1              : /*
       2              :  * Copyright (C) 2024 Red Hat, Inc.
       3              :  * SPDX-License-Identifier: LGPL-2.1-or-later
       4              :  */
       5              : 
       6              : import * as python from "python";
       7              : 
       8              : // @ts-expect-error TS2307 this isn't a TS module, just a magic esbuild "text" import rule
       9              : import lastlog2_py from "./lastlog2.py";
      10              : 
      11              : export type LastlogEntry = {
      12              :     time: number;
      13              :     tty: string;
      14              :     host: string;
      15              : };
      16              : 
      17              : /* Return lastlog2 database as { username → LastLogin } object.
      18              :  * Throws an exception if the db does not exist, i.e. the system isn't using lastlog2.
      19              : */
      20           45 : export async function getLastlog2(user?: string): Promise<Record<string, LastlogEntry>> {
      21            7 :     const out = await python.spawn(lastlog2_py, user ? [user] : [], { err: "message" });
      22           38 :     return JSON.parse(out);
      23           45 : }
        

Generated by: LCOV version 2.0-1