@@ -69,7 +69,7 @@ function get_inbound_uci_description(config, key) {
69
69
}
70
70
const uci_key = key . slice ( - 9 ) ;
71
71
const uci_item = uci . get ( config , uci_key ) ;
72
- if ( uci_item == null ) {
72
+ if ( uci_item === null ) {
73
73
return key ;
74
74
}
75
75
switch ( uci_item [ ".type" ] ) {
@@ -96,7 +96,7 @@ function get_outbound_uci_description(config, key) {
96
96
}
97
97
const uci_key = key . slice ( - 9 ) ;
98
98
const uci_item = uci . get ( config , uci_key ) ;
99
- if ( uci_item == null ) {
99
+ if ( uci_item === null ) {
100
100
return "direct" ;
101
101
}
102
102
switch ( uci_item [ ".type" ] ) {
@@ -120,7 +120,7 @@ function outbound_first_tag_format(tag_split, first_uci_description) {
120
120
let result = [ tag_split [ 0 ] ] ;
121
121
122
122
const first_tag = tag_split [ 0 ] . split ( ":" ) ;
123
- if ( first_tag . length == 1 ) {
123
+ if ( first_tag . length === 1 ) {
124
124
return result ;
125
125
}
126
126
@@ -200,9 +200,9 @@ function outbound_middle_tag_format(tag_split, first_uci_description, current_ta
200
200
}
201
201
202
202
function outbound_last_tag_format ( first_uci_description , last_tag , last_uci_description ) {
203
- if ( last_tag [ 0 ] == "tcp_outbound" ) {
203
+ if ( last_tag [ 0 ] === "tcp_outbound" ) {
204
204
return shared . badge ( `{ tcp: <strong>${ first_uci_description } </strong> }` ) ;
205
- } else if ( last_tag [ 0 ] == "udp_outbound" ) {
205
+ } else if ( last_tag [ 0 ] === "udp_outbound" ) {
206
206
return shared . badge ( `{ udp: <strong>${ first_uci_description } </strong> }` ) ;
207
207
}
208
208
return shared . badge ( `{ ${ last_tag [ 0 ] } : <strong>${ last_uci_description } </strong> }` , last_tag [ 1 ] ) ;
@@ -216,7 +216,7 @@ function get_outbound_description(config, tag) {
216
216
for ( let i = 1 ; i < tag_split . length ; i ++ ) {
217
217
const current_tag = tag_split [ i ] . split ( ":" ) ;
218
218
const current_uci_description = get_outbound_uci_description ( config , current_tag [ 1 ] ) ;
219
- if ( i == tag_split . length - 1 ) {
219
+ if ( i === tag_split . length - 1 ) {
220
220
result . push ( " " , outbound_last_tag_format ( first_uci_description , current_tag , current_uci_description ) ) ;
221
221
} else {
222
222
result . push ( " " , outbound_middle_tag_format ( tag_split , first_uci_description , current_tag , current_uci_description ) ) ;
@@ -247,7 +247,12 @@ function observatory(vars, config) {
247
247
}
248
248
return _ ( "<i>unreachable</i>" ) ;
249
249
} ( v ) ) ,
250
- E ( 'td' , { 'class' : 'td' } , '%d' . format ( greater_than_zero ( now_timestamp - v [ 1 ] [ "last_seen_time" ] ) ) + _ ( 's ago' ) ) ,
250
+ E ( 'td' , { 'class' : 'td' } , function ( c ) {
251
+ if ( c [ 1 ] [ "last_seen_time" ] === undefined ) {
252
+ return _ ( "<i>never</i>" ) ;
253
+ }
254
+ return '%d' . format ( greater_than_zero ( now_timestamp - c [ 1 ] [ "last_seen_time" ] ) ) + _ ( 's ago' ) ;
255
+ } ( v ) ) ,
251
256
E ( 'td' , { 'class' : 'td' } , '%d' . format ( greater_than_zero ( now_timestamp - v [ 1 ] [ "last_try_time" ] ) ) + _ ( 's ago' ) ) ,
252
257
] ) )
253
258
] )
0 commit comments