Firmware upload is functional

This commit is contained in:
2024-10-07 22:13:47 +02:00
parent cef5b5aa5b
commit 2924d14281
3 changed files with 65 additions and 12 deletions

View File

@@ -1,3 +1,4 @@
import { SemVer } from "semver";
import { LenConstraint } from "../api/ServerApi";
/**
@@ -6,3 +7,16 @@ import { LenConstraint } from "../api/ServerApi";
export function lenValid(s: string, c: LenConstraint): boolean {
return s.length >= c.min && s.length <= c.max;
}
/**
* Check out whether a given version number respect semantics requirements or not
*/
export function checkVersion(v: string): boolean {
try {
new SemVer(v, { loose: false });
return true;
} catch (e) {
console.error(e);
return false;
}
}