diff --git a/jumpapp/classes/Site.php b/jumpapp/classes/Site.php index 9699654..6c9e978 100644 --- a/jumpapp/classes/Site.php +++ b/jumpapp/classes/Site.php @@ -71,11 +71,20 @@ class Site { 'timeout' => 86400 ]); $rawimage = $favicon->get($this->url, \Favicon\FaviconDLType::RAW_IMAGE); - if (!$rawimage) { - $rawimage = file_get_contents($defaulticon); - } } else { - $rawimage = file_get_contents($this->config->get('sitesdir').'/icons/'.$this->iconname); + // If the icon name has a file extension the n try to retrieve it locally, otherwise + // see if we can get it from Dashboard Icons. + if (pathinfo($this->iconname, PATHINFO_EXTENSION)) { + $file = $this->config->get('sitesdir').'/icons/'.$this->iconname; + } else { + $file = 'https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/svg/'.$this->iconname.'.svg'; + } + $rawimage = file_get_contents($file); + } + // If we didnt manage to get any icon data from any of the above methods then return + // the default icon. + if (!$rawimage) { + $rawimage = file_get_contents($defaulticon); } $imagedata = new stdClass(); $imagedata->mimetype = (new \finfo(FILEINFO_MIME_TYPE))->buffer($rawimage); diff --git a/jumpapp/sites/sites.json b/jumpapp/sites/sites.json index ff6a470..8783f9f 100644 --- a/jumpapp/sites/sites.json +++ b/jumpapp/sites/sites.json @@ -5,27 +5,18 @@ "newtab": false }, "sites": [ - { - "name": "Github", - "url" : "https://github.com/daledavies/jump", - "description": "This is an example description", - "nofollow": false, - "newtab": true - }, - { - "name": "Docker Hub", - "url" : "https://hub.docker.com/r/daledavies/jump" - }, + { "name": "Bitwarden", "url" : "https://bitwarden.com/", "description": "This is another example of a site with a description", - "icon": "bitwarden.png", + "icon": "bitwarden", "tags": ["stuff"] }, { "name": "Gitea", "url" : "https://git.example.com", + "description": "This uses an icon from the Dashboard Icons repository", "icon": "gitea.png", "tags": ["stuff"] },