Skip to content

Commit

Permalink
gui: Fix Firefox bookmark favicon (fixes #9506)
Browse files Browse the repository at this point in the history
Firefox uses the last specified favicon link for bookmarks,
but only if it is available on initial page load.
Remove the second link and change the href of the favicon instead.
  • Loading branch information
medusalix committed Apr 9, 2024
1 parent 61b94b9 commit 0933b00
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 1 addition & 2 deletions gui/default/index.html
Expand Up @@ -12,8 +12,7 @@
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="shortcut icon" href="assets/img/favicon-default.png" type="image/x-icon"/>
<link rel="shortcut icon" href="assets/img/favicon-{{syncthingStatus()}}.png" type="image/x-icon"/>
<link id="favicon" rel="shortcut icon" href="assets/img/favicon-default.png" type="image/x-icon"/>
<link rel="mask-icon" href="assets/img/safari-pinned-tab.svg" color="#0882c8"/>

<title ng-bind="thisDeviceName() + ' | Syncthing'"></title>
Expand Down
7 changes: 6 additions & 1 deletion gui/default/syncthing/core/syncthingController.js
Expand Up @@ -11,6 +11,7 @@ angular.module('syncthing.core')
var navigatingAway = false;
var online = false;
var restarting = false;
var favicon = $('#favicon');

function initController() {
LocaleService.autoConfigLocale();
Expand Down Expand Up @@ -1291,7 +1292,7 @@ angular.module('syncthing.core')
return 'info';
};

$scope.syncthingStatus = function () {
function syncthingStatus() {
var syncCount = 0;
var notifyCount = 0;
var pauseCount = 0;
Expand Down Expand Up @@ -1360,6 +1361,10 @@ angular.module('syncthing.core')
return 'default';
};

$scope.$watch(function () {
favicon.attr('href', 'assets/img/favicon-' + syncthingStatus() + '.png');
});

$scope.deviceAddr = function (deviceCfg) {
var conn = $scope.connections[deviceCfg.deviceID];
if (conn && conn.connected) {
Expand Down

0 comments on commit 0933b00

Please sign in to comment.