feat: 清理提交
All checks were successful
Generate Checksums / checksums (push) Successful in 46s

This commit is contained in:
2026-01-31 07:03:45 +08:00
commit 758e1c8799
487 changed files with 8839 additions and 0 deletions

90
code-server/install.sh Normal file
View File

@@ -0,0 +1,90 @@
#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
source <(curl -f -s --connect-timeout 10 --retry 3 https://dl.acepanel.net/public.sh)
if [ $? -ne 0 ]; then
echo "Download public.sh failed, please check the network or try again later."
exit 1
fi
channel=${1}
version=${2}
code_server_path="${setup_path}/server/code-server"
if [ ! -d "${code_server_path}" ]; then
mkdir -p ${code_server_path}
fi
# 架构判断
if [ ${ARCH} == "x86_64" ]; then
code_server_file="code-server-${version}-linux-amd64.7z"
elif [ ${ARCH} == "aarch64" ]; then
code_server_file="code-server-${version}-linux-arm64.7z"
else
error "Unsupported architecture"
fi
# 下载
cd ${code_server_path}
dl "${code_server_path}" "/code-server/${code_server_file}"
# 解压
cd ${code_server_path}
7z x ${code_server_file}
rm -f ${code_server_file}
if [ ! -f "${code_server_path}/bin/code-server" ]; then
rm -rf ${code_server_path}
error "code-server extraction failed"
fi
# 初始化目录
chown -R root:root ${code_server_path}
chmod -R 700 ${code_server_path}
ln -sf ${code_server_path}/bin/code-server /usr/local/bin/code-server
# 写入配置
password=$(cat /dev/urandom | head -n 16 | sha256sum | head -c 16)
cat >/root/.config/code-server/config.yaml <<EOF
bind-addr: 0.0.0.0:9999
auth: password
password: ${password}
cert: true
EOF
chmod 600 /root/.config/code-server/config.yaml
# 配置systemd
cat >/etc/systemd/system/code-server.service <<EOF
[Unit]
Description=VS Code in the browser
After=network.target
[Service]
User=root
Group=root
WorkingDirectory=${code_server_path}
ExecStart=/usr/local/bin/code-server --disable-telemetry
[Install]
WantedBy=multi-user.target
EOF
chmod 644 /etc/systemd/system/code-server.service
systemctl daemon-reload
systemctl enable --now code-server
if [ "$?" != "0" ]; then
error "Failed to start"
fi
# 防火墙
firewall-cmd --zone=public --add-port=9999/tcp --permanent
firewall-cmd --reload
acepanel app write codeserver ${channel} ${version}
echo -e $HR
echo "Installation successful"
echo "默认端口 9999密码见配置文件"
echo "Default port 9999, password in config file"
echo -e $HR