mirror of
https://github.com/gethomepage/homepage.git
synced 2026-04-02 00:02:14 -07:00
Fix glances regex
This commit is contained in:
@@ -3,7 +3,7 @@ import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
|
||||
const widget = {
|
||||
api: "{url}/api/{endpoint}",
|
||||
proxyHandler: credentialedProxyHandler,
|
||||
allowedEndpoints: /\d\/quicklook|diskio|cpu|fs|gpu|system|mem|network|processlist|sensors|containers/,
|
||||
allowedEndpoints: /^\d+\/(quicklook|diskio|cpu|fs|gpu|system|mem|network|processlist|sensors|containers)$/,
|
||||
};
|
||||
|
||||
export default widget;
|
||||
|
||||
@@ -8,6 +8,10 @@ describe("glances widget config", () => {
|
||||
it("exports a valid widget config", () => {
|
||||
expectWidgetConfigShape(widget);
|
||||
expect(widget.allowedEndpoints?.test("3/quicklook")).toBe(true);
|
||||
expect(widget.allowedEndpoints?.test("12/cpu")).toBe(true);
|
||||
expect(widget.allowedEndpoints?.test("unknown")).toBe(false);
|
||||
expect(widget.allowedEndpoints?.test("xxcpuyy")).toBe(false);
|
||||
expect(widget.allowedEndpoints?.test("3/cpu/extra")).toBe(false);
|
||||
expect(widget.allowedEndpoints?.test("membrane")).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user