Files
caowangrenbo 947b1a1475 chore: 初始化 idsync 项目
飞书通讯录 ↔ LDAP 同步工具的首个提交。

- internal/feishu: 飞书通讯录客户端、快照与重试
- internal/ldaplib: LDAP 读写与批量操作
- internal/mapping: 飞书部门/用户到 LDAP 条目的映射
- internal/syncer: 同步计划生成、执行与调度
- internal/store: SQLite 台账
- internal/server + internal/webui: 管理后台与内嵌前端产物
- internal/password: SSHA 口令处理
- config.example.yml / Dockerfile / Makefile / web 前端源码

真实凭据(config.yml)、运行时数据(data/、backup/)与构建产物(bin/)不入库。
2026-09-29 00:10:59 +08:00

42 lines
1.5 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
# 构建 WebUI 资源,供 go:embed 使用。
#
# FlyonUI 的样式必须在构建期由 Tailwind 生成(官方不支持 CDN 方式),
# 因此这一步需要 Node。产物会提交进仓库,使用者无需 Node 环境。
set -e
HERE=$(cd "$(dirname "$0")/.." && pwd)
OUT="$HERE/internal/webui/dist"
PROXY="${PROXY:-http://127.0.0.1:10808}"
NODE_IMAGE="${NODE_IMAGE:-docker.io/library/node:20-alpine}"
# Tailwind 不会创建输出目录,必须先建好。
mkdir -p "$OUT"
if command -v npx >/dev/null 2>&1; then
echo "使用本机 Node 构建"
cd "$HERE/web"
[ -d node_modules ] || npm install --no-fund --no-audit
npx @tailwindcss/cli -i src/input.css -o "$OUT/app.css" --minify
else
echo "本机无 Node,改用容器构建($NODE_IMAGE)"
# 挂载整个项目根目录,使容器内的输出路径与宿主一致。
podman run --rm --pull=never --network=host \
-e http_proxy="$PROXY" -e https_proxy="$PROXY" \
-v "$HERE":/app -w /app/web "$NODE_IMAGE" \
sh -c '
set -e
[ -d node_modules ] || npm install --no-fund --no-audit >/dev/null 2>&1
npx @tailwindcss/cli -i src/input.css -o /app/internal/webui/dist/app.css --minify
'
fi
# 拷贝静态资源;FlyonUI 的 JS 提供 tabs / modal 等交互组件。
cp -f "$HERE/web/src/index.html" "$OUT/index.html"
cp -f "$HERE/web/src/app.js" "$OUT/app.js"
cp -f "$HERE/web/node_modules/flyonui/flyonui.js" "$OUT/flyonui.js"
echo "WebUI 资源已生成于 internal/webui/dist"
ls -la "$OUT"