Add refresh button to Docker widget with server cache bust
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -123,15 +123,19 @@ async function getLscrLatestDigest(image: string, tag: string): Promise<string |
|
||||
return getGenericRegistryDigest('lscr.io', image, tag, process.env.GITHUB_TOKEN)
|
||||
}
|
||||
|
||||
router.get('/docker', async (_req, res) => {
|
||||
router.get('/docker', async (req, res) => {
|
||||
const host = process.env.PORTAINER_HOST
|
||||
if (!host) {
|
||||
res.status(503).json({ error: 'PORTAINER_HOST not configured' })
|
||||
return
|
||||
}
|
||||
|
||||
const cached = fromCache<{ containers: ContainerInfo[] }>('docker:full', HUB_TTL)
|
||||
if (cached) { res.json(cached); return }
|
||||
if (!req.query.refresh) {
|
||||
const cached = fromCache<{ containers: ContainerInfo[] }>('docker:full', HUB_TTL)
|
||||
if (cached) { res.json(cached); return }
|
||||
} else {
|
||||
delete cache['docker:full']
|
||||
}
|
||||
|
||||
try {
|
||||
const headers = portainerHeaders()
|
||||
|
||||
Reference in New Issue
Block a user