mirror of
https://github.com/andwati/dokploy.git
synced 2026-12-06 09:38:46 +00:00
[autofix.ci] apply automated fixes
This commit is contained in:
@@ -15,10 +15,14 @@ function shEscape(s: string | undefined): string {
|
|||||||
return `'${s.replace(/'/g, `'\\''`)}'`;
|
return `'${s.replace(/'/g, `'\\''`)}'`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function safeDockerLoginCommand(registry: string | undefined, user: string | undefined, pass: string | undefined) {
|
function safeDockerLoginCommand(
|
||||||
const escapedRegistry = shEscape(registry)
|
registry: string | undefined,
|
||||||
const escapedUser = shEscape(user)
|
user: string | undefined,
|
||||||
const escapedPassword = shEscape(pass)
|
pass: string | undefined,
|
||||||
|
) {
|
||||||
|
const escapedRegistry = shEscape(registry);
|
||||||
|
const escapedUser = shEscape(user);
|
||||||
|
const escapedPassword = shEscape(pass);
|
||||||
return `printf %s ${escapedPassword} | docker login ${escapedRegistry} -u ${escapedUser} --password-stdin`;
|
return `printf %s ${escapedPassword} | docker login ${escapedRegistry} -u ${escapedUser} --password-stdin`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +53,11 @@ export const createRegistry = async (
|
|||||||
message: "Select a server to add the registry",
|
message: "Select a server to add the registry",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const loginCommand = safeDockerLoginCommand(input.registryUrl, input.username, input.password)
|
const loginCommand = safeDockerLoginCommand(
|
||||||
|
input.registryUrl,
|
||||||
|
input.username,
|
||||||
|
input.password,
|
||||||
|
);
|
||||||
if (input.serverId && input.serverId !== "none") {
|
if (input.serverId && input.serverId !== "none") {
|
||||||
await execAsyncRemote(input.serverId, loginCommand);
|
await execAsyncRemote(input.serverId, loginCommand);
|
||||||
} else if (newRegistry.registryType === "cloud") {
|
} else if (newRegistry.registryType === "cloud") {
|
||||||
@@ -103,7 +111,11 @@ export const updateRegistry = async (
|
|||||||
.returning()
|
.returning()
|
||||||
.then((res) => res[0]);
|
.then((res) => res[0]);
|
||||||
|
|
||||||
const loginCommand = safeDockerLoginCommand(response?.registryUrl, response?.username, response?.password)
|
const loginCommand = safeDockerLoginCommand(
|
||||||
|
response?.registryUrl,
|
||||||
|
response?.username,
|
||||||
|
response?.password,
|
||||||
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
IS_CLOUD &&
|
IS_CLOUD &&
|
||||||
|
|||||||
Reference in New Issue
Block a user