Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# - PR 标题「Release vX.Y.Z」即版本号;用 merge commit 合入 release,
# 合并关闭 PR 时触发:
# meta 从标题提取版本号;严格 X.Y.Z 为正式版,带 -后缀 视为预发布
# sync-main 与 release 并行:把合并提交合回 main(能快进就快进)
# release 在合并提交上:冒烟 → 打包 → 把版号写进包内 version.json →
# zip 命名 MAA-PRTS-vX.Y.Z-win-<架构>.zip →
# changelog 取上一个 tag 以来的全部 commits → 发布 Release,
Expand Down Expand Up @@ -62,6 +63,38 @@ jobs:
echo "prerelease=true" | tee -a $GITHUB_OUTPUT
fi

# Release PR 合入即把 release 的合并提交合回 main(抄 MAA pr-auto-tag.yml),
# 只依赖 meta、与构建发布并行:合并提交在 PR 合入时就已落在 release 上,
# 同步不该被构建/发布/Mirror 酱的失败卡住。main 没动过则快进,两边指向
# 同一个合并提交;动过则在 main 上生成一个 merge 节点。这样 tag 从 main
# 也可达,main 也不再显示「落后 release」。
# main 的 ruleset 禁止直接推送,这里用写权限 deploy key(secret
# MAIN_SYNC_DEPLOY_KEY)推送,两个 main ruleset 的 bypass 里都放了 Deploy keys
sync-main:
name: 合回 main
needs: meta
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout main
uses: actions/checkout@v7
with:
ref: main
fetch-depth: 0
ssh-key: ${{ secrets.MAIN_SYNC_DEPLOY_KEY }}
show-progress: false

- name: Merge release into main and push
env:
TAG: ${{ needs.meta.outputs.tag }}
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git fetch origin "$MERGE_SHA"
git merge --no-edit -m "Merge release $TAG into main" "$MERGE_SHA"
git push origin HEAD:main

release:
name: 构建并发布(Windows)
needs: meta
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ MAA-PRTS\
| 抽卡统计 | 「抽卡统计」模块:总抽数、六星数/出率、平均出六星、距上次六星,按卡池分开列(每池挂出自己的六星与第几抽)、星级分布、最近记录;终末地分「角色寻访 / 武器申领」两个 tab(两套保底不能混算)。记录只增不减地存在本地,没网也能看 |
| 终末地抽卡 | 角色寻访(5 类池子全翻页)+ 武器申领分开统计:角色看抽数/六星/出率/保底,武器单独两张卡;记录接口只给最近一段窗口,本地只增不减,滑走的旧记录不会丢 |
| 森空岛签到 | 「森空岛签到」模块:左「全局签到」一键签列表里所有账号(明日方舟 + 终末地),右「单号签到」只签当前账号;两边各一块日志,跑完给「成功 / 已签到 / 失败 / 跳过」汇总。先查状态再签,今天签过的直接说已签到,不会重复打接口 |
| 卫戍协议 | 「卫戍协议」模块:策略刻章速刷(极速模拟自动打满 31 个策略目标)。连接参数从当前账号绑定的 MAA 配置里抄(MuMu 自动用快速截图 Extras、雷电→ldplayer、PC 官方客户端→pc;默认极速 / 1.5× / 3 胜),每个账号一个独立速刷后端、自己的检查点,可多账号同时跑。核心包(约 61MB)不随本程序分发:首次打开该页自动从小黑盒官方 CDN 下载并逐文件校验(装过小黑盒的用本机记录拿最新版),断点续传;另需 Node.js 20+ |
| 卫戍协议 | 「卫戍协议」模块:策略刻章速刷(极速模拟自动打满 31 个策略目标;也可选标准模拟·规程等级 1 刷极速未开放的策略,叠层任务可选规程等级 1/5/12)。连接参数从当前账号绑定的 MAA 配置里抄(MuMu 自动用快速截图 Extras、雷电→ldplayer、PC 官方客户端→pc;默认极速 / 3 胜),每个账号一个独立速刷后端、自己的检查点,可多账号同时跑。核心包(约 61MB)不随本程序分发:首次打开该页自动从小黑盒官方 CDN 下载并逐文件校验(装过小黑盒的用本机记录拿最新版),断点续传;另需 Node.js 20+ |
| 练度统计 | 干员数 / 精二 / 满级 / 六星 / 专三 / 模组 / 潜能 / 信赖 |
| 缺卡清单 | 点顶部「缺卡」,按星级列出还没有的干员名字 |
| 作业匹配 | 输入关卡代号(`TL-10`)、章节号(`2` 返回整章:主线 + S 支线 + TR 教学)、活动(`act55side`)、系列(`TR-`)或中文名,逐份比对干员与练度 |
Expand Down
33 changes: 25 additions & 8 deletions backend/core/garrison.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ def _maa_dir_for(file: str) -> str:
def _maa_defaults(file: str):
"""从账号绑定 MAA 的连接配置里抄出来的裸默认值(不含用户偏好 overlay)"""
opts = {
'device': 'mumu', 'mode': 'quick', 'goal': 'medal', 'speed': 1.5, 'medalWins': 3,
'device': 'mumu', 'mode': 'quick', 'goal': 'medal', 'level': 1,
'medalWins': 3,
'adbAddress': '127.0.0.1:16384', 'adbPath': '',
'screenshotMethod': 'auto', 'pcUiScale': 90,
}
Expand Down Expand Up @@ -228,7 +229,7 @@ def _maa_defaults(file: str):


# 可持久化的速刷选项键(账号 json 里的 garrisonOpts 只认这些)
OPT_KEYS = ('device', 'mode', 'goal', 'adbAddress', 'adbPath', 'medalWins', 'speed',
OPT_KEYS = ('device', 'mode', 'goal', 'level', 'adbAddress', 'adbPath', 'medalWins',
'screenshotMethod', 'pcUiScale')


Expand Down Expand Up @@ -280,20 +281,36 @@ def save_opts(file: str, options: dict) -> dict:


def sanitize(body: dict) -> dict:
"""前端提交的选项清洗:只放行核心认识的枚举与范围,其余回默认"""
"""前端提交的选项清洗:只放行核心认识的枚举与范围,其余回默认

模拟模式自 v1.1.10 起分两套口径:策略徽章看 medalMode(极速,或标准模拟·
规程等级 1),叠层任务看 mode+level(极速,或标准模拟·规程等级 1/5/12)。
阿戈尔/卡西米尔/突袭(task-2)没有极速与等级 1 入口,统一落到标准·等级 5。
前端只提交 mode + level,归一化后由 host.mjs 分别透传为 medalMode/level。
"""
body = body or {}
dft, _src = defaults('') # 兜底基底(读不到 MAA 配置时的那套)
device = body.get('device') if body.get('device') in DEVICES else dft['device']
goal = body.get('goal') if body.get('goal') in GOALS else 'medal'
mode = body.get('mode') if body.get('mode') in ('quick', 'standard') else 'quick'
try:
speed = min(5.0, max(0.5, float(body.get('speed') or 1.5)))
level = int(body.get('level'))
except (TypeError, ValueError):
speed = 1.5
level = 1
if goal == 'medal':
level = 1 # 策略徽章的标准模拟固定规程等级 1
elif goal == 'task-2':
if level not in (5, 12):
level = 5
mode = 'standard' # 这组盟约只有等级 5/12,没有极速/等级 1
elif level not in (1, 5, 12):
level = 1
return {
'device': device,
'mode': body.get('mode') if body.get('mode') in ('quick', 'standard') else 'quick',
'goal': body.get('goal') if body.get('goal') in GOALS else 'medal',
'mode': mode,
'goal': goal,
'level': level,
'medalWins': 6 if str(body.get('medalWins')) == '6' else 3,
'speed': speed,
'adbAddress': str(body.get('adbAddress') or dft['adbAddress']).strip() or dft['adbAddress'],
'adbPath': str(body.get('adbPath') or '').strip(),
'screenshotMethod': (body.get('screenshotMethod')
Expand Down
15 changes: 13 additions & 2 deletions backend/core/garrisondl.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
%APPDATA%\\HeyboxDesktop\\desktop\\extension-artifacts\\v1\\records\\*.catalog.json
里 package_id == ai-desktop.arknights-medal-farm 的记录(多条取版本最大),
带 target.cdn_url(官方 CDN 直链,匿名可下)与 integrity.files 逐文件清单。
2. 回退:硬编码的 v1.1.4 已验证直链(整包 sha256 已锚定;无逐文件清单时
退化为 zip 可解压 + core/service.mjs 存在 + 体量下限)。
2. 回退:硬编码的已验证直链(1.1.11 / 1.1.7 / 1.1.5 / 1.1.4,整包 sha256
已锚定;无逐文件清单时退化为 zip 可解压 + core/service.mjs 存在 + 体量下限)。

落盘到 ``<运行根>/garrison/medal-farm-v<版本>/``(garrison.core_dir 的约定
位置之一,装好即被发现)。下载在后台线程跑,进度/阶段记在模块级 _DL,
Expand Down Expand Up @@ -39,6 +39,17 @@
# 已验证直链(匿名可下载,整包 sha256 锚定):按版本降序作回退链——
# 记录里的新版不在适配表时,装「表内最新」的直链版本而不是一味落到最老。
FALLBACKS = [
{
'version': '1.1.11',
'url': ('https://static.max-c.com/heybox/desktop/extension/'
'ai-desktop.arknights-medal-farm/version/1.1.11/'
'f87f56c2110138158f44fce014dff979b36d26e206baf99b004e3e0953988fe1-'
'20261124T111647922Z/ai-desktop.arknights-medal-farm-1.1.11.hbext'),
'sha256': 'f87f56c2110138158f44fce014dff979b36d26e206baf99b004e3e0953988fe1',
'bytes': 61131567,
'files': None,
'source': '官方直链(回退)',
},
{
'version': '1.1.7',
'url': ('https://static.max-c.com/heybox/desktop/extension/'
Expand Down
5 changes: 5 additions & 0 deletions docs/frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,11 @@ webm、fixed 右下、`pointer-events: none`、`object-position: bottom right`
`pet.every` 秒换一个动作播一遍,`onended` 回到待机。窄屏和
`prefers-reduced-motion` 下直接不显示。

**点一下也播(2026-11-26)**:点击和定时共用 `playPetAction()`,连点就重播
(每次重新随机);`play()` 起不来(素材坏 / 编码不支持)也回待机,不会停在
动作最后一帧。容器 `#theme-pet` 仍然 `pointer-events: none`,只给
`#theme-pet.on video` 放开点击——整块放开会把右下角那一片右栏按钮拦住。

## 助手页两栏与 markdown(2026-11-17)

`#mod-chat` 分两栏:`.chat-main`(左,聊天占大头)+ `.chat-side`(右 300px,执行日志)。
Expand Down
103 changes: 85 additions & 18 deletions frontend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2700,12 +2700,31 @@ function petEnabled() {
try { return localStorage.getItem('maaprts.pet') !== '0'; } catch (e) { return true; }
}

/* 播一次随机动作,播完回待机。定时触发和点击触发共用这一份——两处各写
一遍的话,「播完回待机」「播不起来也要回待机」这些分支迟早走岔。
连点就重播:每次重新随机,比"动作没播完就不理你"更像在戳它。 */
function playPetAction(acts, base, idle) {
const v = document.getElementById('theme-pet-v');
if (!v || !acts.length) return;
const back = () => {
v.onended = null;
v.loop = true;
v.src = base + idle;
v.play().catch(() => { });
};
v.onended = back;
v.loop = false;
v.src = base + acts[Math.floor(Math.random() * acts.length)];
// 素材坏了 / 解码不支持时 play() 会 reject,别停在动作的最后一帧
v.play().catch(back);
}

function syncThemePet(id) {
let el = document.getElementById('theme-pet');
const info = id && !THEME_FIXED[id] ? themeInstalled[id] : null;
const pet = info && info.pet;
if (!pet || !pet.video || !petEnabled()) {
if (el) { el.classList.remove('on'); el.innerHTML = ''; }
if (el) { el.classList.remove('on'); el.innerHTML = ''; el.onclick = null; }
stopPetLoop();
return;
}
Expand All @@ -2721,20 +2740,13 @@ function syncThemePet(id) {
el.classList.toggle('float', pet.float !== false);
stopPetLoop();
const acts = Object.values(pet.actions || {}).filter(Boolean);
// 点桌宠立刻播一个随机动作。容器仍然不拦界面点击,只有视频这一块接
// 事件,见 themes.css 的 #theme-pet.on video。
el.onclick = acts.length ? () => playPetAction(acts, base, pet.video) : null;
if (!acts.length || !(pet.every > 0)) return;
_petTimer = setInterval(() => {
const v = document.getElementById('theme-pet-v');
if (!v || document.hidden) return;
const pick = acts[Math.floor(Math.random() * acts.length)];
v.onended = () => {
v.onended = null;
v.loop = true;
v.src = base + pet.video;
v.play().catch(() => { });
};
v.loop = false;
v.src = base + pick;
v.play().catch(() => { });
if (document.hidden) return;
playPetAction(acts, base, pet.video);
}, Math.max(8000, Number(pet.every) * 1000));
}

Expand Down Expand Up @@ -5261,26 +5273,73 @@ function garCurrentOpts() {
return S.garOpts[S.current] || (d ? { ...d } : null);
}

/* 模拟模式下拉:选项随速刷目标变。上游 v1.1.10 起策略徽章 = 极速 / 标准·规程
等级 1(只刷极速未开放的策略);叠层任务 = 极速 / 标准·规程 1/5/12(杰西卡),
阿戈尔/卡西米尔/突袭(task-2)只有等级 5/12。值编码成 quick / standard-N,
提交时再拆成 mode + level。 */
const GAR_LEVELS = [1, 5, 12];

function garModeChoices(goal) {
const task = !!goal && goal !== 'medal';
const list = [
{ value: 'quick', label: '极速模拟 · 9 回合' },
{ value: 'standard-1', label: '标准模拟 · 规程等级 1' + (task ? ' · 杰西卡' : '') },
];
if (task) {
for (const n of [5, 12]) {
list.push({ value: `standard-${n}`, label: `标准模拟 · 规程等级 ${n} · 杰西卡` });
}
}
if (goal === 'task-2') { // 这组盟约没有极速 / 等级 1 入口(上游同款)
list[0].disabled = true;
list[1].disabled = true;
}
return list;
}

/* 目标切换后把当前选择落到新目标可用的值上(无效时回退,与核心归一化一致) */
function garModeWant(goal, mode, level) {
const want = mode === 'standard'
? `standard-${GAR_LEVELS.includes(Number(level)) ? Number(level) : 1}`
: 'quick';
const list = garModeChoices(goal);
if (list.some(c => c.value === want && !c.disabled)) return want;
if (goal === 'task-2') return 'standard-5';
return mode === 'standard' ? 'standard-1' : 'quick';
}

function paintGarMode(goal, mode, level) {
const sel = $('#gar-mode');
if (!sel) return;
sel.innerHTML = garModeChoices(goal).map(c =>
`<option value="${c.value}"${c.disabled ? ' disabled' : ''}>${esc(c.label)}</option>`).join('');
sel.value = garModeWant(goal, mode, level);
const wins = $('#gar-wins-row'); // 目标胜场只对策略徽章有意义
if (wins) wins.style.display = goal === 'medal' ? '' : 'none';
}

/* 把选项描进表单:用户改过用改过的,否则用后端从 MAA 抄的默认值 */
function paintGarInputs() {
const o = garCurrentOpts();
if (!o) return;
const set = (id, v) => { const el = $(id); if (el && v !== undefined && v !== null) el.value = String(v); };
set('#gar-device', o.device);
set('#gar-mode', 'quick'); // 上游 v1.1.7 起仅支持极速
set('#gar-goal', o.goal);
paintGarMode(o.goal, o.mode, o.level);
set('#gar-adb', o.adbAddress);
set('#gar-wins', o.medalWins);
set('#gar-speed', o.speed);
set('#gar-scale', o.pcUiScale);
set('#gar-shot', o.screenshotMethod);
}

function collectGarOpts() {
const v = id => $(id) ? $(id).value : '';
const m = /^standard-(\d+)$/.exec(v('#gar-mode'));
const o = {
device: v('#gar-device'), mode: v('#gar-mode'), goal: v('#gar-goal'), adbAddress: v('#gar-adb').trim(),
medalWins: Number(v('#gar-wins')) || 3, speed: Number(v('#gar-speed')) || 1.5,
device: v('#gar-device'), goal: v('#gar-goal'),
mode: m ? 'standard' : 'quick', level: m ? Number(m[1]) : 1,
adbAddress: v('#gar-adb').trim(),
medalWins: Number(v('#gar-wins')) || 3,
pcUiScale: Number(v('#gar-scale')) || 90, screenshotMethod: v('#gar-shot'),
};
S.garOpts[S.current] = o; // 会话内缓存:切号再回来还在
Expand Down Expand Up @@ -5350,7 +5409,7 @@ function paintGarState(d) {
if (bs) bs.disabled = busy;
if (br) br.disabled = busy || !d.hasCheckpoint;
if (bp) bp.disabled = !busy;
['#gar-device', '#gar-mode', '#gar-adb', '#gar-wins', '#gar-speed', '#gar-scale', '#gar-shot']
['#gar-device', '#gar-mode', '#gar-goal', '#gar-adb', '#gar-wins', '#gar-scale', '#gar-shot']
.forEach(id => { const el = $(id); if (el) el.disabled = busy; });
// 来源标注:让用户知道这份默认值是从哪个 MAA 配置抄的
const src = $('#gar-src');
Expand Down Expand Up @@ -5856,6 +5915,14 @@ function bindGlobal() {
$('#gar-start').addEventListener('click', () => garAction('start'));
$('#gar-resume').addEventListener('click', () => garAction('resume'));
$('#gar-stop').addEventListener('click', () => garAction('stop'));
// 速刷目标变了先重铺模拟模式选项(旧选择在新目标下不可用时回退),
// 再由 .gar-form 的 change 冒泡统一收集保存
const garGoal = $('#gar-goal');
if (garGoal) garGoal.addEventListener('change', () => {
const cur = $('#gar-mode') ? $('#gar-mode').value : 'quick';
const m = /^standard-(\d+)$/.exec(cur);
paintGarMode(garGoal.value, m ? 'standard' : 'quick', m ? Number(m[1]) : 1);
});
const garForm = $('.gar-form');
if (garForm) garForm.addEventListener('change', collectGarOpts);
$('#btn-add-account').addEventListener('click', openAddAccount);
Expand Down
Loading