File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1311,9 +1311,16 @@ public function list_crawlers() {
13111311
13121312 $ this_cookie_key = 'cookie: ' . $ v ['name ' ];
13131313
1314- $ crawler_factors [ $ this_cookie_key ] = [];
1314+ // Preserves Guest Mode preset when same-name cookie row arrives.
1315+ if ( ! isset ( $ crawler_factors [ $ this_cookie_key ] ) ) {
1316+ $ crawler_factors [ $ this_cookie_key ] = [];
1317+ }
13151318
13161319 foreach ( $ v ['vals ' ] as $ v2 ) {
1320+ // Preserve existing labels (e.g. Guest Mode 👒 marker on `_null`) — skip if value already mapped.
1321+ if ( isset ( $ crawler_factors [ $ this_cookie_key ][ $ v2 ] ) ) {
1322+ continue ;
1323+ }
13171324 $ crawler_factors [ $ this_cookie_key ][ $ v2 ] =
13181325 ( '_null ' === $ v2 ? '' : '<font data-balloon-pos="up" aria-label="Cookie">🍪</font> ' . esc_html ( $ v ['name ' ] ) . '= ' . esc_html ( $ v2 ) );
13191326 }
Original file line number Diff line number Diff line change @@ -135,15 +135,23 @@ public static function inject_vary_row( $cookies ) {
135135
136136 $ vary_name = \LiteSpeed \Vary::cls ()->get_vary_name ();
137137
138- // Strip only when injecting — preserves manually configured rows on unpicked sites.
139- $ cookies = array_values (array_filter (
140- $ cookies ,
141- function ( $ c ) use ( $ vary_name ) {
142- return is_array ($ c ) && isset ($ c ['name ' ]) && $ vary_name !== $ c ['name ' ];
138+ // Merge with admin's same-name rows
139+ $ existing_vals = [];
140+ $ other_rows = [];
141+ foreach ($ cookies as $ c ) {
142+ if (is_array ($ c ) && isset ($ c ['name ' ]) && $ vary_name === $ c ['name ' ]) {
143+ if (!empty ($ c ['vals ' ]) && is_array ($ c ['vals ' ])) {
144+ $ existing_vals = array_merge ($ existing_vals , $ c ['vals ' ]);
145+ }
146+ } else {
147+ $ other_rows [] = $ c ;
143148 }
144- ));
145- $ cookies [] = [ 'name ' => $ vary_name , 'vals ' => $ vals ];
146- return $ cookies ;
149+ }
150+ $ other_rows [] = [
151+ 'name ' => $ vary_name ,
152+ 'vals ' => array_values (array_unique (array_merge ($ existing_vals , $ vals ))),
153+ ];
154+ return $ other_rows ;
147155 }
148156
149157 /**
You can’t perform that action at this time.
0 commit comments