diff --git a/server/src/main.rs b/server/src/main.rs index b4357d5..642feae 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -174,6 +174,7 @@ async fn main() "www/js/const.js", "www/js/language.js", "www/js/util.js", + "www/js/badge.js", "www/js/game_asset.js", "www/js/game.js", "www/js/interface.js", @@ -183,6 +184,7 @@ async fn main() "www/js/main.js", ]).ok(); cache.cache_file("image/png", "/favicon.png", "www/asset/favicon.png").ok(); + cache.cache_file("image/png", "/favicon_notify.png", "www/asset/favicon_notify.png").ok(); let asset_path = std::path::Path::new("www/asset"); for asset in [ diff --git a/www/asset/favicon_notify.png b/www/asset/favicon_notify.png new file mode 100644 index 0000000..ff4e1ba Binary files /dev/null and b/www/asset/favicon_notify.png differ diff --git a/www/asset/favicon_notify.svg b/www/asset/favicon_notify.svg new file mode 100644 index 0000000..41f05e7 --- /dev/null +++ b/www/asset/favicon_notify.svg @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + diff --git a/www/js/badge.js b/www/js/badge.js index c2435cb..28be812 100644 --- a/www/js/badge.js +++ b/www/js/badge.js @@ -1,8 +1,11 @@ -class Badge { - -} - -function BADGE_UPDATE() +function BADGE_UPDATE(notify) { - + let link = document.querySelector("link[rel~='icon']"); + if(link) { + if(notify) { + link.href = "/favicon_notify.png"; + } else { + link.href = "/favicon.png"; + } + } } diff --git a/www/js/system.js b/www/js/system.js index 18cf4bc..3f7cbc3 100644 --- a/www/js/system.js +++ b/www/js/system.js @@ -132,6 +132,8 @@ function MESSAGE(event) { index = result.index; STATUS.resume = result.data; + BADGE_UPDATE(STATUS.challenge > 0 || STATUS.resume > 0); + UI.update_status(); } } break;