Spaces:
Running
Running
feat(telemetry): admin-only link in header; map page view telemetry
Browse files- static/index.html +3 -2
- static/js/tree-track-app.js +9 -0
- static/map.html +25 -2
- static/sw.js +1 -1
- version.json +1 -1
static/index.html
CHANGED
@@ -917,7 +917,7 @@
|
|
917 |
// Force refresh if we detect cached version
|
918 |
(function() {
|
919 |
const currentVersion = '5.1.1';
|
920 |
-
const timestamp = '
|
921 |
const lastVersion = sessionStorage.getItem('treetrack_version');
|
922 |
const lastTimestamp = sessionStorage.getItem('treetrack_timestamp');
|
923 |
|
@@ -955,6 +955,7 @@
|
|
955 |
</div>
|
956 |
</div>
|
957 |
<a href="/static/map.html" class="tt-btn tt-btn-secondary">View Map</a>
|
|
|
958 |
<button id="logoutBtn" class="tt-btn tt-btn-secondary">Logout</button>
|
959 |
</div>
|
960 |
</div>
|
@@ -1162,7 +1163,7 @@
|
|
1162 |
</div>
|
1163 |
</div>
|
1164 |
|
1165 |
-
<script type="module" src="/static/js/tree-track-app.js?v=5.1.1&t=
|
1166 |
|
1167 |
<script>
|
1168 |
// Initialize Granim background animation on page load
|
|
|
917 |
// Force refresh if we detect cached version
|
918 |
(function() {
|
919 |
const currentVersion = '5.1.1';
|
920 |
+
const timestamp = '1755113832'; // Cache-busting bump
|
921 |
const lastVersion = sessionStorage.getItem('treetrack_version');
|
922 |
const lastTimestamp = sessionStorage.getItem('treetrack_timestamp');
|
923 |
|
|
|
955 |
</div>
|
956 |
</div>
|
957 |
<a href="/static/map.html" class="tt-btn tt-btn-secondary">View Map</a>
|
958 |
+
<a href="/static/telemetry.html" class="tt-btn tt-btn-secondary" id="telemetryLink" style="display:none">Telemetry</a>
|
959 |
<button id="logoutBtn" class="tt-btn tt-btn-secondary">Logout</button>
|
960 |
</div>
|
961 |
</div>
|
|
|
1163 |
</div>
|
1164 |
</div>
|
1165 |
|
1166 |
+
<script type="module" src="/static/js/tree-track-app.js?v=5.1.1&t=1755113832"></script>
|
1167 |
|
1168 |
<script>
|
1169 |
// Initialize Granim background animation on page load
|
static/js/tree-track-app.js
CHANGED
@@ -44,6 +44,15 @@ export class TreeTrackApp {
|
|
44 |
status: 'view',
|
45 |
metadata: { page: 'index', action: 'load' }
|
46 |
}).catch(() => {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
// Load initial data
|
49 |
await this.loadInitialData();
|
|
|
44 |
status: 'view',
|
45 |
metadata: { page: 'index', action: 'load' }
|
46 |
}).catch(() => {});
|
47 |
+
|
48 |
+
// Show Telemetry link for admins
|
49 |
+
try {
|
50 |
+
const perms = (this.authManager.currentUser && this.authManager.currentUser.permissions) || [];
|
51 |
+
if (perms.includes('admin')) {
|
52 |
+
const link = document.getElementById('telemetryLink');
|
53 |
+
if (link) link.style.display = '';
|
54 |
+
}
|
55 |
+
} catch (_) { /* ignore */ }
|
56 |
|
57 |
// Load initial data
|
58 |
await this.loadInitialData();
|
static/map.html
CHANGED
@@ -813,7 +813,7 @@
|
|
813 |
// Force refresh if we detect cached version
|
814 |
(function() {
|
815 |
const currentVersion = '5.1.1';
|
816 |
-
const timestamp = '
|
817 |
const lastVersion = sessionStorage.getItem('treetrack_version');
|
818 |
const lastTimestamp = sessionStorage.getItem('treetrack_timestamp');
|
819 |
|
@@ -939,7 +939,7 @@ const timestamp = '1755113727'; // Current timestamp for cache busting
|
|
939 |
|
940 |
<!-- Leaflet JS -->
|
941 |
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
|
942 |
-
<script src="/static/map.js?v=5.1.1&t=
|
943 |
|
944 |
"default-state": {
|
945 |
gradients: [
|
@@ -957,5 +957,28 @@ const timestamp = '1755113727'; // Current timestamp for cache busting
|
|
957 |
console.log('Map header Granim with forest road background initialized synchronously');
|
958 |
});
|
959 |
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
960 |
</body>
|
961 |
</html>
|
|
|
813 |
// Force refresh if we detect cached version
|
814 |
(function() {
|
815 |
const currentVersion = '5.1.1';
|
816 |
+
const timestamp = '1755113832'; // Current timestamp for cache busting
|
817 |
const lastVersion = sessionStorage.getItem('treetrack_version');
|
818 |
const lastTimestamp = sessionStorage.getItem('treetrack_timestamp');
|
819 |
|
|
|
939 |
|
940 |
<!-- Leaflet JS -->
|
941 |
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
|
942 |
+
<script src="/static/map.js?v=5.1.1&t=1755113832">
|
943 |
|
944 |
"default-state": {
|
945 |
gradients: [
|
|
|
957 |
console.log('Map header Granim with forest road background initialized synchronously');
|
958 |
});
|
959 |
</script>
|
960 |
+
<script>
|
961 |
+
// Emit telemetry for map page view (best-effort)
|
962 |
+
(function() {
|
963 |
+
try {
|
964 |
+
document.addEventListener('DOMContentLoaded', function() {
|
965 |
+
var token = localStorage.getItem('auth_token');
|
966 |
+
if (!token) return;
|
967 |
+
fetch('/api/telemetry', {
|
968 |
+
method: 'POST',
|
969 |
+
headers: {
|
970 |
+
'Content-Type': 'application/json',
|
971 |
+
'Authorization': 'Bearer ' + token
|
972 |
+
},
|
973 |
+
body: JSON.stringify({
|
974 |
+
event_type: 'ui',
|
975 |
+
status: 'view',
|
976 |
+
metadata: { page: 'map', action: 'load' }
|
977 |
+
})
|
978 |
+
}).catch(function(){});
|
979 |
+
});
|
980 |
+
} catch(e) { /* ignore */ }
|
981 |
+
})();
|
982 |
+
</script>
|
983 |
</body>
|
984 |
</html>
|
static/sw.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// TreeTrack Service Worker - PWA and Offline Support
|
2 |
-
const VERSION =
|
3 |
const CACHE_NAME = `treetrack-v${VERSION}`;
|
4 |
const STATIC_CACHE = `static-v${VERSION}`;
|
5 |
const API_CACHE = `api-v${VERSION}`;
|
|
|
1 |
// TreeTrack Service Worker - PWA and Offline Support
|
2 |
+
const VERSION = 1755113832; // Cache busting bump - force clients to fetch new static assets and header image change
|
3 |
const CACHE_NAME = `treetrack-v${VERSION}`;
|
4 |
const STATIC_CACHE = `static-v${VERSION}`;
|
5 |
const API_CACHE = `api-v${VERSION}`;
|
version.json
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
{
|
2 |
"version": "5.1.1",
|
3 |
-
"timestamp":
|
4 |
}
|
|
|
1 |
{
|
2 |
"version": "5.1.1",
|
3 |
+
"timestamp": 1755113832
|
4 |
}
|