EasyNVR is a streaming media video platform based on RTSP protocol webcam/NVR. It can access network hard disk video recorders and NVR devices such as Haikang, Dahua, and Univision without installing video playback plug-ins from various security equipment manufacturers. If you need the Internet to access the video of the front-end equipment, you can also deploy the EasyNVS video management platform on the external network to perform network penetration and video interaction.
The EasyNVS video management platform can access EasyNVR on the configuration page. However, we found an error "APIAuth eq|eq" when submitting during a configuration.
analyse problem
Here is the error prompted when submitting the EasyNVS basic configuration, so we check the request sent by the browser console.
The parameter passed from the front end is "false". Watch the back-end interface below.
The APIAuth parameter limit can only pass "0" or "1", and the parameter passed from the front end is "false", so an error was reported.
Solve the problem
There are two solutions. The first modifies the front end, and the second modifies the back end. Let's start troubleshooting from the front end.
1. Watch the front-end code
onAPIAuth (data) {
data=='0'?this.APIAuth='1':this.APIAuth='0'
// console.log(this.APIAuth)
},
This is the click event of the select button. Here, the APIAuth parameter will be changed to "0" or "1". Why does the submission still report an error?
2. Continue to view the interface.
It is found that when obtaining the configuration interface, the parameter passed from the back end to the front end is "false". At this point we can understand that it is the backend error, so check the backend below.
3. Check the back-end interface for obtaining configuration.
func (h *APIHandler) GetBaseConfig(c *gin.Context) {
sec := utils.Conf().Section("nvs")
c.IndentedJSON(http.StatusOK, gin.H{
"Host": sec.Key("host").MustString(utils.LocalIP()),
"Port": sec.Key("port").MustUint(10812),
"DevicePassword": sec.Key("device_password").MustString(""),
"APIAuth": utils.Conf().Section("http").Key("api_auth").MustString("0"),
})
}
Here, the APIAuth parameter is read from the configuration file. If it cannot be read, it is "0". Check the configuration file and find that there is no api_auth parameter under http.
4. So we can set the default value of api_auth to 1 in the ini configuration file. In this way, False will not be reported back to the front end, and no more errors will be reported.
About EasyNVS
EasyNVR docking with EasyNVS can use the network to achieve on-demand live broadcast, while shielding various network environment problems. It is suitable for wired, WIFI, 4G, and private networks. The EasyNVS management platform can obtain all the capabilities of EasyNVR, and perform Internet-based output, while unifying Management and interface output.