fix: enable wss connections and add certificate verification toggle in WebSocket Client (#1823)
* fix: enable wss connections and add certificate verification toggle in WebSocket Client Previous behavior: the WebSocket Client only supported unencrypted ws:// connections; wss:// URLs were not handled and would fail to connect, providing no option to disable TLS certificate validation for development or self-signed certificates. Fixed behavior: secure WebSocket connections (wss://) are now fully supported. A verifyCertificate configuration option has been introduced, defaulting to true. When set to false, certificate errors (e.g., self-signed certificates) are ignored, enabling safe local testing while maintaining strict validation by default for production. * fix: improve wss certificate verification and add tests Previous behavior: wsOptions used 'any' type without type safety, verifyCertificate was added to napcat-protocol without implementation, and no tests existed for the new config option. Fixed behavior: wsOptions now uses proper WebSocket.ClientOptions type for compile-time safety, verifyCertificate removed from napcat-protocol (no WebSocket client implementation exists there), and comprehensive tests added to validate config loading and default values.
This commit is contained in:
1 parent
25db6f0835
commit
8996b35dd1
5 files changed
+72
-5
No files matched your search
@@ -59,6 +59,7 @@ const WebsocketClientConfigSchema = Type.Object({
|
||||
token: Type.String({ default: '' }),
|
||||
debug: Type.Boolean({ default: false }),
|
||||
heartInterval: Type.Number({ default: 30000 }),
|
||||
verifyCertificate: Type.Optional(Type.Boolean({ default: true })),
|
||||
});
|
||||
|
||||
const PluginConfigSchema = Type.Object({
|
||||
|
||||
Reference in new issue
Block a user