6868 # map-controls button { background : rgba (22 , 33 , 62 , 0.9 ); border : 1px solid rgba (255 , 255 , 255 , 0.15 ); color : # eee ; padding : 6px 12px ; border-radius : 6px ; font-size : 12px ; cursor : pointer; }
6969 # map-controls button : hover { background : rgba (22 , 33 , 62 , 1 ); }
7070 # map-controls button .active { background : # 0f3460 ; border-color : # 4fc3f7 ; color : # 4fc3f7 ; }
71- # map-controls button .purge { border-color : # e57373 ; color : # e57373 ; }
72- # map-controls button .purge : hover { background : rgba (229 , 115 , 115 , 0.15 ); }
73- # map-controls button .purge .active { background : # e57373 ; color : # fff ; border-color : # e57373 ; }
71+ # map-controls button .fresh-tiles { border-color : # e57373 ; color : # e57373 ; }
72+ # map-controls button .fresh-tiles : hover { background : rgba (229 , 115 , 115 , 0.15 ); }
73+ # map-controls button .fresh-tiles .active { background : # e57373 ; color : # fff ; border-color : # e57373 ; }
7474 # zoom-level { background : rgba (22 , 33 , 62 , 0.9 ); padding : 8px 14px ; border-radius : 6px ; font-size : 13px ; pointer-events : auto; }
7575
7676 /* Tile info */
@@ -135,7 +135,7 @@ <h2>Martin</h2>
135135 < div id ="map-header ">
136136 < div id ="map-controls ">
137137 < button id ="btn-grid " onclick ="toggleGrid() "> Grid</ button >
138- < button id ="btn-purge " class ="purge " onclick ="togglePurge () " title ="Toggle cache bypass: tiles load fresh from Martin "> Purge Cache </ button >
138+ < button id ="btn-fresh-tiles " class ="fresh-tiles " onclick ="toggleFreshTiles () " title ="Toggle cache bypass: tiles load fresh from Martin "> Req Fresh Tiles </ button >
139139 </ div >
140140 < div id ="zoom-level "> z0</ div >
141141 </ div >
@@ -198,20 +198,20 @@ <h2>Martin</h2>
198198 }
199199 document . getElementById ( 'btn-grid' ) . classList . add ( 'active' ) ;
200200
201- // Purge mode: toggle ?purge =1 on all tile requests to bypass nginx cache
201+ // Fresh tiles mode: toggle ?fresh_tiles =1 on all tile requests to bypass nginx cache
202202 // cacheBuster is appended to tile URLs to defeat MapLibre's in-memory cache.
203- // It is incremented each time purge is toggled off, so MapLibre sees new URLs
203+ // It is incremented each time fresh tiles is toggled off, so MapLibre sees new URLs
204204 // and re-fetches from nginx (which already has the fresh tiles from BYPASS).
205- let purgeMode = false ;
205+ let freshTilesMode = false ;
206206 let cacheBuster = 0 ;
207207
208- function togglePurge ( ) {
209- purgeMode = ! purgeMode ;
210- const btn = document . getElementById ( 'btn-purge ' ) ;
211- btn . classList . toggle ( 'active' , purgeMode ) ;
212- btn . textContent = purgeMode ? 'Purge ON' : 'Purge Cache ' ;
208+ function toggleFreshTiles ( ) {
209+ freshTilesMode = ! freshTilesMode ;
210+ const btn = document . getElementById ( 'btn-fresh-tiles ' ) ;
211+ btn . classList . toggle ( 'active' , freshTilesMode ) ;
212+ btn . textContent = freshTilesMode ? 'Fresh Tiles ON' : 'Fresh Tiles ' ;
213213
214- if ( ! purgeMode ) {
214+ if ( ! freshTilesMode ) {
215215 // Increment cache buster so MapLibre treats all tile URLs as new
216216 cacheBuster ++ ;
217217 }
@@ -224,10 +224,10 @@ <h2>Martin</h2>
224224 if ( ! source || ! source . tiles ) return ;
225225 const urls = source . tiles . map ( url => {
226226 const base = url . split ( '?' ) [ 0 ] ;
227- if ( purgeMode ) {
228- return base + '?purge =1&_v=' + cacheBuster ;
227+ if ( freshTilesMode ) {
228+ return base + '?fresh_tiles =1&_v=' + cacheBuster ;
229229 }
230- // cacheBuster > 0 means we've done at least one purge cycle
230+ // cacheBuster > 0 means we've done at least one fresh tiles cycle
231231 return cacheBuster > 0 ? base + '?_v=' + cacheBuster : base ;
232232 } ) ;
233233 source . setTiles ( urls ) ;
@@ -429,7 +429,7 @@ <h2>Martin</h2>
429429 async function addCompositeSource ( group ) {
430430 const compositeFns = group . functions . join ( ',' ) ;
431431 const sourceId = `src-composite-${ group . name } ` ;
432- // Use /maps/{group}/ route which goes through nginx cache + purge support,
432+ // Use /maps/{group}/ route which goes through nginx cache + fresh_tiles support,
433433 // instead of Martin's native TileJSON URLs which bypass cache.
434434 const cachedTileUrl = `${ MARTIN_BASE } /maps/${ group . name } /{z}/{x}/{y}.pbf` ;
435435 const tileJsonUrl = `${ MARTIN_BASE } /${ compositeFns } ` ;
@@ -470,7 +470,7 @@ <h2>Martin</h2>
470470 } ) ;
471471
472472 activeSources [ '__composite__' ] = { sourceId, layerIds, color : '#4fc3f7' } ;
473- if ( purgeMode || cacheBuster > 0 ) applyTileUrls ( ) ;
473+ if ( freshTilesMode || cacheBuster > 0 ) applyTileUrls ( ) ;
474474 } catch ( e ) {
475475 console . error ( 'Failed to add composite source:' , e ) ;
476476 }
@@ -608,7 +608,7 @@ <h2>Martin</h2>
608608 }
609609
610610 activeSources [ name ] = { sourceId, layerIds, color } ;
611- if ( purgeMode || cacheBuster > 0 ) applyTileUrls ( ) ;
611+ if ( freshTilesMode || cacheBuster > 0 ) applyTileUrls ( ) ;
612612 const el = document . getElementById ( `src-item-${ name } ` ) ;
613613 if ( el ) el . classList . add ( 'active' ) ;
614614 }
0 commit comments