mirror of
https://github.com/gethomepage/homepage.git
synced 2026-04-10 04:01:24 -07:00
Fix glances regex
This commit is contained in:
@@ -3,7 +3,7 @@ import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
|
|||||||
const widget = {
|
const widget = {
|
||||||
api: "{url}/api/{endpoint}",
|
api: "{url}/api/{endpoint}",
|
||||||
proxyHandler: credentialedProxyHandler,
|
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;
|
export default widget;
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ describe("glances widget config", () => {
|
|||||||
it("exports a valid widget config", () => {
|
it("exports a valid widget config", () => {
|
||||||
expectWidgetConfigShape(widget);
|
expectWidgetConfigShape(widget);
|
||||||
expect(widget.allowedEndpoints?.test("3/quicklook")).toBe(true);
|
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("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