From 294bfed2e4f9faa6f0f227a63c5bea3e0870fa1b Mon Sep 17 00:00:00 2001 From: Liam Fruzyna Date: Tue, 9 Apr 2024 18:15:29 -0500 Subject: [PATCH] Added a app version result metadata field --- scripts/index.js | 4 +++- scripts/note.js | 1 + scripts/scout.js | 1 + scripts/utils.js | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/index.js b/scripts/index.js index c0b7f8f6..e78d87ce 100644 --- a/scripts/index.js +++ b/scripts/index.js @@ -114,9 +114,11 @@ function init_page() navigator.serviceWorker.addEventListener('message', e => { if (e.data.msg === 'version') { + let version = e.data.version.replace('wildrank-', '') let header = document.getElementById('header_info') - header.innerText = e.data.version.replace('wildrank-', '') + header.innerText = version header.onclick = event => window_open(open_link('about'), '_blank') + set_cookie(VERSION_COOKIE, version) } }) } diff --git a/scripts/note.js b/scripts/note.js index c1081042..314cdd50 100644 --- a/scripts/note.js +++ b/scripts/note.js @@ -173,6 +173,7 @@ function get_results_from_page() results['meta_note_scout_time'] = Math.round(start / 1000) results['meta_note_scouting_duration'] = (Date.now() - start) / 1000 results['meta_config_version'] = cfg.version + results['meta_app_version'] = get_cookie(VERSION_COOKIE, VERSION_DEFAULT) // scouting metadata results['meta_scout_mode'] = NOTE_MODE diff --git a/scripts/scout.js b/scripts/scout.js index d366b08f..4b840fe8 100644 --- a/scripts/scout.js +++ b/scripts/scout.js @@ -347,6 +347,7 @@ function get_results_from_page() results['meta_scout_time'] = Math.round(start / 1000) results['meta_scouting_duration'] = (Date.now() - start) / 1000 results['meta_config_version'] = cfg.version + results['meta_app_version'] = get_cookie(VERSION_COOKIE, VERSION_DEFAULT) if (scout_mode === MATCH_MODE) { results['meta_unsure'] = document.getElementById('unsure').checked diff --git a/scripts/utils.js b/scripts/utils.js index 6c69cc50..b9364c0d 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -10,6 +10,8 @@ const PIT_MODE = 'pit' const NOTE_MODE = 'note' const MODES = [MATCH_MODE, PIT_MODE, NOTE_MODE] +const VERSION_COOKIE = 'version' +const VERSION_DEFAULT = 'unknown' const EVENT_COOKIE = 'event_id' const EVENT_DEFAULT = '2022new' const USER_COOKIE = 'user_id'