refactor: introduce constants for improved maintainability in tests and server configurations

- Added constants for test endpoints, usernames, and XML headers in client_test.go and device_certificates_test.go to enhance readability and reduce hardcoded values.
- Updated various test cases to utilize these constants, ensuring consistency across tests.
- Refactored imaging settings and server configurations to use defined constants for default values, improving clarity and maintainability in server/device.go and server/imaging.go.
- Enhanced comments throughout the code to clarify functionality and adhere to best practices.
This commit is contained in:
0x524a
2025-12-02 21:39:54 -05:00
parent 31df3f8b79
commit c1daba5be6
25 changed files with 253 additions and 159 deletions
+2 -2
View File
@@ -306,8 +306,8 @@ func (s *Server) HandleRelativeMove(body interface{}) (interface{}, error) {
}
// Clamp values to valid ranges (simplified)
const maxPan = 180 //nolint:mnd // PTZ pan range
const maxTilt = 90 //nolint:mnd // PTZ tilt range
const maxPan = 180 //nolint:mnd // PTZ pan range
const maxTilt = 90 //nolint:mnd // PTZ tilt range
state.Position.Pan = clamp(state.Position.Pan, -maxPan, maxPan)
state.Position.Tilt = clamp(state.Position.Tilt, -maxTilt, maxTilt)
state.Position.Zoom = clamp(state.Position.Zoom, 0, 1)