mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-31 10:50:32 +03:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba058d7c9d | ||
|
|
5392e252ef |
@@ -72,10 +72,10 @@ Variables prefixed with `FRIGATE_` can be referenced in config fields that suppo
|
|||||||
|
|
||||||
Navigate to <NavPath path="Settings > System > Environment variables" /> to add or edit environment variables.
|
Navigate to <NavPath path="Settings > System > Environment variables" /> to add or edit environment variables.
|
||||||
|
|
||||||
| Field | Description |
|
| Field | Description |
|
||||||
| ----------------- | --------------------------------------------------------- |
|
| --------- | --------------------------------------------------------- |
|
||||||
| **Variable name** | The environment variable name (e.g., `FRIGATE_MQTT_USER`) |
|
| **Key** | The environment variable name (e.g., `FRIGATE_MQTT_USER`) |
|
||||||
| **Value** | The value for the variable |
|
| **Value** | The value for the variable |
|
||||||
|
|
||||||
Variables defined here can be referenced elsewhere in your configuration using the `{FRIGATE_VARIABLE_NAME}` syntax.
|
Variables defined here can be referenced elsewhere in your configuration using the `{FRIGATE_VARIABLE_NAME}` syntax.
|
||||||
|
|
||||||
|
|||||||
Generated
+264
-31
@@ -4512,6 +4512,18 @@
|
|||||||
"langium": "3.3.1"
|
"langium": "3.3.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@noble/hashes": {
|
||||||
|
"version": "1.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz",
|
||||||
|
"integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 16"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://paulmillr.com/funding/"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@nodelib/fs.scandir": {
|
"node_modules/@nodelib/fs.scandir": {
|
||||||
"version": "2.1.5",
|
"version": "2.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||||
@@ -4852,6 +4864,163 @@
|
|||||||
"url": "https://opencollective.com/parcel"
|
"url": "https://opencollective.com/parcel"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@peculiar/asn1-cms": {
|
||||||
|
"version": "2.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@peculiar/asn1-cms/-/asn1-cms-2.8.0.tgz",
|
||||||
|
"integrity": "sha512-NgekZOrSJFSBFLFoLfwePguAWAx7z1+f2TEsWFUMyiqqfntZ4+S/S5hzqME3q4pCA0iOsFKdwiQ35dwY24eVqA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@peculiar/asn1-schema": "^2.8.0",
|
||||||
|
"@peculiar/asn1-x509": "^2.8.0",
|
||||||
|
"@peculiar/asn1-x509-attr": "^2.8.0",
|
||||||
|
"asn1js": "^3.0.10",
|
||||||
|
"tslib": "^2.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@peculiar/asn1-csr": {
|
||||||
|
"version": "2.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@peculiar/asn1-csr/-/asn1-csr-2.8.0.tgz",
|
||||||
|
"integrity": "sha512-akbF8+uvleHs8sejNPQxwmVFuInAg6FMNHOwMILXfP518YfFJwdR3jr6oNUPOaEJfuEhn/vkNOCIT6ASUd4mbg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@peculiar/asn1-schema": "^2.8.0",
|
||||||
|
"@peculiar/asn1-x509": "^2.8.0",
|
||||||
|
"asn1js": "^3.0.10",
|
||||||
|
"tslib": "^2.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@peculiar/asn1-ecc": {
|
||||||
|
"version": "2.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@peculiar/asn1-ecc/-/asn1-ecc-2.8.0.tgz",
|
||||||
|
"integrity": "sha512-ohwlk+u9Rv2NOAY1c6MfHj45ATVF8R1DUN/WCgABiRtLi2ZftlZWZX7KvpAbU8v9xPcmoILfELeEABj/rn18AQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@peculiar/asn1-schema": "^2.8.0",
|
||||||
|
"@peculiar/asn1-x509": "^2.8.0",
|
||||||
|
"asn1js": "^3.0.10",
|
||||||
|
"tslib": "^2.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@peculiar/asn1-pfx": {
|
||||||
|
"version": "2.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@peculiar/asn1-pfx/-/asn1-pfx-2.8.0.tgz",
|
||||||
|
"integrity": "sha512-5yof1ytoB++RQtaFbqSUJ8pxDJtZT6vbVqZ8XoJ61ph7UjNVvfFwAilnCodqkNsAodpy13gDhoxZXw00pghnyg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@peculiar/asn1-cms": "^2.8.0",
|
||||||
|
"@peculiar/asn1-pkcs8": "^2.8.0",
|
||||||
|
"@peculiar/asn1-rsa": "^2.8.0",
|
||||||
|
"@peculiar/asn1-schema": "^2.8.0",
|
||||||
|
"asn1js": "^3.0.10",
|
||||||
|
"tslib": "^2.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@peculiar/asn1-pkcs8": {
|
||||||
|
"version": "2.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs8/-/asn1-pkcs8-2.8.0.tgz",
|
||||||
|
"integrity": "sha512-qAKXtLpBEw9LqhKpjw3ajZSXlBur+ipW+y2ivVBQAG6F6qRx94yO+1ZR4mvw+YaCfKSaOzLeYEzsPaBp4SJELA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@peculiar/asn1-schema": "^2.8.0",
|
||||||
|
"@peculiar/asn1-x509": "^2.8.0",
|
||||||
|
"asn1js": "^3.0.10",
|
||||||
|
"tslib": "^2.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@peculiar/asn1-pkcs9": {
|
||||||
|
"version": "2.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@peculiar/asn1-pkcs9/-/asn1-pkcs9-2.8.0.tgz",
|
||||||
|
"integrity": "sha512-b5nDWCnkV60+cQ141D6sVVwK9nz64R5n3zSVnklGd+ECdkW2Ol3U1a6yYFlalpSOaD557yuJB64A+q42jG7lUQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@peculiar/asn1-cms": "^2.8.0",
|
||||||
|
"@peculiar/asn1-pfx": "^2.8.0",
|
||||||
|
"@peculiar/asn1-pkcs8": "^2.8.0",
|
||||||
|
"@peculiar/asn1-schema": "^2.8.0",
|
||||||
|
"@peculiar/asn1-x509": "^2.8.0",
|
||||||
|
"@peculiar/asn1-x509-attr": "^2.8.0",
|
||||||
|
"asn1js": "^3.0.10",
|
||||||
|
"tslib": "^2.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@peculiar/asn1-rsa": {
|
||||||
|
"version": "2.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@peculiar/asn1-rsa/-/asn1-rsa-2.8.0.tgz",
|
||||||
|
"integrity": "sha512-zHEUlCqB2mk7x2lxDwHHJy7hWZOPdGHVlsmITWKB5/PbQo61atbu9PJ/0r9dQNMwFzbKPXZ8uK8/91eUhRznSg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@peculiar/asn1-schema": "^2.8.0",
|
||||||
|
"@peculiar/asn1-x509": "^2.8.0",
|
||||||
|
"asn1js": "^3.0.10",
|
||||||
|
"tslib": "^2.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@peculiar/asn1-schema": {
|
||||||
|
"version": "2.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.8.0.tgz",
|
||||||
|
"integrity": "sha512-7YT0U/ze0tF2QOBbE15gKZwy5tvgGyLRiRHLzhlbOpf7BT032oBSd0haZqXn5W6l26WLlu3dyxzjM+2638/z2Q==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@peculiar/utils": "^2.0.2",
|
||||||
|
"asn1js": "^3.0.10",
|
||||||
|
"tslib": "^2.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@peculiar/asn1-x509": {
|
||||||
|
"version": "2.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@peculiar/asn1-x509/-/asn1-x509-2.8.0.tgz",
|
||||||
|
"integrity": "sha512-N0CMuhWUzsWEVq6F1q9X6+VKUnWzSW+cSVg+aPaGGwDdbFoFWTYgin5MHwXgpWd6y9COMBxnfy/Qc+Xc7F0Zwg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@peculiar/asn1-schema": "^2.8.0",
|
||||||
|
"@peculiar/utils": "^2.0.2",
|
||||||
|
"asn1js": "^3.0.10",
|
||||||
|
"tslib": "^2.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@peculiar/asn1-x509-attr": {
|
||||||
|
"version": "2.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@peculiar/asn1-x509-attr/-/asn1-x509-attr-2.8.0.tgz",
|
||||||
|
"integrity": "sha512-tHjkfS/qhMnmrlB2J9NhflQlQ7In3khO3CfmVrriOlpTeErY9ZIKOso1hQ5JQiyrJ7ShvqVPk7E5fQmbclkSKA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@peculiar/asn1-schema": "^2.8.0",
|
||||||
|
"@peculiar/asn1-x509": "^2.8.0",
|
||||||
|
"asn1js": "^3.0.10",
|
||||||
|
"tslib": "^2.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@peculiar/utils": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@peculiar/utils/-/utils-2.0.3.tgz",
|
||||||
|
"integrity": "sha512-+oL3HPFRIZ1St2K50lWCXiioIgSoxzz7R1J3uF6neO2yl1sgmpgY6XXJH4BdpoDkMWznQTeYF6oWNDZLCdQ4eQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "^2.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@peculiar/x509": {
|
||||||
|
"version": "1.14.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@peculiar/x509/-/x509-1.14.3.tgz",
|
||||||
|
"integrity": "sha512-C2Xj8FZ0uHWeCXXqX5B4/gVFQmtSkiuOolzAgutjTfseNOHT3pUjljDZsTSxXFGgio54bCzVFqmEOUrIVk8RDA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@peculiar/asn1-cms": "^2.6.0",
|
||||||
|
"@peculiar/asn1-csr": "^2.6.0",
|
||||||
|
"@peculiar/asn1-ecc": "^2.6.0",
|
||||||
|
"@peculiar/asn1-pkcs9": "^2.6.0",
|
||||||
|
"@peculiar/asn1-rsa": "^2.6.0",
|
||||||
|
"@peculiar/asn1-schema": "^2.6.0",
|
||||||
|
"@peculiar/asn1-x509": "^2.6.0",
|
||||||
|
"pvtsutils": "^1.3.6",
|
||||||
|
"reflect-metadata": "^0.2.2",
|
||||||
|
"tslib": "^2.8.1",
|
||||||
|
"tsyringe": "^4.10.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@pnpm/config.env-replace": {
|
"node_modules/@pnpm/config.env-replace": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz",
|
||||||
@@ -5796,15 +5965,6 @@
|
|||||||
"undici-types": "~7.16.0"
|
"undici-types": "~7.16.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/node-forge": {
|
|
||||||
"version": "1.3.14",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.14.tgz",
|
|
||||||
"integrity": "sha512-mhVF2BnD4BO+jtOp7z1CdzaK4mbuK0LLQYAvdOLqHTavxFNq4zA1EmYkpnFjP8HOUzedfQkRnp0E2ulSAYSzAw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@types/node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@types/parse5": {
|
"node_modules/@types/parse5": {
|
||||||
"version": "6.0.3",
|
"version": "6.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.3.tgz",
|
||||||
@@ -6521,6 +6681,20 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/asn1js": {
|
||||||
|
"version": "3.0.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/asn1js/-/asn1js-3.0.10.tgz",
|
||||||
|
"integrity": "sha512-S2s3aOytiKdFRdulw2qPE51MzjzVOisppcVv7jVFR+Kw0kxwvFrDcYA0h7Ndqbmj0HkMIXYWaoj7fli8kgx1eg==",
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"dependencies": {
|
||||||
|
"pvtsutils": "^1.3.6",
|
||||||
|
"pvutils": "^1.1.5",
|
||||||
|
"tslib": "^2.8.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/astring": {
|
"node_modules/astring": {
|
||||||
"version": "1.9.0",
|
"version": "1.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/astring/-/astring-1.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/astring/-/astring-1.9.0.tgz",
|
||||||
@@ -6934,6 +7108,15 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/bytestreamjs": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/bytestreamjs/-/bytestreamjs-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-U1Z/ob71V/bXfVABvNr/Kumf5VyeQRBEm6Txb0PQ6S7V5GpBM3w4Cbqz/xPDicR5tN0uvDifng8C+5qECeGwyQ==",
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/cacheable-lookup": {
|
"node_modules/cacheable-lookup": {
|
||||||
"version": "7.0.0",
|
"version": "7.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz",
|
||||||
@@ -15958,15 +16141,6 @@
|
|||||||
"node": "4.x || >=6.0.0"
|
"node": "4.x || >=6.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/node-forge": {
|
|
||||||
"version": "1.3.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.3.tgz",
|
|
||||||
"integrity": "sha512-rLvcdSyRCyouf6jcOIPe/BgwG/d7hKjzMKOas33/pHEr6gbq18IK9zV7DiPvzsz0oBJPme6qr6H6kGZuI9/DZg==",
|
|
||||||
"license": "(BSD-3-Clause OR GPL-2.0)",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 6.13.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/node-readfiles": {
|
"node_modules/node-readfiles": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/node-readfiles/-/node-readfiles-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/node-readfiles/-/node-readfiles-0.2.0.tgz",
|
||||||
@@ -16789,6 +16963,23 @@
|
|||||||
"pathe": "^2.0.1"
|
"pathe": "^2.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/pkijs": {
|
||||||
|
"version": "3.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pkijs/-/pkijs-3.4.0.tgz",
|
||||||
|
"integrity": "sha512-emEcLuomt2j03vxD54giVB4SxTjnsqkU692xZOZXHDVoYyypEm+b3jpiTcc+Cf+myooc+/Ly0z01jqeNHVgJGw==",
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"dependencies": {
|
||||||
|
"@noble/hashes": "1.4.0",
|
||||||
|
"asn1js": "^3.0.6",
|
||||||
|
"bytestreamjs": "^2.0.1",
|
||||||
|
"pvtsutils": "^1.3.6",
|
||||||
|
"pvutils": "^1.1.3",
|
||||||
|
"tslib": "^2.8.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/pluralize": {
|
"node_modules/pluralize": {
|
||||||
"version": "8.0.0",
|
"version": "8.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz",
|
||||||
@@ -18496,6 +18687,24 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/pvtsutils": {
|
||||||
|
"version": "1.3.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/pvtsutils/-/pvtsutils-1.3.6.tgz",
|
||||||
|
"integrity": "sha512-PLgQXQ6H2FWCaeRak8vvk1GW462lMxB5s3Jm673N82zI4vqtVUPuZdffdZbPDFRoU8kAhItWFtPCWiPpp4/EDg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "^2.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pvutils": {
|
||||||
|
"version": "1.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/pvutils/-/pvutils-1.1.5.tgz",
|
||||||
|
"integrity": "sha512-KTqnxsgGiQ6ZAzZCVlJH5eOjSnvlyEgx1m8bkRJfOhmGRqfo5KLvmAlACQkrjEtOQ4B7wF9TdSLIs9O90MX9xA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/qs": {
|
"node_modules/qs": {
|
||||||
"version": "6.14.1",
|
"version": "6.14.1",
|
||||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz",
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz",
|
||||||
@@ -19731,6 +19940,12 @@
|
|||||||
"redux": "^4"
|
"redux": "^4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/reflect-metadata": {
|
||||||
|
"version": "0.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz",
|
||||||
|
"integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==",
|
||||||
|
"license": "Apache-2.0"
|
||||||
|
},
|
||||||
"node_modules/reftools": {
|
"node_modules/reftools": {
|
||||||
"version": "1.1.9",
|
"version": "1.1.9",
|
||||||
"resolved": "https://registry.npmjs.org/reftools/-/reftools-1.1.9.tgz",
|
"resolved": "https://registry.npmjs.org/reftools/-/reftools-1.1.9.tgz",
|
||||||
@@ -20479,16 +20694,16 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/selfsigned": {
|
"node_modules/selfsigned": {
|
||||||
"version": "2.4.1",
|
"version": "5.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-5.5.0.tgz",
|
||||||
"integrity": "sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==",
|
"integrity": "sha512-ftnu3TW4+3eBfLRFnDEkzGxSF/10BJBkaLJuBHZX0kiPS7bRdlpZGu6YGt4KngMkdTwJE6MbjavFpqHvqVt+Ew==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node-forge": "^1.3.0",
|
"@peculiar/x509": "^1.14.2",
|
||||||
"node-forge": "^1"
|
"pkijs": "^3.3.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/semver": {
|
"node_modules/semver": {
|
||||||
@@ -21922,6 +22137,24 @@
|
|||||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||||
"license": "0BSD"
|
"license": "0BSD"
|
||||||
},
|
},
|
||||||
|
"node_modules/tsyringe": {
|
||||||
|
"version": "4.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tsyringe/-/tsyringe-4.10.0.tgz",
|
||||||
|
"integrity": "sha512-axr3IdNuVIxnaK5XGEUFTu3YmAQ6lllgrvqfEoR16g/HGnYY/6We4oWENtAnzK6/LpJ2ur9PAb80RBt7/U4ugw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "^1.9.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/tsyringe/node_modules/tslib": {
|
||||||
|
"version": "1.14.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
|
||||||
|
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
|
||||||
|
"license": "0BSD"
|
||||||
|
},
|
||||||
"node_modules/type-fest": {
|
"node_modules/type-fest": {
|
||||||
"version": "2.19.0",
|
"version": "2.19.0",
|
||||||
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz",
|
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz",
|
||||||
@@ -22810,14 +23043,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/webpack-dev-server": {
|
"node_modules/webpack-dev-server": {
|
||||||
"version": "5.2.2",
|
"version": "5.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-5.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-5.2.5.tgz",
|
||||||
"integrity": "sha512-QcQ72gh8a+7JO63TAx/6XZf/CWhgMzu5m0QirvPfGvptOusAxG12w2+aua1Jkjr7hzaWDnJ2n6JFeexMHI+Zjg==",
|
"integrity": "sha512-4wZtCquSuv9CKX8oybo+mqxtxZqWz47uM1Ch94lxowBztOhWCbhqvRbfC/mODOwxgV2brY+JGZpHq58/SuVFYg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/bonjour": "^3.5.13",
|
"@types/bonjour": "^3.5.13",
|
||||||
"@types/connect-history-api-fallback": "^1.5.4",
|
"@types/connect-history-api-fallback": "^1.5.4",
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.25",
|
||||||
"@types/express-serve-static-core": "^4.17.21",
|
"@types/express-serve-static-core": "^4.17.21",
|
||||||
"@types/serve-index": "^1.9.4",
|
"@types/serve-index": "^1.9.4",
|
||||||
"@types/serve-static": "^1.15.5",
|
"@types/serve-static": "^1.15.5",
|
||||||
@@ -22827,9 +23060,9 @@
|
|||||||
"bonjour-service": "^1.2.1",
|
"bonjour-service": "^1.2.1",
|
||||||
"chokidar": "^3.6.0",
|
"chokidar": "^3.6.0",
|
||||||
"colorette": "^2.0.10",
|
"colorette": "^2.0.10",
|
||||||
"compression": "^1.7.4",
|
"compression": "^1.8.1",
|
||||||
"connect-history-api-fallback": "^2.0.0",
|
"connect-history-api-fallback": "^2.0.0",
|
||||||
"express": "^4.21.2",
|
"express": "^4.22.1",
|
||||||
"graceful-fs": "^4.2.6",
|
"graceful-fs": "^4.2.6",
|
||||||
"http-proxy-middleware": "^2.0.9",
|
"http-proxy-middleware": "^2.0.9",
|
||||||
"ipaddr.js": "^2.1.0",
|
"ipaddr.js": "^2.1.0",
|
||||||
@@ -22837,7 +23070,7 @@
|
|||||||
"open": "^10.0.3",
|
"open": "^10.0.3",
|
||||||
"p-retry": "^6.2.0",
|
"p-retry": "^6.2.0",
|
||||||
"schema-utils": "^4.2.0",
|
"schema-utils": "^4.2.0",
|
||||||
"selfsigned": "^2.4.1",
|
"selfsigned": "^5.5.0",
|
||||||
"serve-index": "^1.9.1",
|
"serve-index": "^1.9.1",
|
||||||
"sockjs": "^0.3.24",
|
"sockjs": "^0.3.24",
|
||||||
"spdy": "^4.0.2",
|
"spdy": "^4.0.2",
|
||||||
|
|||||||
@@ -200,9 +200,6 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
)
|
)
|
||||||
|
|
||||||
for model_config in self.config.classification.custom.values():
|
for model_config in self.config.classification.custom.values():
|
||||||
if not model_config.enabled:
|
|
||||||
continue
|
|
||||||
|
|
||||||
self.realtime_processors.append(
|
self.realtime_processors.append(
|
||||||
CustomStateClassificationProcessor(
|
CustomStateClassificationProcessor(
|
||||||
self.config, model_config, self.requestor, self.metrics
|
self.config, model_config, self.requestor, self.metrics
|
||||||
@@ -335,25 +332,6 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
for processor in self.post_processors:
|
for processor in self.post_processors:
|
||||||
processor.update_config(topic, payload)
|
processor.update_config(topic, payload)
|
||||||
|
|
||||||
def _remove_custom_classification_processor(self, model_name: str) -> None:
|
|
||||||
"""Shut down and drop any running processor for a custom model."""
|
|
||||||
remaining = []
|
|
||||||
for processor in self.realtime_processors:
|
|
||||||
if (
|
|
||||||
isinstance(
|
|
||||||
processor,
|
|
||||||
(
|
|
||||||
CustomStateClassificationProcessor,
|
|
||||||
CustomObjectClassificationProcessor,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
and processor.model_config.name == model_name
|
|
||||||
):
|
|
||||||
processor.shutdown()
|
|
||||||
else:
|
|
||||||
remaining.append(processor)
|
|
||||||
self.realtime_processors = remaining
|
|
||||||
|
|
||||||
def _handle_custom_classification_update(
|
def _handle_custom_classification_update(
|
||||||
self, topic: str, model_config: Any
|
self, topic: str, model_config: Any
|
||||||
) -> None:
|
) -> None:
|
||||||
@@ -361,7 +339,23 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
model_name = topic.split("/")[-1]
|
model_name = topic.split("/")[-1]
|
||||||
|
|
||||||
if model_config is None:
|
if model_config is None:
|
||||||
self._remove_custom_classification_processor(model_name)
|
remaining = []
|
||||||
|
for processor in self.realtime_processors:
|
||||||
|
if (
|
||||||
|
isinstance(
|
||||||
|
processor,
|
||||||
|
(
|
||||||
|
CustomStateClassificationProcessor,
|
||||||
|
CustomObjectClassificationProcessor,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
and processor.model_config.name == model_name
|
||||||
|
):
|
||||||
|
processor.shutdown()
|
||||||
|
else:
|
||||||
|
remaining.append(processor)
|
||||||
|
self.realtime_processors = remaining
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Successfully removed classification processor for model: {model_name}"
|
f"Successfully removed classification processor for model: {model_name}"
|
||||||
)
|
)
|
||||||
@@ -369,13 +363,6 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
|
|
||||||
self.config.classification.custom[model_name] = model_config
|
self.config.classification.custom[model_name] = model_config
|
||||||
|
|
||||||
# A disabled model must not run; tear down any existing processor and
|
|
||||||
# do not register a new one.
|
|
||||||
if not model_config.enabled:
|
|
||||||
self._remove_custom_classification_processor(model_name)
|
|
||||||
logger.info(f"Disabled classification processor for model: {model_name}")
|
|
||||||
return
|
|
||||||
|
|
||||||
# Check if processor already exists
|
# Check if processor already exists
|
||||||
for processor in self.realtime_processors:
|
for processor in self.realtime_processors:
|
||||||
if isinstance(
|
if isinstance(
|
||||||
@@ -715,11 +702,7 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
and "license_plate" not in camera_config.objects.track
|
and "license_plate" not in camera_config.objects.track
|
||||||
)
|
)
|
||||||
|
|
||||||
has_enabled_custom = any(
|
if not dedicated_lpr_enabled and len(self.config.classification.custom) == 0:
|
||||||
c.enabled for c in self.config.classification.custom.values()
|
|
||||||
)
|
|
||||||
|
|
||||||
if not dedicated_lpr_enabled and not has_enabled_custom:
|
|
||||||
# no active features that use this data
|
# no active features that use this data
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -1,106 +0,0 @@
|
|||||||
"""Tests that disabled custom classification models are not registered or run."""
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import unittest
|
|
||||||
from unittest.mock import MagicMock
|
|
||||||
|
|
||||||
# Mock TFLite before importing the maintainer / classification modules
|
|
||||||
_MOCK_MODULES = [
|
|
||||||
"tflite_runtime",
|
|
||||||
"tflite_runtime.interpreter",
|
|
||||||
"ai_edge_litert",
|
|
||||||
"ai_edge_litert.interpreter",
|
|
||||||
]
|
|
||||||
for mod in _MOCK_MODULES:
|
|
||||||
if mod not in sys.modules:
|
|
||||||
sys.modules[mod] = MagicMock()
|
|
||||||
|
|
||||||
from frigate.data_processing.real_time.custom_classification import ( # noqa: E402
|
|
||||||
CustomObjectClassificationProcessor,
|
|
||||||
)
|
|
||||||
from frigate.embeddings.maintainer import EmbeddingMaintainer # noqa: E402
|
|
||||||
|
|
||||||
|
|
||||||
class TestCustomClassificationEnabledGating(unittest.TestCase):
|
|
||||||
"""A model with enabled: false must not keep a processor registered."""
|
|
||||||
|
|
||||||
def _make_maintainer(self) -> EmbeddingMaintainer:
|
|
||||||
# Bypass the heavy __init__; only the attributes touched by the
|
|
||||||
# config update path are needed for these tests.
|
|
||||||
maintainer = EmbeddingMaintainer.__new__(EmbeddingMaintainer)
|
|
||||||
maintainer.realtime_processors = []
|
|
||||||
maintainer.config = MagicMock()
|
|
||||||
maintainer.config.classification.custom = {}
|
|
||||||
maintainer.requestor = MagicMock()
|
|
||||||
maintainer.metrics = MagicMock()
|
|
||||||
maintainer.event_metadata_publisher = MagicMock()
|
|
||||||
return maintainer
|
|
||||||
|
|
||||||
def _make_model_config(self, name: str, enabled: bool) -> MagicMock:
|
|
||||||
model_config = MagicMock()
|
|
||||||
model_config.name = name
|
|
||||||
model_config.enabled = enabled
|
|
||||||
model_config.state_config = None
|
|
||||||
return model_config
|
|
||||||
|
|
||||||
def _make_processor(self, name: str) -> MagicMock:
|
|
||||||
processor = MagicMock(spec=CustomObjectClassificationProcessor)
|
|
||||||
processor.model_config = MagicMock()
|
|
||||||
processor.model_config.name = name
|
|
||||||
return processor
|
|
||||||
|
|
||||||
def test_disabled_update_tears_down_existing_processor(self):
|
|
||||||
"""Toggling a running model to disabled shuts down and drops its processor."""
|
|
||||||
maintainer = self._make_maintainer()
|
|
||||||
processor = self._make_processor("atli")
|
|
||||||
maintainer.realtime_processors = [processor]
|
|
||||||
|
|
||||||
maintainer._handle_custom_classification_update(
|
|
||||||
"config/classification/custom/atli",
|
|
||||||
self._make_model_config("atli", enabled=False),
|
|
||||||
)
|
|
||||||
|
|
||||||
processor.shutdown.assert_called_once()
|
|
||||||
self.assertEqual(maintainer.realtime_processors, [])
|
|
||||||
|
|
||||||
def test_disabled_update_does_not_register_processor(self):
|
|
||||||
"""A disabled model that has no processor is never registered."""
|
|
||||||
maintainer = self._make_maintainer()
|
|
||||||
|
|
||||||
maintainer._handle_custom_classification_update(
|
|
||||||
"config/classification/custom/atli",
|
|
||||||
self._make_model_config("atli", enabled=False),
|
|
||||||
)
|
|
||||||
|
|
||||||
self.assertEqual(maintainer.realtime_processors, [])
|
|
||||||
|
|
||||||
def test_disabled_update_leaves_other_processors_untouched(self):
|
|
||||||
"""Disabling one model must not affect other running processors."""
|
|
||||||
maintainer = self._make_maintainer()
|
|
||||||
other = self._make_processor("simbi")
|
|
||||||
maintainer.realtime_processors = [other]
|
|
||||||
|
|
||||||
maintainer._handle_custom_classification_update(
|
|
||||||
"config/classification/custom/atli",
|
|
||||||
self._make_model_config("atli", enabled=False),
|
|
||||||
)
|
|
||||||
|
|
||||||
other.shutdown.assert_not_called()
|
|
||||||
self.assertEqual(maintainer.realtime_processors, [other])
|
|
||||||
|
|
||||||
def test_removed_model_tears_down_processor(self):
|
|
||||||
"""A None payload (model deleted) still shuts down its processor."""
|
|
||||||
maintainer = self._make_maintainer()
|
|
||||||
processor = self._make_processor("atli")
|
|
||||||
maintainer.realtime_processors = [processor]
|
|
||||||
|
|
||||||
maintainer._handle_custom_classification_update(
|
|
||||||
"config/classification/custom/atli", None
|
|
||||||
)
|
|
||||||
|
|
||||||
processor.shutdown.assert_called_once()
|
|
||||||
self.assertEqual(maintainer.realtime_processors, [])
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
unittest.main()
|
|
||||||
@@ -1490,14 +1490,7 @@
|
|||||||
"keyLabel": "Key",
|
"keyLabel": "Key",
|
||||||
"valueLabel": "Value",
|
"valueLabel": "Value",
|
||||||
"keyPlaceholder": "New key",
|
"keyPlaceholder": "New key",
|
||||||
"remove": "Remove",
|
"remove": "Remove"
|
||||||
"providerNameLabel": "Provider name",
|
|
||||||
"providerNamePlaceholder": "e.g., openai",
|
|
||||||
"variableNameLabel": "Variable name",
|
|
||||||
"variableNamePlaceholder": "e.g., MY_VARIABLE",
|
|
||||||
"loggerNameLabel": "Logger name",
|
|
||||||
"loggerNamePlaceholder": "e.g., frigate.record",
|
|
||||||
"keyPatternError": "Use only letters, numbers, hyphens, and underscores (no spaces)"
|
|
||||||
},
|
},
|
||||||
"knownPlates": {
|
"knownPlates": {
|
||||||
"namePlaceholder": "e.g., Wife's Car",
|
"namePlaceholder": "e.g., Wife's Car",
|
||||||
|
|||||||
@@ -7,13 +7,7 @@ const environmentVars: SectionConfigOverrides = {
|
|||||||
advancedFields: [],
|
advancedFields: [],
|
||||||
uiSchema: {
|
uiSchema: {
|
||||||
additionalProperties: {
|
additionalProperties: {
|
||||||
"ui:options": {
|
"ui:options": { size: "lg" },
|
||||||
size: "lg",
|
|
||||||
additionalPropertyKeyLabel:
|
|
||||||
"configForm.additionalProperties.variableNameLabel",
|
|
||||||
additionalPropertyKeyPlaceholder:
|
|
||||||
"configForm.additionalProperties.variableNamePlaceholder",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,15 +9,7 @@ const genai: SectionConfigOverrides = {
|
|||||||
uiSchema: {
|
uiSchema: {
|
||||||
"ui:options": { disableNestedCard: true },
|
"ui:options": { disableNestedCard: true },
|
||||||
"*": {
|
"*": {
|
||||||
"ui:options": {
|
"ui:options": { disableNestedCard: true },
|
||||||
disableNestedCard: true,
|
|
||||||
additionalPropertyKeyLabel:
|
|
||||||
"configForm.additionalProperties.providerNameLabel",
|
|
||||||
additionalPropertyKeyPlaceholder:
|
|
||||||
"configForm.additionalProperties.providerNamePlaceholder",
|
|
||||||
additionalPropertyKeyPattern: "^[a-zA-Z0-9_-]+$",
|
|
||||||
preventKeyRename: true,
|
|
||||||
},
|
|
||||||
"ui:order": [
|
"ui:order": [
|
||||||
"provider",
|
"provider",
|
||||||
"api_key",
|
"api_key",
|
||||||
|
|||||||
@@ -12,13 +12,7 @@ const logger: SectionConfigOverrides = {
|
|||||||
},
|
},
|
||||||
logs: {
|
logs: {
|
||||||
additionalProperties: {
|
additionalProperties: {
|
||||||
"ui:options": {
|
"ui:options": { enumI18nPrefix: "logger.logLevel" },
|
||||||
enumI18nPrefix: "logger.logLevel",
|
|
||||||
additionalPropertyKeyLabel:
|
|
||||||
"configForm.additionalProperties.loggerNameLabel",
|
|
||||||
additionalPropertyKeyPlaceholder:
|
|
||||||
"configForm.additionalProperties.loggerNamePlaceholder",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,14 +6,12 @@ import {
|
|||||||
StrictRJSFSchema,
|
StrictRJSFSchema,
|
||||||
WrapIfAdditionalTemplateProps,
|
WrapIfAdditionalTemplateProps,
|
||||||
} from "@rjsf/utils";
|
} from "@rjsf/utils";
|
||||||
import { useEffect, useMemo, useState, type FocusEvent } from "react";
|
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { LuTrash2 } from "react-icons/lu";
|
import { LuTrash2 } from "react-icons/lu";
|
||||||
import type { ConfigFormContext } from "@/types/configForm";
|
|
||||||
|
|
||||||
export function WrapIfAdditionalTemplate<
|
export function WrapIfAdditionalTemplate<
|
||||||
T = unknown,
|
T = unknown,
|
||||||
@@ -32,7 +30,6 @@ export function WrapIfAdditionalTemplate<
|
|||||||
onKeyRenameBlur,
|
onKeyRenameBlur,
|
||||||
readonly,
|
readonly,
|
||||||
required,
|
required,
|
||||||
registry,
|
|
||||||
schema,
|
schema,
|
||||||
uiSchema,
|
uiSchema,
|
||||||
} = props;
|
} = props;
|
||||||
@@ -41,55 +38,6 @@ export function WrapIfAdditionalTemplate<
|
|||||||
|
|
||||||
const additional = ADDITIONAL_PROPERTY_FLAG in schema;
|
const additional = ADDITIONAL_PROPERTY_FLAG in schema;
|
||||||
|
|
||||||
const uiOptions = getUiOptions(uiSchema);
|
|
||||||
const keyIsReadonly = uiOptions.additionalPropertyKeyReadonly === true;
|
|
||||||
|
|
||||||
const keyLabelKey =
|
|
||||||
typeof uiOptions.additionalPropertyKeyLabel === "string"
|
|
||||||
? uiOptions.additionalPropertyKeyLabel
|
|
||||||
: undefined;
|
|
||||||
const keyPlaceholderKey =
|
|
||||||
typeof uiOptions.additionalPropertyKeyPlaceholder === "string"
|
|
||||||
? uiOptions.additionalPropertyKeyPlaceholder
|
|
||||||
: undefined;
|
|
||||||
const keyPattern =
|
|
||||||
typeof uiOptions.additionalPropertyKeyPattern === "string"
|
|
||||||
? uiOptions.additionalPropertyKeyPattern
|
|
||||||
: undefined;
|
|
||||||
const preventKeyRename = uiOptions.preventKeyRename === true;
|
|
||||||
|
|
||||||
const formContext = registry?.formContext as ConfigFormContext | undefined;
|
|
||||||
|
|
||||||
// optionally, lock the key once it's been saved
|
|
||||||
const baseline = formContext?.baselineFormData;
|
|
||||||
const keyLocked =
|
|
||||||
preventKeyRename &&
|
|
||||||
typeof label === "string" &&
|
|
||||||
!!baseline &&
|
|
||||||
Object.prototype.hasOwnProperty.call(baseline, label);
|
|
||||||
|
|
||||||
// controlled key value so we can validate live and block invalid renames.
|
|
||||||
const [keyValue, setKeyValue] = useState<string>(label ?? "");
|
|
||||||
useEffect(() => {
|
|
||||||
setKeyValue(label ?? "");
|
|
||||||
}, [label]);
|
|
||||||
|
|
||||||
const keyRegex = useMemo(
|
|
||||||
() => (keyPattern ? new RegExp(keyPattern) : undefined),
|
|
||||||
[keyPattern],
|
|
||||||
);
|
|
||||||
const keyError = useMemo(() => {
|
|
||||||
if (!keyRegex || keyLocked) return null;
|
|
||||||
if (!keyRegex.test(keyValue)) {
|
|
||||||
return t("configForm.additionalProperties.keyPatternError", {
|
|
||||||
ns: "views/settings",
|
|
||||||
defaultValue:
|
|
||||||
"Use only letters, numbers, hyphens, and underscores (no spaces)",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}, [keyRegex, keyLocked, keyValue, t]);
|
|
||||||
|
|
||||||
if (!additional) {
|
if (!additional) {
|
||||||
return (
|
return (
|
||||||
<div className={classNames} style={style}>
|
<div className={classNames} style={style}>
|
||||||
@@ -99,26 +47,20 @@ export function WrapIfAdditionalTemplate<
|
|||||||
}
|
}
|
||||||
|
|
||||||
const keyId = `${id}-key`;
|
const keyId = `${id}-key`;
|
||||||
const keyLabel = keyLabelKey
|
const keyLabel = t("configForm.additionalProperties.keyLabel", {
|
||||||
? t(keyLabelKey, { ns: "views/settings" })
|
ns: "views/settings",
|
||||||
: t("configForm.additionalProperties.keyLabel", { ns: "views/settings" });
|
});
|
||||||
const valueLabel = t("configForm.additionalProperties.valueLabel", {
|
const valueLabel = t("configForm.additionalProperties.valueLabel", {
|
||||||
ns: "views/settings",
|
ns: "views/settings",
|
||||||
});
|
});
|
||||||
const keyPlaceholder = keyPlaceholderKey
|
const keyPlaceholder = t("configForm.additionalProperties.keyPlaceholder", {
|
||||||
? t(keyPlaceholderKey, { ns: "views/settings" })
|
ns: "views/settings",
|
||||||
: t("configForm.additionalProperties.keyPlaceholder", {
|
});
|
||||||
ns: "views/settings",
|
|
||||||
});
|
|
||||||
const removeLabel = t("configForm.additionalProperties.remove", {
|
const removeLabel = t("configForm.additionalProperties.remove", {
|
||||||
ns: "views/settings",
|
ns: "views/settings",
|
||||||
});
|
});
|
||||||
|
const uiOptions = getUiOptions(uiSchema);
|
||||||
const commitKeyRename = (e: FocusEvent<HTMLInputElement>) => {
|
const keyIsReadonly = uiOptions.additionalPropertyKeyReadonly === true;
|
||||||
if (readonly) return;
|
|
||||||
if (keyError) return;
|
|
||||||
onKeyRenameBlur?.(e);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -128,30 +70,23 @@ export function WrapIfAdditionalTemplate<
|
|||||||
{!keyIsReadonly && (
|
{!keyIsReadonly && (
|
||||||
<div className="col-span-12 space-y-2 md:col-span-2">
|
<div className="col-span-12 space-y-2 md:col-span-2">
|
||||||
{displayLabel && <Label htmlFor={keyId}>{keyLabel}</Label>}
|
{displayLabel && <Label htmlFor={keyId}>{keyLabel}</Label>}
|
||||||
{keyLocked ? (
|
{keyIsReadonly ? (
|
||||||
<div
|
<div
|
||||||
id={keyId}
|
id={keyId}
|
||||||
className="flex items-center break-all text-sm text-primary-variant"
|
className="flex items-center text-sm text-muted-foreground"
|
||||||
>
|
>
|
||||||
{label}
|
{label}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<Input
|
||||||
<Input
|
id={keyId}
|
||||||
id={keyId}
|
name={keyId}
|
||||||
name={keyId}
|
required={required}
|
||||||
required={required}
|
defaultValue={label}
|
||||||
value={keyValue}
|
placeholder={keyPlaceholder}
|
||||||
placeholder={keyPlaceholder}
|
disabled={disabled || readonly}
|
||||||
disabled={disabled || readonly}
|
onBlur={!readonly ? onKeyRenameBlur : undefined}
|
||||||
onChange={(e) => setKeyValue(e.target.value)}
|
/>
|
||||||
onBlur={!readonly ? commitKeyRename : undefined}
|
|
||||||
aria-invalid={keyError ? true : undefined}
|
|
||||||
/>
|
|
||||||
{keyError && (
|
|
||||||
<p className="text-xs text-destructive">{keyError}</p>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user