diff --git a/Dockerfile b/Dockerfile index 387b5c6..26b3ecf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,12 +16,13 @@ COPY . /build RUN pnpm run build # build backend -FROM golang:1.19 as server_image +FROM golang:1.21-alpine as server_image WORKDIR /build COPY ./service . +RUN apk add --no-cache bash curl gcc git go musl-dev # 执行指令 关闭链接确认 RUN go env -w GO111MODULE=on \ @@ -34,7 +35,7 @@ RUN go env -w GO111MODULE=on \ # run_image -FROM ubuntu +FROM alpine WORKDIR /app @@ -42,6 +43,8 @@ COPY --from=web_image /build/dist /app/web COPY --from=server_image /build/sun-panel /app/sun-panel -RUN apt-get update && apt-get install -y ca-certificates &&./sun-panel -config +RUN apk add --no-cache bash ca-certificates su-exec tzdata \ + && chmod +x ./sun-panel \ + && ./sun-panel -config CMD ./sun-panel diff --git a/README.md b/README.md index ef978fb..82fcaf8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@
- + ## 😎 特点 -- 局域网内外网链接切换 - 简洁 -- docker 部署 +- 局域网内外网链接切换 +- docker部署,对arm系统支持 - 上手简单,免修改代码 - 无需连接外部数据库 - 丰富图标自由搭配(文字图标+svg图标+内置三方图标库) @@ -47,22 +49,36 @@ 先画个饼 -- [ ] 图标排序 +- [x] 分组,拖拽排序 +- [ ] 导入导出功能 +- [ ] 增加访客账号 +- [ ] 用户自定义搜索框搜索引擎 +- [ ] 搜索框样式自定义(背景颜色,文字颜色) +- [ ] 帐号解除邮箱限制 +- [ ] 对上传的文件管理(针对账户增强重复利用,节省空间) +- [ ] 多国语言支持 - [ ] 服务器监控 - [ ] docker管理器 - [ ] 计划任务 + + ## 🖼️ 预览截图 - - +**各种风格,自由搭配** + + + + +  -内置小窗口 +**内置小窗口** +   -## 🍜 使用教程 +## 🍜 使用运行教程 @@ -78,7 +94,20 @@ |-config|生成配置文件(conf/conf.ini)| |-password-reset|重置第一个用户的密码| +### 二进制文件运行 + +去 [Releases](https://github.com/hslr-s/sun-panel/releases) 下载二进制文件 + 执行示例 + +```sh +./sun-panel +``` + +#### 重置密码 + +执行示例 + ```sh ./sun-panel -password-reset ``` @@ -115,14 +144,14 @@ hslr/sun-panel ``` -### 编译和运行 +### 自编译运行 #### 前端 ``` # 开发运行 pnpm dev -# 编译打包 +# 编译打包(打包后生成dist目录,若需要结合后端使用请改成web) pnpm build ``` diff --git a/UPDATELOG.md b/UPDATELOG.md new file mode 100644 index 0000000..496fe38 --- /dev/null +++ b/UPDATELOG.md @@ -0,0 +1,22 @@ +# 更新说明 +> 老用户版本升级需要看升级说明,并且一定提前备份好重要数据。新用户可以直接使用最新版本。 + + +## v1.1.0 +> 支持上个版本直接升级无需特殊处理 + +- [新增] 增加分组,拖拽排序 +- [新增] 搜索框 +- [新增] 应用图标支持URL外链 +- [新增] 图标支持纯透明 +- [新增] 壁纸背景增加遮罩设置 +- [新增] 右键菜单新增打开局域网或者互联网地址 +- [优化] 网址输入框增加https/http提示 +- [优化] 小图标模式,鼠标悬浮显示详情,支持隐藏图标标题 +- [优化] 详情图标样式,支持隐藏描述信息 +- [优化] 添加用户密码时限制字符 +- [其他] 新增arm版本docker支持。[DockerHub](https://hub.docker.com/r/hslr/sun-panel)直接拉取即可 +- [其他] 新增多平台二进制文件运行。[Releases](https://github.com/hslr-s/sun-panel/releases) + +## v1.0.0 +- 首个版本 \ No newline at end of file diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..fd2ca21 --- /dev/null +++ b/build.sh @@ -0,0 +1,143 @@ +#!/bin/bash + +REPO=$( + cd $(dirname $0) + pwd +) +COMMIT_SHA=$(git rev-parse --short HEAD) +VERSION=$(git describe --tags) +# VERSION="0.1.1" +FRONTEND="false" +BINARY="false" +RELEASE="false" + +debugInfo() { + echo "Repo: $REPO" + echo "Build frontend: $FRONTEND" + echo "Build binary: $BINARY" + echo "Release: $RELEASE" + echo "Version: $VERSION" + echo "Commit: $COMMIT_SHA" +} + +buildFrontend() { + cd $REPO + pwd +# npm install pnpm -g + pnpm install + pnpm run build +} + +buildBackEndAssets() { + cd $REPO/service +# export PATH=$PATH:/root/go/bin + go install -a -v github.com/go-bindata/go-bindata/...@latest + go install -a -v github.com/elazarl/go-bindata-assetfs/...@latest + go-bindata-assetfs -o=assets/bindata.go -pkg=assets assets/... +} + +# buildBinary() { +# cd $REPO/service +# # mv "${REPO}/dist" "${REPO}/web" +# go build -o "sun-panel" --ldflags="-X sun-panel/global.RUNCODE=release" main.go +# } + +_build() { + cd $REPO/service + pwd + local osarch=$1 + IFS=/ read -r -a arr <<<"$osarch" + os="${arr[0]}" + arch="${arr[1]}" + gcc="${arr[2]}" + + # Go build to build the binary. + export GOOS=$os + export GOARCH=$arch + export CC=$gcc + export CGO_ENABLED=1 + + pathRelease=$REPO/release + + if [ -n "$VERSION" ]; then + outPath="sun-panel_${VERSION}_${os}_${arch}" + else + outPath="sun-panel_${COMMIT_SHA}_${os}_${arch}" + fi + outname="${pathRelease}/${outPath}/sun-panel" + go build -o "${outname}" --ldflags="-X sun-panel/global.RUNCODE=release" main.go + + cd $pathRelease + # copy front file + cp -r "${REPO}/dist" "${pathRelease}/${outPath}/web" + + echo "Release ${outPath}" + if [ "$os" = "windows" ]; then + mv $outname $outPath/sun-panel.exe + zip -r "${pathRelease}/${outPath}.zip" $outPath + else + mv $outname $outPath/sun-panel + tar -zcvf "${pathRelease}/${outPath}.tar.gz" $outPath + fi + rm -rf "${pathRelease}/${outPath}" +} + +release() { + cd $REPO/service + ## List of architectures and OS to test coss compilation. + SUPPORTED_OSARCH="linux/amd64/gcc linux/arm/arm-linux-gnueabihf-gcc windows/amd64/x86_64-w64-mingw32-gcc linux/arm64/aarch64-linux-gnu-gcc" + + echo "Release builds for OS/Arch/CC: ${SUPPORTED_OSARCH}" + for each_osarch in ${SUPPORTED_OSARCH}; do + _build "${each_osarch}" + done +} + +usage() { + # echo "Usage: $0 [-f] [-c] [-b] [-r]" 1>&2 + echo "Usage: $0 [-f] [-b] [-r]" 1>&2 + exit 1 +} + +while getopts "bfcrd" o; do + case "${o}" in + b) + FRONTEND="true" + BINARY="true" + ;; + f) + FRONTEND="true" + ;; + c) + BINARY="true" + ;; + r) + FRONTEND="true" + RELEASE="true" + ;; + d) + DEBUG="true" + ;; + *) + usage + ;; + esac +done +shift $((OPTIND - 1)) + +if [ "$DEBUG" = "true" ]; then + debugInfo +fi + +if [ "$FRONTEND" = "true" ]; then + buildFrontend +fi + +# if [ "$BINARY" = "true" ]; then +# buildBinary +# fi + +if [ "$RELEASE" = "true" ]; then + buildBackEndAssets + release +fi \ No newline at end of file diff --git a/doc/images/icon-info-new.png b/doc/images/icon-info-new.png new file mode 100644 index 0000000..c31947e Binary files /dev/null and b/doc/images/icon-info-new.png differ diff --git a/doc/images/icon-small-new.png b/doc/images/icon-small-new.png new file mode 100644 index 0000000..58d9194 Binary files /dev/null and b/doc/images/icon-small-new.png differ diff --git a/doc/images/logo.png b/doc/images/logo.png new file mode 100644 index 0000000..a3aac61 Binary files /dev/null and b/doc/images/logo.png differ diff --git a/doc/images/solid-color-info.png b/doc/images/solid-color-info.png new file mode 100644 index 0000000..2456a1b Binary files /dev/null and b/doc/images/solid-color-info.png differ diff --git a/doc/images/transparent-info.png b/doc/images/transparent-info.png new file mode 100644 index 0000000..8d22c10 Binary files /dev/null and b/doc/images/transparent-info.png differ diff --git a/doc/images/transparent-small.png b/doc/images/transparent-small.png new file mode 100644 index 0000000..a79846f Binary files /dev/null and b/doc/images/transparent-small.png differ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..22ad954 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +version: "3.2" + +services: + sun-panel: + image: 'hslr/sun-panel:latest' + container_name: sun-panel + volumes: + - ./conf:/app/conf + - ./uploads:/app/uploads + - ./database:/app/database + # - ./runtime:/app/runtime + ports: + - 3002:3002 + restart: always \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 47b016c..b8c261c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "chatgpt-web", + "name": "sun-panel", "version": "2.10.9", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "chatgpt-web", + "name": "sun-panel", "version": "2.10.9", "dependencies": { "@traptitech/markdown-it-katex": "^3.6.0", diff --git a/package.json b/package.json index c2781cd..b7f6618 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { - "name": "chatgpt-web", + "name": "sun-panel", "version": "2.10.9", "private": false, "description": "ChatGPT Web", "author": "ChenZhaoYu