From 913e88896b9e6d60ced971f418558d3c532e8514 Mon Sep 17 00:00:00 2001 From: Yann Stepienik Date: Thu, 18 May 2023 11:12:41 +0100 Subject: [PATCH] [release] version 0.5.1 --- client/src/api/demo.config.json | 4 +++ client/src/api/docker.demo.jsx | 59 +++++++++++++++++++++++++++++++++ package.json | 2 +- src/docker/api_managecont.go | 1 + src/docker/docker.go | 4 ++- 5 files changed, 68 insertions(+), 2 deletions(-) diff --git a/client/src/api/demo.config.json b/client/src/api/demo.config.json index f9ebc62..1f02d9a 100644 --- a/client/src/api/demo.config.json +++ b/client/src/api/demo.config.json @@ -346,5 +346,9 @@ "RequireMFA": false, "AutoUpdate": false }, + "updates": { + "/Sonarr": true, + "/Jellyfin": true + }, "status": "OK" } \ No newline at end of file diff --git a/client/src/api/docker.demo.jsx b/client/src/api/docker.demo.jsx index 61ae74f..531f8f2 100644 --- a/client/src/api/docker.demo.jsx +++ b/client/src/api/docker.demo.jsx @@ -151,6 +151,59 @@ function getContainerLogs(containerId, searchQuery, limit, lastReceivedLogs, err }); } +function attachTerminal(name) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve({ + "status": "ok", + })}, + 100 + ); + }); +} + +function createTerminal(name) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve({ + "status": "ok", + })}, + 100 + ); + }); +} + +function autoUpdate(name) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve({ + "status": "ok", + })}, + 1000 + ); + }); +} + +function pullImage(imageName, onProgress, ifMissing) { + onProgress('Updating...') + new Promise((resolve, reject) => { + setTimeout(() => { + onProgress('Download in progress...') + }, + 1000 + ); + }); + return new Promise((resolve, reject) => { + setTimeout(() => { + onProgress('[OPERATION SUCCEEDED]') + }, + 2500 + ); + }); +} +const updateContainerImage = pullImage; +const createService = pullImage; + export { list, get, @@ -168,4 +221,10 @@ export { attachNetwork, detachNetwork, createVolume, + attachTerminal, + createTerminal, + createService, + pullImage, + autoUpdate, + updateContainerImage, }; \ No newline at end of file diff --git a/package.json b/package.json index 8468227..7f82532 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cosmos-server", - "version": "0.5.0", + "version": "0.5.1", "description": "", "main": "test-server.js", "bugs": { diff --git a/src/docker/api_managecont.go b/src/docker/api_managecont.go index 447adfb..710fd29 100644 --- a/src/docker/api_managecont.go +++ b/src/docker/api_managecont.go @@ -108,6 +108,7 @@ func ManageContainerRoute(w http.ResponseWriter, req *http.Request) { return } + utils.UpdateAvailable["/" + containerName] = false fmt.Fprintf(w, "[OPERATION SUCCEEDED]") flusher.Flush() return diff --git a/src/docker/docker.go b/src/docker/docker.go index 4cb8cec..c1de833 100644 --- a/src/docker/docker.go +++ b/src/docker/docker.go @@ -357,8 +357,8 @@ func CheckUpdatesAvailable() map[string]bool { if strings.Contains(newStr, "\"status\":\"Pulling fs layer\"") { utils.Log("Updates available for " + container.Image) + result[container.Names[0]] = true if !IsLabel(fullContainer, "cosmos-auto-update") { - result[container.Names[0]] = true rc.Close() break } else { @@ -400,6 +400,8 @@ func CheckUpdatesAvailable() map[string]bool { _, err := EditContainer(container.ID, fullContainer) if err != nil { utils.Error("CheckUpdatesAvailable - Failed to update - ", err) + } else { + result[container.Names[0]] = false } } }