From d920da33abbd68c8e5a1f70be9f13eb2b568078d Mon Sep 17 00:00:00 2001 From: boxing Date: Fri, 6 Jun 2025 00:38:53 +0000 Subject: [PATCH 1/2] add always pull image setting for docker --- common/global.d.ts | 1 + .../src/entity/commands/docker/docker_pull.ts | 34 +++++++++++-------- daemon/src/entity/instance/Instance_config.ts | 1 + daemon/src/entity/instance/instance.ts | 1 + .../instance/dialogs/InstanceDetail.vue | 23 +++++++++++++ .../widgets/setupApp/CreateInstanceForm.vue | 1 + 6 files changed, 46 insertions(+), 15 deletions(-) diff --git a/common/global.d.ts b/common/global.d.ts index 8a392758f..85723261f 100644 --- a/common/global.d.ts +++ b/common/global.d.ts @@ -48,6 +48,7 @@ declare global { interface IGlobalInstanceDockerConfig { containerName?: string; + pullPolicy?: boolean; image?: string; memory?: number; ports?: string[]; diff --git a/daemon/src/entity/commands/docker/docker_pull.ts b/daemon/src/entity/commands/docker/docker_pull.ts index 3f1bda09a..775cb28d3 100644 --- a/daemon/src/entity/commands/docker/docker_pull.ts +++ b/daemon/src/entity/commands/docker/docker_pull.ts @@ -50,28 +50,32 @@ export default class DockerPullCommand extends InstanceCommand { async exec(instance: Instance) { const imageName = instance.config.docker.image; + const pullPolicy = instance.config.docker.pullPolicy; if (!imageName) throw new Error(t("TXT_CODE_17be5f70")); const cachedStartCount = instance.startCount; // If the image exists, there is no need to pull again. - if (await checkImage(imageName)) return; + if(pullPolicy === false ) { + if (await checkImage(imageName)) return; + } else { - try { - const docker = new DefaultDocker(); - instance.println("CONTAINER", t("TXT_CODE_2fa46b8c") + imageName); - instance.asynchronousTask = this; + try { + const docker = new DefaultDocker(); + instance.println("CONTAINER", t("TXT_CODE_2fa46b8c") + imageName); + instance.asynchronousTask = this; - await docker.pull(imageName, {}); + await docker.pull(imageName, {}); - await this.awaitImageDone(instance, imageName); - if (cachedStartCount !== instance.startCount) return; - instance.println("CONTAINER", t("TXT_CODE_c68b0bef")); - } catch (err: any) { - if (cachedStartCount !== instance.startCount) return; - throw new Error([t("TXT_CODE_db37b7f9"), err?.message].join("\n")); - } finally { - this.stopped(instance); - } + await this.awaitImageDone(instance, imageName); + if (cachedStartCount !== instance.startCount) return; + instance.println("CONTAINER", t("TXT_CODE_c68b0bef")); + } catch (err: any) { + if (cachedStartCount !== instance.startCount) return; + throw new Error([t("TXT_CODE_db37b7f9"), err?.message].join("\n")); + } finally { + this.stopped(instance); + } } +} async stop(instance: Instance): Promise { this.stopped(instance); diff --git a/daemon/src/entity/instance/Instance_config.ts b/daemon/src/entity/instance/Instance_config.ts index b55a52179..f6863d4b3 100755 --- a/daemon/src/entity/instance/Instance_config.ts +++ b/daemon/src/entity/instance/Instance_config.ts @@ -55,6 +55,7 @@ export default class InstanceConfig implements IGlobalInstanceConfig { public docker: IGlobalInstanceDockerConfig = { containerName: "", image: "", + pullPolicy: false, ports: [], extraVolumes: [], memory: 0, diff --git a/daemon/src/entity/instance/instance.ts b/daemon/src/entity/instance/instance.ts index 5ea8f5fb8..b4d656566 100755 --- a/daemon/src/entity/instance/instance.ts +++ b/daemon/src/entity/instance/instance.ts @@ -196,6 +196,7 @@ export default class Instance extends EventEmitter { if (cfg.docker) { configureEntityParams(this.config.docker, cfg.docker, "containerName", String); + configureEntityParams(this.config.docker, cfg.docker, "pullPolicy", Boolean); configureEntityParams(this.config.docker, cfg.docker, "image", String); configureEntityParams(this.config.docker, cfg.docker, "memory", Number); configureEntityParams(this.config.docker, cfg.docker, "ports"); diff --git a/frontend/src/widgets/instance/dialogs/InstanceDetail.vue b/frontend/src/widgets/instance/dialogs/InstanceDetail.vue index 23a961e22..af00d1335 100644 --- a/frontend/src/widgets/instance/dialogs/InstanceDetail.vue +++ b/frontend/src/widgets/instance/dialogs/InstanceDetail.vue @@ -667,6 +667,29 @@ defineExpose({ + + + + Always pull image + + + + Always pull Docker image + + + + + + + + + + {{ t("TXT_CODE_10194e6a") }} diff --git a/frontend/src/widgets/setupApp/CreateInstanceForm.vue b/frontend/src/widgets/setupApp/CreateInstanceForm.vue index bac906b53..ce6fe3b67 100644 --- a/frontend/src/widgets/setupApp/CreateInstanceForm.vue +++ b/frontend/src/widgets/setupApp/CreateInstanceForm.vue @@ -60,6 +60,7 @@ const formData = reactive({ docker: { containerName: "", image: "", + pullPolicy: false, ports: [], extraVolumes: [], networkMode: "bridge", From 875d0fd1a1381fe0915832f4105b1e5f3ea3ef72 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Dec 2025 15:18:17 +0000 Subject: [PATCH 2/2] chore(deps): bump qs from 6.12.1 to 6.14.1 in /panel Bumps [qs](https://github.com/ljharb/qs) from 6.12.1 to 6.14.1. - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](https://github.com/ljharb/qs/compare/v6.12.1...v6.14.1) --- updated-dependencies: - dependency-name: qs dependency-version: 6.14.1 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- panel/package-lock.json | 167 +++++++++++++++++++++++++++++++++------- 1 file changed, 139 insertions(+), 28 deletions(-) diff --git a/panel/package-lock.json b/panel/package-lock.json index 1a37b2491..3fe1c94c7 100644 --- a/panel/package-lock.json +++ b/panel/package-lock.json @@ -1,12 +1,12 @@ { "name": "mcsmanager-panel", - "version": "10.10.1", + "version": "10.10.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "mcsmanager-panel", - "version": "10.10.1", + "version": "10.10.3", "license": "Apache-2.0", "dependencies": { "@koa/router": "^10.0.0", @@ -1480,6 +1480,21 @@ "node": ">= 0.4" } }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -4062,9 +4077,12 @@ } }, "node_modules/object-inspect": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", - "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -4358,11 +4376,11 @@ } }, "node_modules/qs": { - "version": "6.12.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.12.1.tgz", - "integrity": "sha512-zWmv4RSuB9r2mYQw3zxQuHWeU+42aKi1wWig/j4ele4ygELZ7PEO6MM7rim9oAQH2A5MWfsAVf/jPvTPgCbvUQ==", + "version": "6.14.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz", + "integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==", "dependencies": { - "side-channel": "^1.0.6" + "side-channel": "^1.1.0" }, "engines": { "node": ">=0.6" @@ -4781,14 +4799,65 @@ } }, "node_modules/side-channel": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", - "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", "dependencies": { - "call-bind": "^1.0.7", "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4", - "object-inspect": "^1.13.1" + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" }, "engines": { "node": ">= 0.4" @@ -6981,6 +7050,15 @@ "function-bind": "^1.1.2" } }, + "call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "requires": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + } + }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -8888,9 +8966,9 @@ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" }, "object-inspect": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", - "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==" + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==" }, "object-keys": { "version": "1.1.1", @@ -9105,11 +9183,11 @@ } }, "qs": { - "version": "6.12.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.12.1.tgz", - "integrity": "sha512-zWmv4RSuB9r2mYQw3zxQuHWeU+42aKi1wWig/j4ele4ygELZ7PEO6MM7rim9oAQH2A5MWfsAVf/jPvTPgCbvUQ==", + "version": "6.14.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz", + "integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==", "requires": { - "side-channel": "^1.0.6" + "side-channel": "^1.1.0" } }, "randombytes": { @@ -9422,14 +9500,47 @@ "dev": true }, "side-channel": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", - "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", "requires": { - "call-bind": "^1.0.7", "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4", - "object-inspect": "^1.13.1" + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + } + }, + "side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "requires": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + } + }, + "side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "requires": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + } + }, + "side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "requires": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" } }, "simple-update-notifier": {