feat: AgentCheckin v1.2.2 — fnOS 应用:TRAE/WorkBuddy/Qoder 三平台每日积分自动签到
- 原生 fnOS 应用(CGI 入口 + Python 守护进程),依赖 python312 运行时 - 三平台签到:TRAE 每日 200 积分、WorkBuddy 7 天循环、Qoder 每日 100 Credits - WorkBuddy 网页授权(OAuth 设备流)、TRAE icubeAuth 解密 Token、Qoder Cosy 设备头 - 多时段调度(默认 00:05/09:00/12:30/19:00)、启动补跑、幂等签到+回查确认 - 多平台 Webhook 通知(企业微信/钉钉/飞书/Bark/Server酱/PushPlus 自动识别) - Qoder 双站点 Token 隔离自动探测与修复 - 前端:仪表盘/账号管理/签到记录/设置四个页签,30s 轮询+变化检测+隐藏暂停 - 测试:34 后端 + 25 E2E + 9 前端回归 + 真实时钟调度测试
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
# Initialize the AgentCheckin data directory and default settings.
|
||||
DATA_DIR="${TRIM_PKGVAR:-}"
|
||||
if [ -n "$DATA_DIR" ] && [ -d "$DATA_DIR" ]; then
|
||||
mkdir -p "${DATA_DIR}/logs"
|
||||
[ -f "${DATA_DIR}/accounts.json" ] || printf '{"accounts":[]}\n' > "${DATA_DIR}/accounts.json"
|
||||
[ -f "${DATA_DIR}/settings.json" ] || printf '{"schedule_times":["00:05","09:00","12:30","19:00"],"webhook_url":"","notify_on":["fail"]}\n' > "${DATA_DIR}/settings.json"
|
||||
[ -f "${DATA_DIR}/state.json" ] || printf '{}\n' > "${DATA_DIR}/state.json"
|
||||
chmod 600 "${DATA_DIR}/accounts.json" "${DATA_DIR}/settings.json" 2>/dev/null
|
||||
fi
|
||||
exit 0
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,99 @@
|
||||
#!/bin/bash
|
||||
# AgentCheckin service control.
|
||||
# The scheduler daemon runs as a detached background process and manages its
|
||||
# own pidfile in the persistent data dir (/vol{n}/@appdata/AgentCheckin).
|
||||
|
||||
PYBIN=""
|
||||
for candidate in \
|
||||
/var/apps/python312/target/bin/python3 \
|
||||
/vol1/@appcenter/python312/target/bin/python3 \
|
||||
/var/apps/python311/target/bin/python3 \
|
||||
/var/apps/python310/target/bin/python3 \
|
||||
/usr/bin/python3 \
|
||||
/usr/local/bin/python3; do
|
||||
if [ -x "$candidate" ]; then PYBIN="$candidate"; break; fi
|
||||
done
|
||||
|
||||
APPDEST="${TRIM_APPDEST:-$(cd "$(dirname "$0")/.." && pwd)}"
|
||||
BACKEND_DIR="${APPDEST}/target/backend"
|
||||
if [ ! -d "$BACKEND_DIR" ]; then
|
||||
BACKEND_DIR="${APPDEST}/backend"
|
||||
fi
|
||||
DAEMON="${BACKEND_DIR}/daemon.py"
|
||||
|
||||
# Resolve the persistent data dir (mirrors backend/common.py).
|
||||
if [ -n "${TRIM_PKGVAR}" ] && [ -d "${TRIM_PKGVAR}" ]; then
|
||||
DATA_DIR="${TRIM_PKGVAR}"
|
||||
else
|
||||
DATA_DIR=""
|
||||
for candidate in \
|
||||
"${APPDEST}/../../@appdata/AgentCheckin" \
|
||||
"${APPDEST}/var" \
|
||||
"/var/apps/AgentCheckin/var" \
|
||||
"/vol1/@appdata/AgentCheckin" \
|
||||
"/vol2/@appdata/AgentCheckin"; do
|
||||
if [ -d "$candidate" ]; then DATA_DIR="$candidate"; break; fi
|
||||
done
|
||||
if [ -z "$DATA_DIR" ]; then
|
||||
DATA_DIR="${APPDEST}/../../@appdata/AgentCheckin"
|
||||
fi
|
||||
fi
|
||||
PIDFILE="${DATA_DIR}/daemon.pid"
|
||||
|
||||
daemon_alive() {
|
||||
[ -f "$PIDFILE" ] || return 1
|
||||
local pid
|
||||
pid="$(cat "$PIDFILE" 2>/dev/null)"
|
||||
[ -n "$pid" ] || return 1
|
||||
kill -0 "$pid" 2>/dev/null
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if daemon_alive; then
|
||||
echo "AgentCheckin daemon already running (pid $(cat "$PIDFILE"))"
|
||||
exit 0
|
||||
fi
|
||||
if [ -z "$PYBIN" ]; then
|
||||
echo "python3 runtime not found (install_dep_apps=python312)" > "${TRIM_TEMP_LOGFILE:-/dev/stderr}"
|
||||
exit 1
|
||||
fi
|
||||
mkdir -p "$DATA_DIR"
|
||||
AGENTCHECKIN_DATA_DIR="$DATA_DIR" setsid nohup "$PYBIN" "$DAEMON" >> "${DATA_DIR}/daemon.out" 2>&1 &
|
||||
# wait for the daemon to write its pidfile (max ~5s)
|
||||
for _ in 1 2 3 4 5 6 7 8 9 10; do
|
||||
if daemon_alive; then
|
||||
echo "AgentCheckin daemon started (pid $(cat "$PIDFILE"))"
|
||||
exit 0
|
||||
fi
|
||||
sleep 0.5
|
||||
done
|
||||
echo "AgentCheckin daemon failed to start; see ${DATA_DIR}/daemon.out" > "${TRIM_TEMP_LOGFILE:-/dev/stderr}"
|
||||
exit 1
|
||||
;;
|
||||
stop)
|
||||
if daemon_alive; then
|
||||
pid="$(cat "$PIDFILE")"
|
||||
kill "$pid" 2>/dev/null
|
||||
for _ in 1 2 3 4 5 6 7 8 9 10; do
|
||||
kill -0 "$pid" 2>/dev/null || break
|
||||
sleep 0.5
|
||||
done
|
||||
kill -9 "$pid" 2>/dev/null
|
||||
echo "AgentCheckin daemon stopped (pid $pid)"
|
||||
else
|
||||
echo "AgentCheckin daemon not running"
|
||||
fi
|
||||
rm -f "$PIDFILE"
|
||||
exit 0
|
||||
;;
|
||||
status)
|
||||
if daemon_alive; then
|
||||
exit 0
|
||||
fi
|
||||
exit 3
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
# Stop the daemon before uninstall (best effort).
|
||||
DATA_DIR="${TRIM_PKGVAR:-}"
|
||||
if [ -n "$DATA_DIR" ] && [ -f "${DATA_DIR}/daemon.pid" ]; then
|
||||
pid="$(cat "${DATA_DIR}/daemon.pid" 2>/dev/null)"
|
||||
[ -n "$pid" ] && kill "$pid" 2>/dev/null
|
||||
rm -f "${DATA_DIR}/daemon.pid"
|
||||
fi
|
||||
exit 0
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user