mirror of
https://github.com/daledavies/jump.git
synced 2026-05-06 07:07:33 +02:00
Add Dashboard Icons integration
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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"]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user