Skip to content

Commit

Permalink
feat: 规范缩进
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Dec 30, 2023
1 parent 6a328c3 commit 7af5ab3
Show file tree
Hide file tree
Showing 19 changed files with 48 additions and 42 deletions.
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 行为准则

耗子Linux面板遵守业界通用的行为准则。任何违反行为准则的行为都可以报告给我们:
耗子 Linux 面板遵守业界通用的行为准则。任何违反行为准则的行为都可以报告给我们:

- 参与者将容忍反对意见。
- 参与者必须确保他们的语言和行为没有人身攻击和贬低个人言论。
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

## 运行环境

耗子Linux面板仅支持 `amd64` | `arm64` 架构下的主流系统的最新版本,不支持 `Ubuntu`,因为其发版太过频繁,难以维护。
耗子 Linux 面板仅支持 `amd64` | `arm64` 架构下的主流系统的最新版本,不支持 `Ubuntu`,因为其发版太过频繁,难以维护。

低配机器建议使用 `Debian`,资源占用较 `RHEL` 系更低。其他机器建议使用 `AlmaLinux` | `RockyLinux`,维护周期更长也更稳定。

Expand All @@ -53,7 +53,7 @@ CentOS Stream 可使用迁移脚本迁移至支持的系统: [CentOS 8/9 迁移
## 安装面板

> **Warning**
> 安装面板前,你需要了解LNMP环境的基本知识,以及如何处理常见的LNMP环境问题,不建议0基础的用户安装和使用耗子Linux面板
> 安装面板前,你需要了解 LNMP 环境的基本知识,以及如何处理常见的 LNMP 环境问题,不建议 0 基础的用户安装和使用耗子 Linux 面板
如果你决定继续,请以`root`用户登录服务器,执行以下命令安装面板:

Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## 安全说明

安全性是我们最关心的问题之一,我们已在多个不同应用的生产环境广泛应用耗子Linux面板,至今无一例安全事故。
安全性是我们最关心的问题之一,我们已在多个不同应用的生产环境广泛应用耗子 Linux 面板,至今无一例安全事故。

耗子Linux面板采用业界多种方案尽可能保证面板的安全性,但是我们不能保证面板的绝对安全性,**因此我们不对面板的安全性做任何保证**
耗子 Linux 面板采用业界多种方案尽可能保证面板的安全性,但是我们不能保证面板的绝对安全性,**因此我们不对面板的安全性做任何保证**

如果您在使用面板的过程中发现任何安全问题,请勿提交 Issue,可通过以下方式直接联系我们:

Expand Down
2 changes: 1 addition & 1 deletion app/console/commands/panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (receiver *Panel) Handle(ctx console.Context) error {
return nil
}

settings := []models.Setting{{Key: models.SettingKeyName, Value: "耗子Linux面板"}, {Key: models.SettingKeyMonitor, Value: "1"}, {Key: models.SettingKeyMonitorDays, Value: "30"}, {Key: models.SettingKeyBackupPath, Value: "/www/backup"}, {Key: models.SettingKeyWebsitePath, Value: "/www/wwwroot"}, {Key: models.SettingKeyVersion, Value: facades.Config().GetString("panel.version")}}
settings := []models.Setting{{Key: models.SettingKeyName, Value: "耗子 Linux 面板"}, {Key: models.SettingKeyMonitor, Value: "1"}, {Key: models.SettingKeyMonitorDays, Value: "30"}, {Key: models.SettingKeyBackupPath, Value: "/www/backup"}, {Key: models.SettingKeyWebsitePath, Value: "/www/wwwroot"}, {Key: models.SettingKeyVersion, Value: facades.Config().GetString("panel.version")}}
err = facades.Orm().Query().Create(&settings)
if err != nil {
color.Redln("初始化失败")
Expand Down
4 changes: 2 additions & 2 deletions app/http/controllers/cron_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (r *CronController) Add(ctx http.Context) http.Response {
shell = `#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
# 耗子Linux面板 - 数据备份脚本
# 耗子 Linux 面板 - 数据备份脚本
type=` + backupType + `
path=` + backupPath + `
Expand All @@ -102,7 +102,7 @@ panel backup ${type} ${name} ${path} ${save} 2>&1
shell = `#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
# 耗子Linux面板 - 日志切割脚本
# 耗子 Linux 面板 - 日志切割脚本
name=` + website + `
save=` + cast.ToString(save) + `
Expand Down
2 changes: 1 addition & 1 deletion config/panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
func init() {
config := facades.Config()
config.Add("panel", map[string]any{
"name": "耗子Linux面板",
"name": "耗子 Linux 面板",
"version": "v2.1.34",
"ssl": config.Env("APP_SSL", false),
})
Expand Down
6 changes: 3 additions & 3 deletions internal/services/website.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (r *WebsiteImpl) Add(website internal.PanelWebsite) (models.Website, error)
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>耗子Linux面板</title>
<title>耗子 Linux 面板</title>
<style>
body {
background-color: #f9f9f9;
Expand Down Expand Up @@ -104,8 +104,8 @@ func (r *WebsiteImpl) Add(website internal.PanelWebsite) (models.Website, error)
</head>
<body>
<div class="container">
<h1>耗子Linux面板</h1>
<p>这是耗子Linux面板的网站默认页面!</p>
<h1>耗子 Linux 面板</h1>
<p>这是耗子 Linux 面板的网站默认页面!</p>
<p>当您看到此页面,说明您的网站已创建成功。</p>
</div>
</body>
Expand Down
5 changes: 5 additions & 0 deletions pkg/tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,10 @@ func UpdatePanel(panelInfo PanelInfo) error {
color.Redln("恢复面板配置失败")
return err
}
if _, err = Exec("cp -f /www/panel/scripts/panel.sh /usr/bin/panel"); err != nil {
color.Redln("恢复面板脚本失败")
return err
}
if !Exists("/www/panel/storage/panel.db") || !Exists("/www/panel/panel.conf") {
color.Redln("恢复面板数据失败")
return errors.New("恢复面板数据失败")
Expand All @@ -481,6 +485,7 @@ func UpdatePanel(panelInfo PanelInfo) error {

color.Greenln("设置面板文件权限...")
_, _ = Exec("chmod -R 700 /www/panel")
_, _ = Exec("chmod -R 700 /usr/bin/panel")
color.Greenln("设置完成")

if _, err = Exec("/www/panel/panel --env=panel.conf artisan migrate"); err != nil {
Expand Down
20 changes: 10 additions & 10 deletions scripts/install_panel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'

LOGO="+----------------------------------------------------\n| 耗子Linux面板安装脚本\n+----------------------------------------------------\n| Copyright © 2022-"$(date +%Y)" 耗子科技 All rights reserved.\n+----------------------------------------------------"
LOGO="+----------------------------------------------------\n| 耗子 Linux 面板安装脚本\n+----------------------------------------------------\n| Copyright © 2022-"$(date +%Y)" 耗子科技 All rights reserved.\n+----------------------------------------------------"
HR="+----------------------------------------------------"
setup_Path="/www"
sshPort=$(cat /etc/ssh/sshd_config | grep 'Port ' | awk '{print $2}')
Expand All @@ -27,41 +27,41 @@ inChina=$(curl --retry 2 -m 10 -L https://www.cloudflare-cn.com/cdn-cgi/trace 2>
Prepare_System() {
if [ $(whoami) != "root" ]; then
echo -e $HR
echo "错误:请使用root用户运行安装命令"
echo "错误:请使用 root 用户运行安装命令"
exit 1
fi

ARCH=$(uname -m)
OS=$(source /etc/os-release && { [[ "$ID" == "debian" ]] && echo "debian"; } || { [[ "$ID" == "centos" ]] || [[ "$ID" == "rhel" ]] || [[ "$ID" == "rocky" ]] || [[ "$ID" == "almalinux" ]] && echo "centos"; } || echo "unknown")
if [ "${OS}" == "unknown" ]; then
echo -e $HR
echo "错误:该系统不支持安装耗子Linux面板,请更换Debian12/RHEL9安装"
echo "错误:该系统不支持安装耗子 Linux 面板,请更换 Debian 12.x / RHEL 9.x 安装"
exit 1
fi
if [ "${ARCH}" != "x86_64" ] && [ "${ARCH}" != "aarch64" ]; then
echo -e $HR
echo "错误:该系统架构不支持安装耗子Linux面板,请更换x86_64/aarch64架构安装"
echo "错误:该系统架构不支持安装耗子 Linux 面板,请更换 x86_64 / aarch64 架构安装"
exit 1
fi

kernelVersion=$(uname -r | awk -F '.' '{print $1}')
if [ "${kernelVersion}" != "5" ] && [ "${kernelVersion}" != "6" ]; then
echo -e $HR
echo "错误:该系统内核版本太低,不支持安装耗子Linux面板,请更换Debian12/RHEL9安装"
echo "错误:该系统内核版本太低,不支持安装耗子 Linux 面板,请更换 Debian 12 / RHEL 9.x 安装"
exit 1
fi

is64bit=$(getconf LONG_BIT)
if [ "${is64bit}" != '64' ]; then
echo -e $HR
echo "错误:32位系统不支持安装耗子Linux面板,请更换64位系统安装"
echo "错误:32 位系统不支持安装耗子 Linux 面板,请更换 64 位系统安装"
exit 1
fi

isInstalled=$(systemctl status panel 2>&1 | grep "Active")
if [ "${isInstalled}" != "" ]; then
echo -e $HR
echo "错误:耗子Linux面板已安装,请勿重复安装。"
echo "错误:耗子 Linux 面板已安装,请勿重复安装。"
exit 1
fi

Expand Down Expand Up @@ -140,7 +140,7 @@ Prepare_System() {
apt-get install -y curl wget zip unzip tar git jq git dos2unix rsyslog
else
echo -e $HR
echo "错误:该系统不支持安装耗子Linux面板,请更换Debian12/RHEL9安装"
echo "错误:该系统不支持安装耗子 Linux 面板,请更换 Debian 12.x / RHEL 9.x 安装"
exit 1
fi

Expand Down Expand Up @@ -205,7 +205,7 @@ Init_Panel() {
fi
else
echo -e $HR
echo "错误:该系统架构不支持安装耗子Linux面板,请更换x86_64/aarch64架构安装"
echo "错误:该系统架构不支持安装耗子 Linux 面板,请更换 x86_64 / aarch64 架构安装"
exit 1
fi
if [ "$?" != "0" ] || [ "${panelZip}" == "" ] || [ "${panelZipName}" == "" ]; then
Expand Down Expand Up @@ -248,7 +248,7 @@ Init_Panel() {
${setup_Path}/panel/panel --env="panel.conf" artisan jwt:secret
${setup_Path}/panel/panel --env="panel.conf" artisan migrate
chmod -R 700 ${setup_Path}/panel
cp scripts/panel.sh /usr/bin/panel
cp -f scripts/panel.sh /usr/bin/panel
chmod -R 700 /usr/bin/panel
# 防火墙放行
if [ "${OS}" == "centos" ]; then
Expand Down
2 changes: 1 addition & 1 deletion scripts/mysql/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ elif [ "${OS}" == "debian" ]; then
apt-get install build-essential cmake bison libncurses5-dev libtirpc-dev libssl-dev pkg-config libldap2-dev libudev-dev libsasl2-dev patchelf -y
else
echo -e $HR
echo "错误:耗子Linux面板不支持该系统"
echo "错误:耗子 Linux 面板不支持该系统"
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion scripts/mysql/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ elif [ "${OS}" == "debian" ]; then
apt-get install build-essential cmake bison libncurses5-dev libtirpc-dev libssl-dev pkg-config libldap2-dev libudev-dev libsasl2-dev patchelf -y
else
echo -e $HR
echo "错误:耗子Linux面板不支持该系统"
echo "错误:耗子 Linux 面板不支持该系统"
exit 1
fi

Expand Down
16 changes: 8 additions & 8 deletions scripts/openresty/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ elif [ "${OS}" == "debian" ]; then
apt-get install build-essential tar unzip libgd3 libgd-dev git flex perl libonig-dev libsodium-dev libxml2-dev libxslt1-dev bison libyajl-dev curl libcurl4-openssl-dev libncurses5-dev libevent-dev libreadline-dev uuid-dev libbrotli-dev icu-devtools libicu-dev openssl libssl-dev -y
else
echo -e $HR
echo "错误:耗子Linux面板不支持该系统"
echo "错误:耗子 Linux 面板不支持该系统"
exit 1
fi

Expand Down Expand Up @@ -402,7 +402,7 @@ cat > ${openrestyPath}/html/index.html << EOF
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>未找到网站 - 耗子Linux面板</title>
<title>未找到网站 - 耗子 Linux 面板</title>
<style>
body {
background-color: #f9f9f9;
Expand Down Expand Up @@ -443,8 +443,8 @@ cat > ${openrestyPath}/html/index.html << EOF
</head>
<body>
<div class="container">
<h1>耗子Linux面板</h1>
<p>这是耗子Linux面板的OpenResty默认页面!</p>
<h1>耗子 Linux 面板</h1>
<p>这是耗子 Linux 面板的 OpenResty 默认页面!</p>
<p>当您看到此页面,说明无法在服务器上找到该域名对应的站点。</p>
</div>
</body>
Expand All @@ -458,7 +458,7 @@ cat > ${openrestyPath}/html/stop.html << EOF
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>网站已停止 - 耗子Linux面板</title>
<title>网站已停止 - 耗子 Linux 面板</title>
<style>
body {
background-color: #f9f9f9;
Expand Down Expand Up @@ -499,7 +499,7 @@ cat > ${openrestyPath}/html/stop.html << EOF
</head>
<body>
<div class="container">
<h1>耗子Linux面板</h1>
<h1>耗子 Linux 面板</h1>
<p>该网站已被管理员停止访问!</p>
<p>当您看到此页面,说明该网站已被服务器管理员停止对外访问。</p>
</div>
Expand All @@ -514,7 +514,7 @@ cat > ${openrestyPath}/html/block.html << EOF
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>请求被拦截 - 耗子Linux面板</title>
<title>请求被拦截 - 耗子 Linux 面板</title>
<style>
body {
background-color: #f9f9f9;
Expand Down Expand Up @@ -555,7 +555,7 @@ cat > ${openrestyPath}/html/block.html << EOF
</head>
<body>
<div class="container">
<h1>耗子Linux面板</h1>
<h1>耗子 Linux 面板</h1>
<p>本次请求判断为危险的攻击请求,已被拦截!</p>
<p>当您看到此页面,说明您的请求被WAF拦截,可能是由于您的请求中包含了危险的攻击内容,或者您的请求被误判为攻击请求。</p>
<p>如果您认为这是误判,请联系服务器管理员解决。</p>
Expand Down
1 change: 1 addition & 0 deletions scripts/panel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'

/www/panel/panel --env="/www/panel/panel.conf" artisan panel "$@"
2 changes: 1 addition & 1 deletion scripts/php/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ elif [ "${OS}" == "debian" ]; then
apt-get install build-essential autoconf libc6-dev libgdbm-dev libgd-tools libgd-dev perl libonig-dev libsodium-dev libxml2-dev libsqlite3-dev libzip-dev libbz2-dev liblzma-dev libpng-dev libjpeg-dev libwebp-dev libavif-dev libfreetype6-dev libgmp-dev libssl-dev libreadline-dev libxslt1-dev libcurl4-openssl-dev pkg-config libedit-dev zlib1g-dev libpcre3-dev cron libicu-dev libc-ares2 libc-ares-dev -y
else
echo -e $HR
echo "错误:耗子Linux面板不支持该系统"
echo "错误:耗子 Linux 面板不支持该系统"
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion scripts/php_extensions/imagick.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Install() {
apt-get install imagemagick libmagickwand-dev -y
else
echo -e $HR
echo "错误:耗子Linux面板不支持该系统"
echo "错误:耗子 Linux 面板不支持该系统"
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion scripts/postgresql/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ elif [ "${OS}" == "debian" ]; then
apt-get install build-essential make gettext zlib1g-dev libreadline-dev libicu-dev libxml2-dev libxslt-dev libssl-dev libsystemd-dev -y
else
echo -e $HR
echo "错误:耗子Linux面板不支持该系统"
echo "错误:耗子 Linux 面板不支持该系统"
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion scripts/postgresql/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ elif [ "${OS}" == "debian" ]; then
apt-get install build-essential make gettext zlib1g-dev libreadline-dev libicu-dev libxml2-dev libxslt-dev libssl-dev libsystemd-dev -y
else
echo -e $HR
echo "错误:耗子Linux面板不支持该系统"
echo "错误:耗子 Linux 面板不支持该系统"
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion scripts/redis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ elif [ "${OS}" == "debian" ]; then
apt-get install build-essential libsystemd-dev libssl-dev -y
else
echo -e $HR
echo "错误:耗子Linux面板不支持该系统"
echo "错误:耗子 Linux 面板不支持该系统"
exit 1
fi

Expand Down
10 changes: 5 additions & 5 deletions scripts/uninstall_panel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'

LOGO="+----------------------------------------------------\n| 耗子Linux面板卸载脚本\n+----------------------------------------------------\n| Copyright © 2022-"$(date +%Y)" 耗子科技 All rights reserved.\n+----------------------------------------------------"
LOGO="+----------------------------------------------------\n| 耗子 Linux 面板卸载脚本\n+----------------------------------------------------\n| Copyright © 2022-"$(date +%Y)" 耗子科技 All rights reserved.\n+----------------------------------------------------"
HR="+----------------------------------------------------"
download_Url=""
setup_Path="/www"
Expand All @@ -33,7 +33,7 @@ Prepare_System() {
isInstalled=$(systemctl status panel 2>&1 | grep "Active")
if [ "${isInstalled}" == "" ]; then
echo -e $HR
echo "错误:耗子Linux面板未安装,无需卸载。"
echo "错误:耗子 Linux 面板未安装,无需卸载。"
exit 1
fi

Expand Down Expand Up @@ -80,7 +80,7 @@ if [ "${uninstall}" != 'y' ]; then
fi

echo -e "${LOGO}"
echo '正在卸载耗子Linux面板...'
echo '正在卸载耗子 Linux 面板...'
echo -e $HR

Prepare_System
Expand All @@ -90,8 +90,8 @@ Remove_Panel
clear

echo -e "${LOGO}"
echo '耗子Linux面板卸载完成'
echo '感谢您的使用,欢迎您再次使用耗子Linux面板'
echo '耗子 Linux 面板卸载完成'
echo '感谢您的使用,欢迎您再次使用耗子 Linux 面板'
echo -e $HR

rm -f uninstall_panel.sh
Expand Down

0 comments on commit 7af5ab3

Please sign in to comment.