mirror of
https://github.com/louislam/dockge.git
synced 2025-08-13 16:07:28 +02:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
34af500b66 | |||
56eb46150f | |||
f6fffcc064 |
@ -195,6 +195,7 @@ export class DockgeServer {
|
|||||||
// Create Socket.io
|
// Create Socket.io
|
||||||
this.io = new socketIO.Server(this.httpServer, {
|
this.io = new socketIO.Server(this.httpServer, {
|
||||||
cors,
|
cors,
|
||||||
|
transports: [ "websocket" ],
|
||||||
});
|
});
|
||||||
|
|
||||||
this.io.on("connection", async (socket: Socket) => {
|
this.io.on("connection", async (socket: Socket) => {
|
||||||
|
@ -5,6 +5,8 @@ import { LimitQueue } from "./utils/limit-queue";
|
|||||||
import { DockgeSocket } from "./util-server";
|
import { DockgeSocket } from "./util-server";
|
||||||
import {
|
import {
|
||||||
allowedCommandList, allowedRawKeys,
|
allowedCommandList, allowedRawKeys,
|
||||||
|
getComposeTerminalName,
|
||||||
|
getCryptoRandomInt,
|
||||||
PROGRESS_TERMINAL_ROWS,
|
PROGRESS_TERMINAL_ROWS,
|
||||||
TERMINAL_COLS,
|
TERMINAL_COLS,
|
||||||
TERMINAL_ROWS
|
TERMINAL_ROWS
|
||||||
@ -205,20 +207,14 @@ export class Terminal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static exec(server : DockgeServer, socket : DockgeSocket | undefined, terminalName : string, file : string, args : string | string[], cwd : string) : Promise<number> {
|
public static exec(server : DockgeServer, socket : DockgeSocket | undefined, terminalName : string, file : string, args : string | string[], cwd : string) : Promise<number> {
|
||||||
return new Promise((resolve, reject) => {
|
const terminal = new Terminal(server, terminalName, file, args, cwd);
|
||||||
// check if terminal exists
|
terminal.rows = PROGRESS_TERMINAL_ROWS;
|
||||||
if (Terminal.terminalMap.has(terminalName)) {
|
|
||||||
reject("Another operation is already running, please try again later.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let terminal = new Terminal(server, terminalName, file, args, cwd);
|
if (socket) {
|
||||||
terminal.rows = PROGRESS_TERMINAL_ROWS;
|
terminal.join(socket);
|
||||||
|
}
|
||||||
if (socket) {
|
|
||||||
terminal.join(socket);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return new Promise((resolve) => {
|
||||||
terminal.onExit((exitCode : number) => {
|
terminal.onExit((exitCode : number) => {
|
||||||
resolve(exitCode);
|
resolve(exitCode);
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM node:18.17.1-bookworm-slim
|
FROM node:20-bookworm-slim
|
||||||
ENV PNPM_HOME="/pnpm"
|
ENV PNPM_HOME="/pnpm"
|
||||||
ENV PATH="$PNPM_HOME:$PATH"
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
|
|
||||||
@ -24,3 +24,16 @@ RUN apt update && apt install --yes --no-install-recommends \
|
|||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& npm install pnpm -g \
|
&& npm install pnpm -g \
|
||||||
&& pnpm install -g tsx
|
&& pnpm install -g tsx
|
||||||
|
|
||||||
|
# ensures that /var/run/docker.sock exists
|
||||||
|
# changes the ownership of /var/run/docker.sock
|
||||||
|
RUN touch /var/run/docker.sock && chown node:node /var/run/docker.sock
|
||||||
|
|
||||||
|
# Full Base Image
|
||||||
|
# MariaDB, Chromium and fonts
|
||||||
|
#FROM base-slim AS base
|
||||||
|
#ENV DOCKGE_ENABLE_EMBEDDED_MARIADB=1
|
||||||
|
#RUN apt update && \
|
||||||
|
# apt --yes --no-install-recommends install mariadb-server && \
|
||||||
|
# rm -rf /var/lib/apt/lists/* && \
|
||||||
|
# apt --yes autoremove
|
||||||
|
@ -30,10 +30,6 @@ export default {
|
|||||||
displayName: {
|
displayName: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
|
||||||
objectType: {
|
|
||||||
type: String,
|
|
||||||
default: "service",
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -45,7 +41,8 @@ export default {
|
|||||||
array() {
|
array() {
|
||||||
// Create the array if not exists, it should be safe.
|
// Create the array if not exists, it should be safe.
|
||||||
if (!this.service[this.name]) {
|
if (!this.service[this.name]) {
|
||||||
return [];
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
|
this.service[this.name] = [];
|
||||||
}
|
}
|
||||||
return this.service[this.name];
|
return this.service[this.name];
|
||||||
},
|
},
|
||||||
@ -59,24 +56,8 @@ export default {
|
|||||||
return this.service[this.name] !== undefined;
|
return this.service[this.name] !== undefined;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Not a good name, but it is used to get the object.
|
|
||||||
*/
|
|
||||||
service() {
|
service() {
|
||||||
if (this.objectType === "service") {
|
return this.$parent.$parent.service;
|
||||||
// Used in Container.vue
|
|
||||||
return this.$parent.$parent.service;
|
|
||||||
} else if (this.objectType === "x-dockge") {
|
|
||||||
|
|
||||||
if (!this.$parent.$parent.jsonConfig["x-dockge"]) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Used in Compose.vue
|
|
||||||
return this.$parent.$parent.jsonConfig["x-dockge"];
|
|
||||||
} else {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
valid() {
|
valid() {
|
||||||
@ -100,19 +81,6 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
addField() {
|
addField() {
|
||||||
|
|
||||||
// Create the object if not exists.
|
|
||||||
if (this.objectType === "x-dockge") {
|
|
||||||
if (!this.$parent.$parent.jsonConfig["x-dockge"]) {
|
|
||||||
this.$parent.$parent.jsonConfig["x-dockge"] = {};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the array if not exists.
|
|
||||||
if (!this.service[this.name]) {
|
|
||||||
this.service[this.name] = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
this.array.push("");
|
this.array.push("");
|
||||||
},
|
},
|
||||||
remove(index) {
|
remove(index) {
|
||||||
|
@ -49,7 +49,8 @@ export default {
|
|||||||
array() {
|
array() {
|
||||||
// Create the array if not exists, it should be safe.
|
// Create the array if not exists, it should be safe.
|
||||||
if (!this.service[this.name]) {
|
if (!this.service[this.name]) {
|
||||||
return [];
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
|
this.service[this.name] = [];
|
||||||
}
|
}
|
||||||
return this.service[this.name];
|
return this.service[this.name];
|
||||||
},
|
},
|
||||||
@ -88,10 +89,6 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
addField() {
|
addField() {
|
||||||
// Create the array if not exists.
|
|
||||||
if (!this.service[this.name]) {
|
|
||||||
this.service[this.name] = [];
|
|
||||||
}
|
|
||||||
this.array.push("");
|
this.array.push("");
|
||||||
},
|
},
|
||||||
remove(index) {
|
remove(index) {
|
||||||
|
@ -2,18 +2,13 @@
|
|||||||
|
|
||||||
A simple guide on how to translate `Dockge` in your native language.
|
A simple guide on how to translate `Dockge` in your native language.
|
||||||
|
|
||||||
## How to Translate
|
|
||||||
|
|
||||||
(11-26-2023) Updated
|
|
||||||
|
|
||||||
1. Go to <https://weblate.kuma.pet>
|
|
||||||
2. Register an account on Weblate
|
|
||||||
3. Make sure your GitHub email is matched with Weblate's account, so that it could show you as a contributor on GitHub
|
|
||||||
4. Choose your language on Weblate and start translating.
|
|
||||||
|
|
||||||
## How to add a new language in the dropdown
|
## How to add a new language in the dropdown
|
||||||
|
|
||||||
1. Add your Language at <https://weblate.kuma.pet/projects/dockge/dockge/>.
|
(11-21-2023) Updated
|
||||||
2. Find the language code (You can find it at the end of the URL)
|
|
||||||
|
1. Add your Language at `frontend/src/lang/` by creating a new file with your language Code, format: `zh-TW.json` .
|
||||||
|
2. Copy the content from `en.json` and make translations from that.
|
||||||
3. Add your language at the end of `languageList` in `frontend/src/i18n.ts`, format: `"zh-TW": "繁體中文 (台灣)"`,
|
3. Add your language at the end of `languageList` in `frontend/src/i18n.ts`, format: `"zh-TW": "繁體中文 (台灣)"`,
|
||||||
4. Commit to new branch and make a new Pull Request for me to approve.
|
4. Commit to new branch and make a new Pull Request for me to approve.
|
||||||
|
|
||||||
|
*Note:* Currently we are only accepting one Pull Request per Language Translate.
|
||||||
|
@ -96,7 +96,5 @@
|
|||||||
"reverseProxyMsg2": "Check how to config it for WebSocket",
|
"reverseProxyMsg2": "Check how to config it for WebSocket",
|
||||||
"Cannot connect to the socket server.": "Cannot connect to the socket server.",
|
"Cannot connect to the socket server.": "Cannot connect to the socket server.",
|
||||||
"reconnecting...": "Reconnecting...",
|
"reconnecting...": "Reconnecting...",
|
||||||
"connecting...": "Connecting to the socket server...",
|
"connecting...": "Connecting to the socket server..."
|
||||||
"url": "URL | URLs",
|
|
||||||
"extra": "Extra"
|
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
"registry": "رجسٹری",
|
"registry": "رجسٹری",
|
||||||
"compose": "تحریر",
|
"compose": "تحریر",
|
||||||
"addFirstStackMsg": "اپنا پہلا اسٹیک کمپوز کریں!",
|
"addFirstStackMsg": "اپنا پہلا اسٹیک کمپوز کریں!",
|
||||||
"stackName": "اسٹیک کا نام",
|
"stackName" : "اسٹیک کا نام",
|
||||||
"deployStack": "تعینات",
|
"deployStack": "تعینات",
|
||||||
"deleteStack": "حذف کریں",
|
"deleteStack": "حذف کریں",
|
||||||
"stopStack": "روکو",
|
"stopStack": "روکو",
|
||||||
@ -22,7 +22,7 @@
|
|||||||
"editStack": "ترمیم",
|
"editStack": "ترمیم",
|
||||||
"discardStack": "رد کر دیں۔",
|
"discardStack": "رد کر دیں۔",
|
||||||
"saveStackDraft": "محفوظ کریں۔",
|
"saveStackDraft": "محفوظ کریں۔",
|
||||||
"notAvailableShort": "N / A",
|
"notAvailableShort" : "N / A",
|
||||||
"deleteStackMsg": "کیا آپ واقعی اس اسٹیک کو حذف کرنا چاہتے ہیں؟",
|
"deleteStackMsg": "کیا آپ واقعی اس اسٹیک کو حذف کرنا چاہتے ہیں؟",
|
||||||
"stackNotManagedByDockgeMsg": "یہ اسٹیک Dockge کے زیر انتظام نہیں ہے۔",
|
"stackNotManagedByDockgeMsg": "یہ اسٹیک Dockge کے زیر انتظام نہیں ہے۔",
|
||||||
"primaryHostname": "بنیادی میزبان نام",
|
"primaryHostname": "بنیادی میزبان نام",
|
||||||
@ -90,13 +90,5 @@
|
|||||||
"Allowed commands:": "اجازت شدہ احکامات:",
|
"Allowed commands:": "اجازت شدہ احکامات:",
|
||||||
"Internal Networks": "اندرونی نیٹ ورکس",
|
"Internal Networks": "اندرونی نیٹ ورکس",
|
||||||
"External Networks": "بیرونی نیٹ ورکس",
|
"External Networks": "بیرونی نیٹ ورکس",
|
||||||
"No External Networks": "کوئی بیرونی نیٹ ورک نہیں",
|
"No External Networks": "کوئی بیرونی نیٹ ورک نہیں"
|
||||||
"reverseProxyMsg1": "ایک ریورس پراکسی کا استعمال کرتے ہوئے؟",
|
|
||||||
"Cannot connect to the socket server.": "ساکٹ سرور سے منسلک نہیں ہو سکتا۔",
|
|
||||||
"reconnecting...": "دوبارہ منسلک ہو رہا ہے...",
|
|
||||||
"connecting...": "ساکٹ سرور سے منسلک ہو رہا ہے...",
|
|
||||||
"url": "یو آر ایل | یو آر ایل",
|
|
||||||
"extra": "اضافی",
|
|
||||||
"downStack": "اسٹاپ اینڈ ڈاؤن",
|
|
||||||
"reverseProxyMsg2": "اسے WebSocket کے لیے ترتیب دینے کا طریقہ چیک کریں"
|
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
"registry": "镜像仓库",
|
"registry": "镜像仓库",
|
||||||
"compose": "Compose",
|
"compose": "Compose",
|
||||||
"addFirstStackMsg": "组合你的第一个堆栈!",
|
"addFirstStackMsg": "组合你的第一个堆栈!",
|
||||||
"stackName": "堆栈名称",
|
"stackName" : "堆栈名称",
|
||||||
"deployStack": "部署",
|
"deployStack": "部署",
|
||||||
"deleteStack": "删除",
|
"deleteStack": "删除",
|
||||||
"stopStack": "停止",
|
"stopStack": "停止",
|
||||||
@ -22,7 +22,7 @@
|
|||||||
"editStack": "编辑",
|
"editStack": "编辑",
|
||||||
"discardStack": "放弃",
|
"discardStack": "放弃",
|
||||||
"saveStackDraft": "保存",
|
"saveStackDraft": "保存",
|
||||||
"notAvailableShort": "不可用",
|
"notAvailableShort" : "不可用",
|
||||||
"deleteStackMsg": "你确定要删除这个堆栈吗?",
|
"deleteStackMsg": "你确定要删除这个堆栈吗?",
|
||||||
"stackNotManagedByDockgeMsg": "这个堆栈不由Dockge管理",
|
"stackNotManagedByDockgeMsg": "这个堆栈不由Dockge管理",
|
||||||
"primaryHostname": "主机名",
|
"primaryHostname": "主机名",
|
||||||
@ -90,10 +90,5 @@
|
|||||||
"Allowed commands:": "允许使用的指令:",
|
"Allowed commands:": "允许使用的指令:",
|
||||||
"Internal Networks": "内部网络",
|
"Internal Networks": "内部网络",
|
||||||
"External Networks": "外部网络",
|
"External Networks": "外部网络",
|
||||||
"No External Networks": "无外部网络",
|
"No External Networks": "无外部网络"
|
||||||
"reconnecting...": "重连中...",
|
|
||||||
"reverseProxyMsg2": "检查如何配置WebSocket",
|
|
||||||
"reverseProxyMsg1": "正在使用反向代理?",
|
|
||||||
"connecting...": "正在连接到socket服务器...",
|
|
||||||
"Cannot connect to the socket server.": "无法连接到socket服务器。"
|
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ export default defineComponent({
|
|||||||
}, 1500);
|
}, 1500);
|
||||||
|
|
||||||
socket = io(url, {
|
socket = io(url, {
|
||||||
transports: [ "websocket", "polling" ]
|
transports: [ "websocket" ]
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("connect", () => {
|
socket.on("connect", () => {
|
||||||
|
@ -56,13 +56,6 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- URLs -->
|
|
||||||
<div v-if="urls.length > 0" class="mb-3">
|
|
||||||
<a v-for="(url, index) in urls" :key="index" target="_blank" :href="url.url">
|
|
||||||
<span class="badge bg-secondary me-2">{{ url.display }}</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Progress Terminal -->
|
<!-- Progress Terminal -->
|
||||||
<transition name="slide-fade" appear>
|
<transition name="slide-fade" appear>
|
||||||
<Terminal
|
<Terminal
|
||||||
@ -118,20 +111,6 @@
|
|||||||
|
|
||||||
<button v-if="false && isEditMode && jsonConfig.services && Object.keys(jsonConfig.services).length > 0" class="btn btn-normal mb-3" @click="addContainer">{{ $t("addContainer") }}</button>
|
<button v-if="false && isEditMode && jsonConfig.services && Object.keys(jsonConfig.services).length > 0" class="btn btn-normal mb-3" @click="addContainer">{{ $t("addContainer") }}</button>
|
||||||
|
|
||||||
<!-- General -->
|
|
||||||
<div v-if="isEditMode">
|
|
||||||
<h4 class="mb-3">{{ $t("extra") }}</h4>
|
|
||||||
<div class="shadow-box big-padding mb-3">
|
|
||||||
<!-- URLs -->
|
|
||||||
<div class="mb-4">
|
|
||||||
<label class="form-label">
|
|
||||||
{{ $tc("url", 2) }}
|
|
||||||
</label>
|
|
||||||
<ArrayInput name="urls" :display-name="$t('url')" placeholder="https://" object-type="x-dockge" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Combined Terminal Output -->
|
<!-- Combined Terminal Output -->
|
||||||
<div v-show="!isEditMode">
|
<div v-show="!isEditMode">
|
||||||
<h4 class="mb-3">Terminal</h4>
|
<h4 class="mb-3">Terminal</h4>
|
||||||
@ -273,34 +252,6 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
||||||
urls() {
|
|
||||||
if (!this.jsonConfig["x-dockge"] || !this.jsonConfig["x-dockge"].urls || !Array.isArray(this.jsonConfig["x-dockge"].urls)) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
let urls = [];
|
|
||||||
for (const url of this.jsonConfig["x-dockge"].urls) {
|
|
||||||
let display;
|
|
||||||
try {
|
|
||||||
let obj = new URL(url);
|
|
||||||
let pathname = obj.pathname;
|
|
||||||
if (pathname === "/") {
|
|
||||||
pathname = "";
|
|
||||||
}
|
|
||||||
display = obj.host + pathname + obj.search;
|
|
||||||
} catch (e) {
|
|
||||||
display = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
urls.push({
|
|
||||||
display,
|
|
||||||
url,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return urls;
|
|
||||||
},
|
|
||||||
|
|
||||||
isAdd() {
|
isAdd() {
|
||||||
return this.$route.path === "/compose" && !this.submitted;
|
return this.$route.path === "/compose" && !this.submitted;
|
||||||
},
|
},
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "dockge",
|
"name": "dockge",
|
||||||
"version": "1.2.0",
|
"version": "1.1.1",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"engines": {
|
|
||||||
"node": ">= 18.0.0 && <= 18.17.1"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"fmt": "eslint \"**/*.{ts,vue}\" --fix",
|
"fmt": "eslint \"**/*.{ts,vue}\" --fix",
|
||||||
"lint": "eslint \"**/*.{ts,vue}\"",
|
"lint": "eslint \"**/*.{ts,vue}\"",
|
||||||
|
Reference in New Issue
Block a user