From c4faf30a24ed6e11201db55415aca0a103ca0d2f Mon Sep 17 00:00:00 2001 From: cloudswave Date: Tue, 18 Jun 2024 17:15:32 +0800 Subject: [PATCH] add code-server --- .gitignore | 1 + .inscode | 2 +- config.yaml | 4 ++++ install.sh | 23 +++++++++++++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 config.yaml create mode 100644 install.sh diff --git a/.gitignore b/.gitignore index dc99ae8..24ad498 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store node_modules /dist +code-server-* # local env files diff --git a/.inscode b/.inscode index e177731..d024e18 100644 --- a/.inscode +++ b/.inscode @@ -1,4 +1,4 @@ -run = "npm i && npm run dev" +run = "bash install.sh" language = "node" [env] diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..c4954e5 --- /dev/null +++ b/config.yaml @@ -0,0 +1,4 @@ +bind-addr: 0.0.0.0:8080 +auth: password +password: ecae8153b8ff296ad898b622 +cert: false diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..bb10a32 --- /dev/null +++ b/install.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# 文件名和URL +filename="code-server-4.90.2-linux-amd64.tar.gz" +url="https://x.haod.me/https://github.com/coder/code-server/releases/download/v4.90.2/${filename}" + +# 检查文件是否存在,如果不存在则下载 +if [ ! -f "${filename}" ]; then + echo "Downloading ${filename}..." + wget "$url" +fi + +# 解压文件 +echo "Extracting ${filename}..." +tar -zxvf "${filename}" + + +# 清理压缩文件和解压后的目录 +#rm -rf "${filename}" + +# 运行 code-server +echo "Starting code-server with config file..." +./code-server-4.90.2-linux-amd64/bin/code-server --config ./config.yaml -- GitLab