mirror of
https://github.com/louislam/dockge.git
synced 2025-03-12 20:34:47 +00:00
Compare commits
7 commits
db8b768b37
...
f63718b1d4
Author | SHA1 | Date | |
---|---|---|---|
|
f63718b1d4 | ||
|
a65a9f5549 | ||
|
9b73e44cd9 | ||
|
81818a19d1 | ||
|
1372bd2ce1 | ||
|
673fb8f8dd | ||
|
52ea324129 |
7 changed files with 1124 additions and 874 deletions
|
@ -294,11 +294,14 @@ export class MainTerminal extends InteractiveTerminal {
|
|||
// Check if the command is allowed
|
||||
const cmdParts = input.split(" ");
|
||||
const executable = cmdParts[0].trim();
|
||||
const knownOperators = ["||", "&", ";"];
|
||||
log.debug("console", "Executable: " + executable);
|
||||
log.debug("console", "Executable length: " + executable.length);
|
||||
|
||||
if (!allowedCommandList.includes(executable)) {
|
||||
throw new Error("Command not allowed.");
|
||||
} else if (knownOperators.some(operator => input.includes(operator))) {
|
||||
throw new Error("Control operators are not allowed.");
|
||||
}
|
||||
super.write(input);
|
||||
}
|
||||
|
|
|
@ -236,42 +236,63 @@ export function copyYAMLComments(doc : Document, src : Document) {
|
|||
|
||||
/**
|
||||
* Copy yaml comments from srcItems to items
|
||||
* Typescript is super annoying here, so I have to use any here
|
||||
* TODO: Since comments are belong to the array index, the comments will be lost if the order of the items is changed or removed or added.
|
||||
* Attempts to preserve comments by matching content rather than just array indices
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function copyYAMLCommentsItems(items : any, srcItems : any) {
|
||||
function copyYAMLCommentsItems(items: any, srcItems: any) {
|
||||
if (!items || !srcItems) {
|
||||
return;
|
||||
}
|
||||
|
||||
// First pass - try to match items by their content
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const item : any = items[i];
|
||||
const item: any = items[i];
|
||||
|
||||
// Try to find matching source item by content
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const srcItem : any = srcItems[i];
|
||||
const srcIndex = srcItems.findIndex((srcItem: any) =>
|
||||
JSON.stringify(srcItem.value) === JSON.stringify(item.value) &&
|
||||
JSON.stringify(srcItem.key) === JSON.stringify(item.key)
|
||||
);
|
||||
|
||||
if (!srcItem) {
|
||||
continue;
|
||||
}
|
||||
if (srcIndex !== -1) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const srcItem: any = srcItems[srcIndex];
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const nextSrcItem: any = srcItems[srcIndex + 1];
|
||||
|
||||
if (item.key && srcItem.key) {
|
||||
item.key.comment = srcItem.key.comment;
|
||||
item.key.commentBefore = srcItem.key.commentBefore;
|
||||
}
|
||||
if (item.key && srcItem.key) {
|
||||
item.key.comment = srcItem.key.comment;
|
||||
item.key.commentBefore = srcItem.key.commentBefore;
|
||||
}
|
||||
|
||||
if (srcItem.comment) {
|
||||
item.comment = srcItem.comment;
|
||||
}
|
||||
if (srcItem.comment) {
|
||||
item.comment = srcItem.comment;
|
||||
}
|
||||
|
||||
if (item.value && srcItem.value) {
|
||||
if (typeof item.value === "object" && typeof srcItem.value === "object") {
|
||||
item.value.comment = srcItem.value.comment;
|
||||
item.value.commentBefore = srcItem.value.commentBefore;
|
||||
// Handle comments between array items
|
||||
if (nextSrcItem && nextSrcItem.commentBefore) {
|
||||
if (items[i + 1]) {
|
||||
items[i + 1].commentBefore = nextSrcItem.commentBefore;
|
||||
}
|
||||
}
|
||||
|
||||
if (item.value.items && srcItem.value.items) {
|
||||
copyYAMLCommentsItems(item.value.items, srcItem.value.items);
|
||||
// Handle trailing comments after array items
|
||||
if (srcItem.value && srcItem.value.comment) {
|
||||
if (item.value) {
|
||||
item.value.comment = srcItem.value.comment;
|
||||
}
|
||||
}
|
||||
|
||||
if (item.value && srcItem.value) {
|
||||
if (typeof item.value === "object" && typeof srcItem.value === "object") {
|
||||
item.value.comment = srcItem.value.comment;
|
||||
item.value.commentBefore = srcItem.value.commentBefore;
|
||||
|
||||
if (item.value.items && srcItem.value.items) {
|
||||
copyYAMLCommentsItems(item.value.items, srcItem.value.items);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ VOLUME /app/data
|
|||
EXPOSE 5001
|
||||
HEALTHCHECK --interval=60s --timeout=30s --start-period=60s --retries=5 CMD extra/healthcheck
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
CMD ["bash", "-c", "node ./extra/clean-tsx-tmp.js && tsx ./backend/index.ts"]
|
||||
CMD ["tsx", "./backend/index.ts"]
|
||||
|
||||
############################################
|
||||
# Mark as Nightly
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
/*
|
||||
* This script is used to clean up the tmp directory.
|
||||
* A workaround for https://github.com/louislam/dockge/issues/353
|
||||
*/
|
||||
import * as fs from "fs";
|
||||
|
||||
try {
|
||||
fs.rmSync("/tmp/tsx-0", {
|
||||
recursive: true,
|
||||
});
|
||||
} catch (e) {
|
||||
|
||||
}
|
|
@ -247,7 +247,6 @@ export default {
|
|||
<style scoped lang="scss">
|
||||
.main-terminal {
|
||||
height: 100%;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
|
@ -38,14 +38,14 @@
|
|||
"croner": "~8.1.2",
|
||||
"dayjs": "~1.11.13",
|
||||
"dotenv": "~16.3.2",
|
||||
"express": "~4.21.1",
|
||||
"express": "~4.21.2",
|
||||
"express-static-gzip": "~2.1.8",
|
||||
"http-graceful-shutdown": "~3.1.13",
|
||||
"jsonwebtoken": "~9.0.2",
|
||||
"jwt-decode": "~3.1.2",
|
||||
"knex": "~2.5.1",
|
||||
"limiter-es6-compat": "~2.1.2",
|
||||
"mysql2": "~3.11.3",
|
||||
"mysql2": "~3.12.0",
|
||||
"promisify-child-process": "~4.1.2",
|
||||
"redbean-node": "~0.3.3",
|
||||
"semver": "^7.6.3",
|
||||
|
@ -53,7 +53,7 @@
|
|||
"socket.io-client": "~4.8.0",
|
||||
"timezones-list": "~3.0.3",
|
||||
"ts-command-line-args": "~2.5.1",
|
||||
"tsx": "~4.6.2",
|
||||
"tsx": "~4.19.2",
|
||||
"type-fest": "~4.3.3",
|
||||
"yaml": "~2.3.4"
|
||||
},
|
||||
|
|
1910
pnpm-lock.yaml
generated
1910
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue