diff --git a/packages/desktop/package.json b/packages/desktop/package.json index 7fa0372..b01048b 100644 --- a/packages/desktop/package.json +++ b/packages/desktop/package.json @@ -52,6 +52,7 @@ }, "dependencies": { "@holdem-poker-tools/hand-matrix": "^0.2.1", + "ajv": "^7.0.2", "antd": "^4.9.4", "electron-is-dev": "^1.2.0", "electron-updater": "^4.3.5", diff --git a/packages/desktop/public/electron.js b/packages/desktop/public/electron.js index 613eaaf..f3045a3 100644 --- a/packages/desktop/public/electron.js +++ b/packages/desktop/public/electron.js @@ -79,7 +79,7 @@ const createAppWindow = async () => { } const validateRange = (range) => { - const ajv = new Ajv(); + const ajv = new Ajv.default({strict: false}); if (!ajv.validate(require("./range.schema.json"), range)) throw new Error(`Invalid range: ${ajv.errorsText()}`); }; diff --git a/packages/web/src/pages/ViewRanges.js b/packages/web/src/pages/ViewRanges.js index 9ce6c6c..ab52187 100644 --- a/packages/web/src/pages/ViewRanges.js +++ b/packages/web/src/pages/ViewRanges.js @@ -151,7 +151,7 @@ const ViewRanges = () => { const RangeTile = ({ range, frequencyMode, refreshRate }) => { const history = useHistory(); - const [rng, setRng] = useState(5); + const [rng, setRng] = useState(15); let {title, author, actions, combos, tags, _id} = range; useEffect(() => { diff --git a/packages/web/src/ranges/range.schema.json b/packages/web/src/ranges/range.schema.json index a43fb59..f858e6e 100644 --- a/packages/web/src/ranges/range.schema.json +++ b/packages/web/src/ranges/range.schema.json @@ -46,6 +46,7 @@ }, "combos": { "$id": "combos", + "type": "object", "additionalProperties": false, "maxProperties": 169, "minProperties": 0, diff --git a/packages/web/src/utils/range.js b/packages/web/src/utils/range.js index d8e1361..88d8e6a 100644 --- a/packages/web/src/utils/range.js +++ b/packages/web/src/utils/range.js @@ -4,7 +4,7 @@ import fileDownload from "js-file-download"; import Ajv from "ajv"; import schema from "../data/range.schema.json"; -const ajv = new Ajv(); +const ajv = new Ajv({strict: false}); ajv.addSchema(schema); export const validateActions = ajv.getSchema("actions"); export const validateCombos = ajv.getSchema("combos");