mirror of
https://github.com/pawelmalak/flame.git
synced 2024-12-20 08:41:48 +03:00
Add custom icon & multiple apps support to Docker API
This commit is contained in:
parent
ebae61a688
commit
9606978bd7
11
README.md
11
README.md
@ -174,6 +174,17 @@ labels:
|
|||||||
- flame.name=My container
|
- flame.name=My container
|
||||||
- flame.url=https://example.com
|
- flame.url=https://example.com
|
||||||
- flame.icon=icon-name # Optional, default is "docker"
|
- flame.icon=icon-name # Optional, default is "docker"
|
||||||
|
# - flame.icon=custom to make changes in app. ie: custom icon upload
|
||||||
|
```
|
||||||
|
|
||||||
|
You can set up different apps in the same label adding `;` between each one.
|
||||||
|
|
||||||
|
```yml
|
||||||
|
labels:
|
||||||
|
- flame.type=application
|
||||||
|
- flame.name=First App;Second App
|
||||||
|
- flame.url=https://example1.com;https://example2.com
|
||||||
|
- flame.icon=icon-name1;icon-name2
|
||||||
```
|
```
|
||||||
|
|
||||||
And you must have activated the Docker sync option in the settings panel.
|
And you must have activated the Docker sync option in the settings panel.
|
||||||
|
@ -92,11 +92,17 @@ exports.getApps = asyncWrapper(async (req, res, next) => {
|
|||||||
'flame.url' in labels &&
|
'flame.url' in labels &&
|
||||||
/^app/.test(labels['flame.type'])
|
/^app/.test(labels['flame.type'])
|
||||||
) {
|
) {
|
||||||
dockerApps.push({
|
|
||||||
name: labels['flame.name'],
|
for (let i=0; i < labels['flame.name'].split(';').length; i++) {
|
||||||
url: labels['flame.url'],
|
const names = labels['flame.name'].split(';');
|
||||||
icon: labels['flame.icon'] || 'docker'
|
const urls = labels['flame.url'].split(';');
|
||||||
});
|
const icons = labels['flame.icon'].split(';');
|
||||||
|
dockerApps.push({
|
||||||
|
name: names[i] || names[0],
|
||||||
|
url: urls[i] || urls[0],
|
||||||
|
icon: icons[i] || 'docker'
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,13 +113,29 @@ exports.getApps = asyncWrapper(async (req, res, next) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const item of dockerApps) {
|
for (const item of dockerApps) {
|
||||||
if (apps.some(app => app.name === item.name)) {
|
if (apps.some((app) => app.name === item.name)) {
|
||||||
const app = apps.filter(e => e.name === item.name)[0];
|
const app = apps.filter((e) => e.name === item.name)[0];
|
||||||
await app.update({ ...item, isPinned: true });
|
|
||||||
|
if(item.icon === 'custom') {
|
||||||
|
await app.update({
|
||||||
|
name: item.name,
|
||||||
|
url: item.url,
|
||||||
|
isPinned: true,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await app.update({
|
||||||
|
name: item.name,
|
||||||
|
url: item.url,
|
||||||
|
icon: item.icon,
|
||||||
|
isPinned: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
await App.create({
|
await App.create({
|
||||||
...item,
|
name: item.name,
|
||||||
isPinned: true
|
url: item.url,
|
||||||
|
icon: item.icon === 'custom' ? 'docker' : item.icon,
|
||||||
|
isPinned: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user