Skip to content

Commit

Permalink
feat: 优化 curl 命令
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Oct 23, 2023
1 parent 12c25bf commit a7de247
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Fetch Frontend
run: |
sudo apt-get install -y curl jq unzip zip
curl -L -s https://api.github.com/repos/haozi-team/panel-frontend/releases/latest | jq -r ".assets[] | select(.name | contains(\"dist\")) | .browser_download_url" | xargs curl -L -o frontend.zip
curl -sSL https://api.github.com/repos/haozi-team/panel-frontend/releases/latest | jq -r ".assets[] | select(.name | contains(\"dist\")) | .browser_download_url" | xargs curl -L -o frontend.zip
rm -rf public
unzip frontend.zip
mv dist public
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fetch:
- sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
- apk add --no-cache curl jq unzip zip
script:
- curl -L -s "https://jihulab.com/api/v4/projects/haozi-team%2Fpanel-frontend/releases" | jq -r '.[0].assets.links[] | select(.name | contains("dist")) | .direct_asset_url' | xargs curl -L -o frontend.zip
- curl -sSL "https://jihulab.com/api/v4/projects/haozi-team%2Fpanel-frontend/releases" | jq -r '.[0].assets.links[] | select(.name | contains("dist")) | .direct_asset_url' | xargs curl -L -o frontend.zip
- rm -rf public
- unzip frontend.zip
- mv dist public
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ CentOS Stream 可使用迁移脚本迁移至支持的系统: [CentOS 8/9 迁移
如果你决定继续,请以`root`用户登录服务器,执行以下命令安装面板:

```shell
bash <(curl -L -sSL https://jihulab.com/haozi-team/download/-/raw/main/panel/install_panel.sh)
bash <(curl -sSL https://jihulab.com/haozi-team/download/-/raw/main/panel/install_panel.sh)
```

## 卸载面板
Expand All @@ -62,7 +62,7 @@ bash <(curl -L -sSL https://jihulab.com/haozi-team/download/-/raw/main/panel/ins
如果你无法重装系统,请以`root`用户登录服务器,执行以下命令卸载面板:

```shell
bash <(curl -L -sSL https://jihulab.com/haozi-team/download/-/raw/main/panel/uninstall_panel.sh)
bash <(curl -sSL https://jihulab.com/haozi-team/download/-/raw/main/panel/uninstall_panel.sh)
```

卸载面板前请务必备份好所有数据,提前卸载面板全部插件。卸载后数据将**无法恢复**
Expand Down
4 changes: 2 additions & 2 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Before installing the panel, you need to understand the basic knowledge of the L
If you decide to continue, please log in to the server as `root` user and execute the following command to install the panel:

```shell
bash <(curl -L -sSL https://jihulab.com/haozi-team/download/-/raw/main/panel/install_panel.sh)
bash <(curl -sSL https://jihulab.com/haozi-team/download/-/raw/main/panel/install_panel.sh)
```

## Uninstall Panel
Expand All @@ -58,7 +58,7 @@ Recommended to back up data and reinstall the system first, so that the system c
If you are unable to reinstall the system, log in to the server as the `root` user and execute the following command to uninstall the panel:

```shell
bash <(curl -L -sSL https://jihulab.com/haozi-team/download/-/raw/main/panel/uninstall_panel.sh)
bash <(curl -sSL https://jihulab.com/haozi-team/download/-/raw/main/panel/uninstall_panel.sh)
```

Before uninstalling the panel, please be sure to back up all data and uninstall all panel plugins in advance. The data will **not be recoverable** after uninstallation!
Expand Down
8 changes: 4 additions & 4 deletions pkg/tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ func GetLatestPanelVersion() (PanelInfo, error) {
isChina := IsChina()

if isChina {
output = Exec(`curl -L -s "https://jihulab.com/api/v4/projects/haozi-team%2Fpanel/releases/permalink/latest"`)
output = Exec(`curl -sSL "https://jihulab.com/api/v4/projects/haozi-team%2Fpanel/releases/permalink/latest"`)
} else {
output = Exec(`curl -L -s "https://api.github.com/repos/haozi-team/panel/releases/latest"`)
output = Exec(`curl -sSL "https://api.github.com/repos/haozi-team/panel/releases/latest"`)
}

if len(output) == 0 {
Expand Down Expand Up @@ -160,9 +160,9 @@ func GetPanelVersion(version string) (PanelInfo, error) {
isChina := IsChina()

if isChina {
output = Exec(`curl -L -s "https://jihulab.com/api/v4/projects/haozi-team%2Fpanel/releases/"` + version + `"`)
output = Exec(`curl -sSL "https://jihulab.com/api/v4/projects/haozi-team%2Fpanel/releases/"` + version + `"`)
} else {
output = Exec(`curl -L -s "https://api.github.com/repos/haozi-team/panel/releases/tags/` + version + `"`)
output = Exec(`curl -sSL "https://api.github.com/repos/haozi-team/panel/releases/tags/` + version + `"`)
}

if len(output) == 0 {
Expand Down
8 changes: 4 additions & 4 deletions scripts/install_panel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,15 @@ Init_Panel() {
# 下载面板zip包并解压
if [ "${ARCH}" == "x86_64" ]; then
if ${inChina}; then
panelZip=$(curl -L -s "https://jihulab.com/api/v4/projects/haozi-team%2Fpanel/releases" | jq -r '.[0].assets.links[] | select(.name | contains("amd64v2")) | .direct_asset_url')
panelZip=$(curl -sSL "https://jihulab.com/api/v4/projects/haozi-team%2Fpanel/releases" | jq -r '.[0].assets.links[] | select(.name | contains("amd64v2")) | .direct_asset_url')
else
panelZip=$(curl -L -s "https://api.github.com/repos/haozi-team/panel/releases/latest" | jq -r '.assets[] | select(.name | contains("amd64v2")) | .browser_download_url')
panelZip=$(curl -sSL "https://api.github.com/repos/haozi-team/panel/releases/latest" | jq -r '.assets[] | select(.name | contains("amd64v2")) | .browser_download_url')
fi
elif [ "${ARCH}" == "aarch64" ]; then
if ${inChina}; then
panelZip=$(curl -L -s "https://jihulab.com/api/v4/projects/haozi-team%2Fpanel/releases" | jq -r '.[0].assets.links[] | select(.name | contains("arm64")) | .direct_asset_url')
panelZip=$(curl -sSL "https://jihulab.com/api/v4/projects/haozi-team%2Fpanel/releases" | jq -r '.[0].assets.links[] | select(.name | contains("arm64")) | .direct_asset_url')
else
panelZip=$(curl -L -s "https://api.github.com/repos/haozi-team/panel/releases/latest" | jq -r '.assets[] | select(.name | contains("arm64")) | .browser_download_url')
panelZip=$(curl -sSL "https://api.github.com/repos/haozi-team/panel/releases/latest" | jq -r '.assets[] | select(.name | contains("arm64")) | .browser_download_url')
fi
else
echo -e $HR
Expand Down

0 comments on commit a7de247

Please sign in to comment.