@@ -96,7 +96,7 @@ router.post('/', requireScope('nodes:write'), async (req, res) => {
9696 const {
9797 name, ip, domain, sni, port, portRange, statsPort,
9898 groups, ssh, paths, settings, rankingCoefficient,
99- type, xray, cascadeRole, country,
99+ type, xray, cascadeRole, country, comment ,
100100 hopInterval, acme, masquerade, bandwidth,
101101 ignoreClientBandwidth, speedTest, disableUDP,
102102 udpIdleTimeout, sniff, quic, resolver, acl,
@@ -151,6 +151,7 @@ router.post('/', requireScope('nodes:write'), async (req, res) => {
151151 rankingCoefficient : rankingCoefficient || 1.0 ,
152152 cascadeRole : cascadeRole || 'standalone' ,
153153 country : country || '' ,
154+ comment : typeof comment === 'string' ? comment . trim ( ) . slice ( 0 , 500 ) : '' ,
154155 initScript : req . body . initScript || '' ,
155156 active : true ,
156157 status : 'offline' ,
@@ -189,7 +190,7 @@ router.put('/:id', requireScope('nodes:write'), async (req, res) => {
189190 const allowedUpdates = [
190191 'name' , 'domain' , 'sni' , 'port' , 'portRange' , 'statsPort' ,
191192 'groups' , 'ssh' , 'paths' , 'settings' , 'active' , 'rankingCoefficient' ,
192- 'type' , 'xray' , 'cascadeRole' , 'country' ,
193+ 'type' , 'xray' , 'cascadeRole' , 'country' , 'comment' ,
193194 'hopInterval' , 'acme' , 'masquerade' , 'bandwidth' ,
194195 'ignoreClientBandwidth' , 'speedTest' , 'disableUDP' ,
195196 'udpIdleTimeout' , 'sniff' , 'quic' , 'resolver' , 'acl' ,
@@ -199,9 +200,15 @@ router.put('/:id', requireScope('nodes:write'), async (req, res) => {
199200 const updates = { } ;
200201 for ( const key of allowedUpdates ) {
201202 if ( req . body [ key ] !== undefined ) {
202- updates [ key ] = key === 'ssh'
203- ? cryptoService . encryptSshCredentials ( req . body [ key ] )
204- : req . body [ key ] ;
203+ if ( key === 'ssh' ) {
204+ updates [ key ] = cryptoService . encryptSshCredentials ( req . body [ key ] ) ;
205+ } else if ( key === 'comment' ) {
206+ updates [ key ] = typeof req . body [ key ] === 'string'
207+ ? req . body [ key ] . trim ( ) . slice ( 0 , 500 )
208+ : '' ;
209+ } else {
210+ updates [ key ] = req . body [ key ] ;
211+ }
205212 }
206213 }
207214
0 commit comments