ready for pub
This commit is contained in:
parent
cfaf82def3
commit
382732c23c
5 changed files with 161 additions and 2 deletions
45
.github/workflows/build.yml
vendored
45
.github/workflows/build.yml
vendored
|
|
@ -95,4 +95,47 @@ jobs:
|
||||||
allowUpdates: true
|
allowUpdates: true
|
||||||
body: ${{ env.VERSION }}
|
body: ${{ env.VERSION }}
|
||||||
env:
|
env:
|
||||||
export PATH: $PATH:/usr/local/go/bin
|
export PATH: $PATH:/usr/local/go/bin
|
||||||
|
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build # 确保这个作业在 build 作业完成后运行
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: wjqserver/caddydash # 定义镜像名称变量
|
||||||
|
DOCKERFILE: docker/Dockerfile # 定义 Dockerfile 路径变量
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: main
|
||||||
|
- name: Load VERSION
|
||||||
|
run: |
|
||||||
|
if [ -f VERSION ]; then
|
||||||
|
echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "VERSION file not found!" && exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: 构建镜像
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
file: ./${{ env.DOCKERFILE }}
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ env.IMAGE_NAME }}:${{ env.VERSION }}
|
||||||
|
${{ env.IMAGE_NAME }}:v0
|
||||||
|
${{ env.IMAGE_NAME }}:latest
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
CaddyDash 是一个现代化、用户友好的 Web 界面,用于管理和配置您的 Caddy 服务器。它提供了一个直观的图形界面,让您能够轻松地管理站点配置、调整全局设置,并监控 Caddy 实例的状态。
|
CaddyDash 是一个现代化、用户友好的 Web 界面,用于管理和配置您的 Caddy 服务器。它提供了一个直观的图形界面,让您能够轻松地管理站点配置、调整全局设置,并监控 Caddy 实例的状态。
|
||||||
|
|
||||||
|
[English](README_EN.md) | 简体中文
|
||||||
|
|
||||||
## ✨ 特性
|
## ✨ 特性
|
||||||
|
|
||||||
* **直观的站点配置**: 通过表单轻松创建、编辑和删除站点配置,支持反向代理和文件服务模式。
|
* **直观的站点配置**: 通过表单轻松创建、编辑和删除站点配置,支持反向代理和文件服务模式。
|
||||||
|
|
|
||||||
61
README_EN.md
Normal file
61
README_EN.md
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
# CaddyDash - Modern Caddy Web Administration Panel
|
||||||
|
|
||||||
|
CaddyDash is a modern, user-friendly web interface for managing and configuring your Caddy server. It provides an intuitive graphical interface, allowing you to easily manage site configurations, adjust global settings, and monitor the status of your Caddy instances.
|
||||||
|
|
||||||
|
[简体中文](README.md) | English
|
||||||
|
|
||||||
|
## ✨ Features
|
||||||
|
|
||||||
|
* **Intuitive Site Configuration**: Easily create, edit, and delete site configurations through forms, supporting reverse proxy and file serving modes.
|
||||||
|
* **Global Caddyfile Management**: Directly modify and save Caddy's global configuration file within the web interface.
|
||||||
|
* **Caddy Instance Control**: One-click start, stop, and reload of the Caddy service.
|
||||||
|
* **Multi-language Support**: Built-in internationalization (i18n) functionality, supporting English and Chinese switching, with future expandability for more languages.
|
||||||
|
* **Responsive Design**: The interface adapts to desktop and mobile devices, providing a consistent user experience.
|
||||||
|
* **Theme Switching**: Supports light and dark themes to suit different user preferences.
|
||||||
|
* **User Authentication**: Provides secure login and initialization processes to ensure panel access security.
|
||||||
|
* **Preset Management**: Supports populating common request header configurations from presets, improving configuration efficiency.
|
||||||
|
|
||||||
|
## 🚀 Tech Stack
|
||||||
|
|
||||||
|
**Frontend:**
|
||||||
|
|
||||||
|
* **Pure Native HTML5/CSS3/JavaScript (ESM)**: Built entirely on native browser technologies, responsive design, and mobile-friendly.
|
||||||
|
|
||||||
|
**Backend:**
|
||||||
|
|
||||||
|
* **Go Language**: High-performance, concurrency-friendly backend service.
|
||||||
|
* **Touka Framework**: HTTP framework built on Go, used for handling web requests.
|
||||||
|
* **SQLite**: Lightweight embedded database for storing user and configuration data.
|
||||||
|
* **CaddyServer**: The core component.
|
||||||
|
|
||||||
|
## 💡 Architecture Overview
|
||||||
|
|
||||||
|
CaddyDash frontend adopts a **Multi-Page Application (MPA)** architecture, where each main functional module corresponds to an independent HTML page, driven by its dedicated JavaScript entry file.
|
||||||
|
|
||||||
|
* **Highly Modular**: All JavaScript code is organized in **ESM (ECMAScript Modules)** form, enabling code reuse and separation of concerns through `import/export` mechanisms.
|
||||||
|
* **Shared Components**: Modules like `js/common.js`, `js/locale.js`, `js/notifications.js`, `js/ui.js`, `js/api.js` encapsulate functionalities shared across pages, such as page initialization, internationalization, notifications, UI operations, and backend API calls.
|
||||||
|
* **Independent Page Logic**: `js/app.js` (site configuration), `js/global.js` (global configuration), `js/settings.js` (panel settings), `js/login.js` (login), `js/init.js` (initialization) handle their respective page-specific business logic.
|
||||||
|
|
||||||
|
## 🌐 Internationalization (i18n)
|
||||||
|
|
||||||
|
CaddyDash frontend supports multi-language display.
|
||||||
|
|
||||||
|
* **Language Packs**: Translation texts are stored in `locales/en.json` (English) and `locales/zh-CN.json` (Simplified Chinese) files.
|
||||||
|
* **Dynamic Translation**: The `js/locale.js` module is responsible for loading the correct language pack and dynamically translating texts within HTML elements that have `data-i18n` (content), `data-i18n-title` (title attribute), and `data-i18n-placeholder` (input placeholder) attributes.
|
||||||
|
* **Switching Languages**: On the login page, initialization page, or panel settings page, you can change the language through the language toggle options in the interface.
|
||||||
|
|
||||||
|
**How to add new translation entries:**
|
||||||
|
|
||||||
|
1. Add new key-value pairs to `locales/en.json` and `locales/zh-CN.json`. Please follow the existing dot-separated naming convention (e.g., `pages.feature.new_text`).
|
||||||
|
2. In HTML, use `data-i18n="your.new.key"`, `data-i18n-title="your.new.key"`, or `data-i18n-placeholder="your.new.key"` attributes.
|
||||||
|
3. In JavaScript code, use the `t('your.new.key', { replacements })` function to retrieve translated text.
|
||||||
|
|
||||||
|
## 🤝 Contributing
|
||||||
|
|
||||||
|
We welcome and encourage contributions of all forms! If you have any feature suggestions, bug reports, or code improvements, please feel free to submit them via Issues or Pull Requests.
|
||||||
|
|
||||||
|
## 📜 License
|
||||||
|
|
||||||
|
Copyright © 2025 WJQSERVER
|
||||||
|
|
||||||
|
This project CaddyDash is licensed under the **Mozilla Public License 2.0 (MPL 2.0)**.
|
||||||
|
|
@ -92,7 +92,7 @@ func DefaultConfig() *Config {
|
||||||
CaddyDir: "./",
|
CaddyDir: "./",
|
||||||
},
|
},
|
||||||
DB: DatabaseConfig{
|
DB: DatabaseConfig{
|
||||||
Filepath: "caddydash.db",
|
Filepath: "./db/caddydash.db",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
53
docker/Dockerfile
Normal file
53
docker/Dockerfile
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
FROM alpine:latest AS BUILD
|
||||||
|
|
||||||
|
ARG TARGETOS
|
||||||
|
ARG TARGETARCH
|
||||||
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
|
# 更新并安装所需的软件包
|
||||||
|
RUN apk update && apk add --no-cache sed wget curl tar
|
||||||
|
|
||||||
|
# 创建文件夹结构
|
||||||
|
RUN mkdir -p /data/caddy/config
|
||||||
|
RUN mkdir -p /data/caddy/config.d
|
||||||
|
RUN mkdir -p /usr/local/bin
|
||||||
|
|
||||||
|
# 下载并解压caddy
|
||||||
|
RUN VERSION=$(curl -s https://raw.githubusercontent.com/WJQSERVER/caddy/main/VERSION) && \
|
||||||
|
echo "VERSION: ${VERSION}" && \
|
||||||
|
wget -O /data/caddy/caddy.tar.gz https://github.com/WJQSERVER/caddy/releases/download/${VERSION}/caddy-${TARGETOS}-${TARGETARCH}-pages.tar.gz
|
||||||
|
RUN tar -xzvf /data/caddy/caddy.tar.gz -C /data/caddy
|
||||||
|
RUN rm /data/caddy/caddy.tar.gz
|
||||||
|
RUN chmod +x /data/caddy/caddy
|
||||||
|
|
||||||
|
RUN DASHVERSION=$(curl -s https://raw.githubusercontent.com/WJQSERVER/caddydash/main/VERSION) && \
|
||||||
|
echo "VERSION: ${DASHVERSION}" && \
|
||||||
|
wget -O /data/caddy/caddydash.tar.gz https://github.com/WJQSERVER/caddydash/releases/download/${DASHVERSION}/caddy-${TARGETOS}-${TARGETARCH}-pages.tar.gz
|
||||||
|
RUN tar -xzvf /data/caddy/caddydash.tar.gz -C /data/caddy
|
||||||
|
RUN rm /data/caddy/caddydash.tar.gz
|
||||||
|
RUN chmod +x /data/caddy/caddydash
|
||||||
|
|
||||||
|
# 构建镜像
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# 创建必要的目录
|
||||||
|
RUN mkdir -p /data/caddy/config
|
||||||
|
RUN mkdir -p /data/caddy/config.d
|
||||||
|
RUN mkdir -p /data/caddy/log
|
||||||
|
RUN mkdir -p /data/caddy/db
|
||||||
|
|
||||||
|
COPY frontend /data/caddy/
|
||||||
|
COPY gtmpl /data/caddy/
|
||||||
|
COPY tmpl /data/caddy/
|
||||||
|
|
||||||
|
# 复制构建阶段的文件
|
||||||
|
COPY --from=BUILD /data/caddy /data/caddy
|
||||||
|
COPY --from=BUILD /usr/local/bin/init.sh /usr/local/bin/init.sh
|
||||||
|
|
||||||
|
# 配置权限
|
||||||
|
RUN chmod +x /data/caddy/caddy
|
||||||
|
RUN chmod +x /data/caddy/caddydash
|
||||||
|
|
||||||
|
# 启动命令
|
||||||
|
WORKDIR /data/caddy/
|
||||||
|
ENTRYPOINT ["/data/caddy/caddydash", "-c", "/data/caddy/config/config.toml"]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue