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
93 changes: 63 additions & 30 deletions .github/scripts/boot-check.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,28 @@ export function parseArgs(argv) {
}

/** Ambiente do exe: pasta de dados isolada e porta de depuração do WebView2. */
export function bootEnv(base, { dataDir, port, viaRegistry = false }) {
export function bootEnv(base, { dataDir, port }) {
const env = { ...base };
env.RAM_DATA_DIR = dataDir;
if (viaRegistry) {
// O WebView2 só lê o registro quando nenhuma variável WEBVIEW2_* existe (documentação do
// CreateCoreWebView2EnvironmentWithOptions): no caminho do registro, nenhuma vai.
for (const k of Object.keys(env)) if (k.toUpperCase().startsWith("WEBVIEW2_")) delete env[k];
} else {
env.WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS = `--remote-debugging-port=${port}`;
}
env.WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS = `--remote-debugging-port=${port}`;
return env;
}

/** A política por exe dos argumentos do WebView2 (HKCU), gravada (`on`) ou apagada. Só no runner do GitHub. */
const ARGS_POLICY_KEY = "HKCU:\\Software\\Policies\\Microsoft\\Edge\\WebView2\\AdditionalBrowserArguments";
export function registryArgsScript(exeName, port, on) {
const name = String(exeName).replace(/'/g, "");
return on
? `New-Item -Path "${ARGS_POLICY_KEY}" -Force | Out-Null; New-ItemProperty -Path "${ARGS_POLICY_KEY}" -Name '${name}' -Value '--remote-debugging-port=${Number(port)}' -PropertyType String -Force | Out-Null`
: `Remove-ItemProperty -Path "${ARGS_POLICY_KEY}" -Name '${name}' -ErrorAction SilentlyContinue`;
/**
* Prova de app vivo (29/11/2026), só para o runner do GitHub: lá o WebView2 ignora todo argumento vindo de fora e a
* porta de depuração nunca abre. Passa quando a janela aparece e o processo continua de pé com ela por `seconds`.
* `samples`: { at (s), alive, title }, em ordem.
*/
export function livenessVerdict(samples, seconds) {
const up = (x) => x.alive && typeof x.title === "string" && x.title.trim() !== "";
const first = samples.findIndex(up);
if (first < 0) return { ok: false, reason: "the window never showed up" };
const rest = samples.slice(first);
const broken = rest.find((x) => !up(x));
if (broken) return { ok: false, reason: broken.alive ? "the window went away" : "the app exited" };
const span = rest[rest.length - 1].at - rest[0].at;
if (span < seconds) return { ok: false, reason: `the window was up only ${span}s` };
return { ok: true, reason: `window up for ${seconds}s` };
}

/** A janela principal entre os alvos do CDP (as outras janelas têm `?view=`). */
Expand Down Expand Up @@ -198,15 +200,15 @@ function printDiagnostics(pid, port) {
for (const line of `${r.stdout ?? ""}`.split(/\r?\n/).filter(Boolean)) console.error(`boot-check: ${line}`);
}

export function spawnApp({ exe, port, dataDir, viaRegistry = false }) {
return spawn(exe, [], { env: bootEnv(process.env, { dataDir, port, viaRegistry }), stdio: "ignore", windowsHide: true });
export function spawnApp({ exe, port, dataDir }) {
return spawn(exe, [], { env: bootEnv(process.env, { dataDir, port }), stdio: "ignore", windowsHide: true });
}

/** `start` troca quem é aberto (os testes locais usam um navegador sem janela no lugar do app). */
export async function bootCheck({ exe, port, timeoutMs, settleMs, viaRegistry = false }, { log = console.log, start = spawnApp } = {}) {
export async function bootCheck({ exe, port, timeoutMs, settleMs }, { log = console.log, start = spawnApp } = {}) {
const dataDir = mkdtempSync(path.join(tmpdir(), "multialt-boot-"));
writeFileSync(path.join(dataDir, "RAMSettings.ini"), SEED_SETTINGS);
const child = start({ exe, port, dataDir, viaRegistry });
const child = start({ exe, port, dataDir });
let exitInfo;
child.on("exit", (code, signal) => (exitInfo = { code, signal }));
child.on("error", (e) => (exitInfo = { code: null, signal: String(e.message) }));
Expand All @@ -226,7 +228,7 @@ export async function bootCheck({ exe, port, timeoutMs, settleMs, viaRegistry =
if (exitInfo) return fail(`the app exited (code ${exitInfo.code}, ${exitInfo.signal ?? "no signal"}) before the WebView2 page came up (another instance already running?)`);
if (!page) {
printDiagnostics(child.pid, port);
fail(`no WebView2 page on port ${port} after ${timeoutMs / 1000}s${viaRegistry ? " (registry route)" : ""}`);
fail(`no WebView2 page on port ${port} after ${timeoutMs / 1000}s`);
return 2;
}
log(`boot-check: CDP page ${page.url}`);
Expand Down Expand Up @@ -269,21 +271,52 @@ export async function bootCheck({ exe, port, timeoutMs, settleMs, viaRegistry =
}
}

/** Abre o app com pasta de dados vazia e amostra a janela a cada 2 s (até 60 s para aparecer, depois `seconds`). */
export async function livenessCheck({ exe, port }, seconds = 30) {
const dataDir = mkdtempSync(path.join(tmpdir(), "multialt-alive-"));
writeFileSync(path.join(dataDir, "RAMSettings.ini"), SEED_SETTINGS);
const child = spawnApp({ exe, port, dataDir });
const t0 = Date.now();
const samples = [];
try {
let shownAt;
while (Date.now() - t0 < (60 + seconds + 5) * 1000) {
const r = spawnSync("powershell", ["-NoProfile", "-Command", `$p = Get-Process -Id ${Number(child.pid)} -ErrorAction SilentlyContinue; if ($p) { $p.MainWindowTitle } else { "<gone>" }`], { encoding: "utf8", windowsHide: true });
const out = `${r.stdout ?? ""}`.trim();
const sample = { at: Math.round((Date.now() - t0) / 1000), alive: out !== "<gone>", title: out === "<gone>" ? "" : out };
samples.push(sample);
if (!sample.alive) break;
if (sample.title && shownAt === undefined) shownAt = sample.at;
if (shownAt !== undefined && sample.at - shownAt >= seconds) break;
if (shownAt === undefined && sample.at >= 60) break;
await sleep(2000);
}
const v = livenessVerdict(samples, seconds);
if (v.ok) console.log(`boot-check: OK (app alive, no page check on this runner): ${v.reason}`);
else console.error(`boot-check: FAILED: ${v.reason}`);
return v.ok ? 0 : 1;
} finally {
killTree(child);
for (let i = 0; i < 10; i++) {
try {
rmSync(dataDir, { recursive: true, force: true });
break;
} catch {
await sleep(500);
}
}
}
}

if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) {
const opts = parseArgs(process.argv.slice(2));
bootCheck(opts)
.then(async (code) => {
// Sem página pela variável de ambiente: no runner do GitHub (descartável) tenta pela política do registro.
// Nunca na máquina de ninguém: a política valeria para o MultiAlt instalado.
// Sem página porque a porta não abriu: no runner do GitHub, e só lá, vale a prova de app vivo. No PC do dono a
// prova é sempre a da tela inteira (CLAUDE.md: a grátis só sai depois de o exe abrir neste PC).
if (code !== 2 || process.env.GITHUB_ACTIONS !== "true" || process.platform !== "win32") return code;
const exeName = path.basename(opts.exe);
console.error(`boot-check: trying again with the WebView2 arguments policy for ${exeName}`);
spawnSync("powershell", ["-NoProfile", "-Command", registryArgsScript(exeName, opts.port, true)], { stdio: "inherit", windowsHide: true });
try {
return await bootCheck({ ...opts, viaRegistry: true });
} finally {
spawnSync("powershell", ["-NoProfile", "-Command", registryArgsScript(exeName, opts.port, false)], { stdio: "inherit", windowsHide: true });
}
console.error("boot-check: the debugging port never opens on this runner; checking that the app stays up instead");
return livenessCheck(opts);
})
.then((code) => process.exit(code ? 1 : 0))
.catch((e) => {
Expand Down
26 changes: 10 additions & 16 deletions .github/scripts/boot-check.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
bootVerdict,
describeCdpEvent,
diagnosticsScript,
registryArgsScript,
livenessVerdict,
WEBVIEW2_CLIENT_KEY,
parseArgs,
pickMainPage,
Expand Down Expand Up @@ -46,21 +46,15 @@ describe("boot-check failure diagnostics", () => {
expect(script).toMatch(/app WebView2 flags/);
});

it("the registry route clears every WEBVIEW2_ variable, so WebView2 reads the registry", () => {
const env = bootEnv({ PATH: "x", WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS: "--a", WEBVIEW2_USER_DATA_FOLDER: "y" }, { dataDir: "d", port: 9333, viaRegistry: true });
expect(Object.keys(env).filter((k) => k.toUpperCase().startsWith("WEBVIEW2_"))).toEqual([]);
expect(env.RAM_DATA_DIR).toBe("d");
expect(env.PATH).toBe("x");
});

it("writes and removes the per-exe browser arguments policy", () => {
const set = registryArgsScript("roblox-account-manager.exe", 9333, true);
expect(set).toContain("Software\\Policies\\Microsoft\\Edge\\WebView2\\AdditionalBrowserArguments");
expect(set).toContain("roblox-account-manager.exe");
expect(set).toContain("--remote-debugging-port=9333");
const clear = registryArgsScript("roblox-account-manager.exe", 9333, false);
expect(clear).toContain("Remove-ItemProperty");
expect(clear).not.toContain("--remote-debugging-port");
// Quarta rodada (29/11/2026): no runner do GitHub o WebView2 ignora todo argumento vindo de fora (variável de
// ambiente, a que o próprio app define, registro): a porta nunca abre. Lá, e só lá, vale a prova de app vivo: a
// janela aparece e o processo fica de pé. A prova da tela inteira continua sendo a deste PC.
it("app alive: the window shows up and the process stays up for the whole window; anything else fails", () => {
const up = (t) => ({ at: t, alive: true, title: "MultiAlt" });
expect(livenessVerdict([up(0), up(10), up(20), up(30)], 30)).toEqual({ ok: true, reason: "window up for 30s" });
expect(livenessVerdict([up(0), up(10), { at: 20, alive: false, title: "" }], 30).ok).toBe(false);
expect(livenessVerdict([up(0), up(10), up(20)], 30).ok).toBe(false);
expect(livenessVerdict([{ at: 0, alive: true, title: "" }, { at: 30, alive: true, title: "" }], 30).ok).toBe(false);
});
});

Expand Down
3 changes: 2 additions & 1 deletion .github/scripts/release-draft.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export function pickDraft(releases, tag) {

/** Anexos que a release publicada precisa ter (nomes), na ordem em que o updater e o README os usam. */
export function requiredAssetNames({ version, publishPortable }) {
const names = ["MultiAlt-Setup.msi", `MultiAlt_${version}_Full-Setup.msi`, "MultiAlt-Full-Setup.msi"];
// Um arquivo por edição (29/11/2026): a completa deixou de subir a cópia com a versão no nome.
const names = ["MultiAlt-Setup.msi", "MultiAlt-Full-Setup.msi"];
if (publishPortable) names.push(`MultiAlt_${version}_x64_portable.exe`, `MultiAlt_${version}_x64_portable_full.exe`);
return names;
}
Expand Down
5 changes: 2 additions & 3 deletions .github/scripts/release-draft.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,9 @@ describe("downloads and file names", () => {
it("requiredAssetNames lists the portable files only with the switch on", () => {
expect(requiredAssetNames({ version: "3.0.1", publishPortable: false })).toEqual([
"MultiAlt-Setup.msi",
"MultiAlt_3.0.1_Full-Setup.msi",
"MultiAlt-Full-Setup.msi",
]);
expect(requiredAssetNames({ version: "3.0.1", publishPortable: true })).toHaveLength(5);
expect(requiredAssetNames({ version: "3.0.1", publishPortable: true })).toHaveLength(4);
});
});

Expand Down Expand Up @@ -188,7 +187,7 @@ describe("publishing", () => {

it("verify fails when an asset is missing or does not answer", async () => {
const names = requiredAssetNames({ version: "3.0.1", publishPortable: false });
const partial = fakeApi([published({ tag_name: TAG, assets: names.slice(0, 2).map((name, i) => ({ id: i, name })) })]);
const partial = fakeApi([published({ tag_name: TAG, assets: names.slice(0, -1).map((name, i) => ({ id: i, name })) })]);
await expect(verifyPublished(partial.client, { repository: "o/r", tag: TAG, version: "3.0.1", publishPortable: false }, { delayMs: 0 })).rejects.toThrow(/lacks/);

const dead = fakeApi([published({ tag_name: TAG, assets: names.map((name, i) => ({ id: i, name })) })]);
Expand Down
5 changes: 3 additions & 2 deletions .github/scripts/update-manifest-platforms.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const STABLE_MSI_NAME = "MultiAlt-Setup.msi";
* que o tauri-action sobe é byte a byte o `MultiAlt-Setup.msi` (o "en-US" é só o
* idioma da janela do instalador). A cópia com versão sai da release, então o
* updater baixa o de nome fixo da mesma tag; a assinatura é do conteúdo e vale
* igual. O MSI da edição completa (`MultiAlt_<v>_Full-Setup.msi`) é outro arquivo e fica.
* igual. O MSI da edição completa (`MultiAlt-Full-Setup.msi`, um arquivo só desde a 3.0.1) é outro arquivo e fica.
*/
export function toStableMsiUrl(url) {
return url.replace(/\/MultiAlt_[^/]*_x64_en-US\.msi$/, `/${STABLE_MSI_NAME}`);
Expand Down Expand Up @@ -127,7 +127,8 @@ export function buildEditionManifest({ base, repository, tag, release }) {
*/
export function rebuildBaseManifest({ edition, repository, tag, signature, publishedAt }) {
const core = tag.replace(/^v/, "").replace(/-.*$/, "");
const file = String(edition) === "full" ? `MultiAlt_${core}_Full-Setup.msi` : STABLE_MSI_NAME;
// A completa num arquivo só desde a 3.0.1 (29/11/2026), com nome fixo como a padrão.
const file = String(edition) === "full" ? "MultiAlt-Full-Setup.msi" : STABLE_MSI_NAME;
return {
version: core,
notes: "",
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/update-manifest-platforms.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,6 @@ describe("manifest for a release that was a draft", () => {
expect(std.platforms["windows-x86_64-msi"]).toEqual({ signature: "sig", url: `https://github.com/o/r/releases/download/${TAG}/MultiAlt-Setup.msi` });
expect(std.pub_date).toBe("2026-11-27T12:00:00Z");
const full = rebuildBaseManifest({ edition: "full", repository: "o/r", tag: TAG, signature: "f" });
expect(full.platforms["windows-x86_64-msi"].url).toBe(`https://github.com/o/r/releases/download/${TAG}/MultiAlt_3.0.1_Full-Setup.msi`);
expect(full.platforms["windows-x86_64-msi"].url).toBe(`https://github.com/o/r/releases/download/${TAG}/MultiAlt-Full-Setup.msi`);
});
});
30 changes: 11 additions & 19 deletions .github/workflows/release-v4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,19 @@ jobs:
$v = "${{ steps.meta.outputs.app_version }}"
$tag = $env:RELEASE_TAG
$baseUrl = "https://github.com/${{ github.repository }}/releases/download/$tag"
$fullMsiName = "MultiAlt_${v}_Full-Setup.msi"
# Um arquivo só (dono, 29/11/2026): o link do README e o manifesto do updater usam o mesmo nome fixo,
# como a padrão (MultiAlt-Setup.msi). A assinatura leva a versão, como a da padrão.
$fullMsiName = "MultiAlt-Full-Setup.msi"
$fullSigName = "MultiAlt_${v}_Full-Setup.msi.sig"

$msi = Get-ChildItem src-tauri/target/release/bundle/msi -Filter *.msi |
Sort-Object LastWriteTime -Descending | Select-Object -First 1
if (-not $msi) { throw "No MSI found after the full build" }
if (-not (Test-Path "$($msi.FullName).sig")) { throw "The full MSI was not signed" }
New-Item -ItemType Directory -Force release-assets | Out-Null
Copy-Item $msi.FullName "release-assets/$fullMsiName"
Copy-Item "$($msi.FullName).sig" "release-assets/$fullMsiName.sig"
$fullMsiSignature = (Get-Content "release-assets/$fullMsiName.sig" -Raw).Trim()
Copy-Item "$($msi.FullName).sig" "release-assets/$fullSigName"
$fullMsiSignature = (Get-Content "release-assets/$fullSigName" -Raw).Trim()

$standardPortableSrc = "release-assets/staging/standard-portable.exe"
$fullPortableSrc = Join-Path "src-tauri/target/release" "roblox-account-manager.exe"
Expand All @@ -348,26 +351,16 @@ jobs:
}
$fullManifest | ConvertTo-Json -Depth 8 | Set-Content release-assets/latest-full.json -Encoding utf8
"full_msi_name=$fullMsiName" >> $env:GITHUB_OUTPUT
"full_sig_name=$fullSigName" >> $env:GITHUB_OUTPUT

- name: Upload full edition installer
env:
GH_TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ steps.meta.outputs.tag }}
FULL_MSI_NAME: ${{ steps.full_assets.outputs.full_msi_name }}
FULL_SIG_NAME: ${{ steps.full_assets.outputs.full_sig_name }}
run: |
bun .github/scripts/release-draft.mjs upload "release-assets/$env:FULL_MSI_NAME" "release-assets/$env:FULL_MSI_NAME.sig"

# Mesmo arquivo da completa, com nome que não muda: o link do README
# (releases/latest/download/) não tem como citar o nome com a versão. O
# manifesto do updater segue apontando para o nome com a versão.
- name: Upload stable-named full MSI
env:
GH_TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ steps.meta.outputs.tag }}
FULL_MSI_NAME: ${{ steps.full_assets.outputs.full_msi_name }}
run: |
Copy-Item "release-assets/$env:FULL_MSI_NAME" release-assets/MultiAlt-Full-Setup.msi
bun .github/scripts/release-draft.mjs upload release-assets/MultiAlt-Full-Setup.msi
bun .github/scripts/release-draft.mjs upload "release-assets/$env:FULL_MSI_NAME" "release-assets/$env:FULL_SIG_NAME"

- name: Upload portable binaries
if: env.PUBLISH_PORTABLE == 'true'
Expand Down Expand Up @@ -427,8 +420,7 @@ jobs:
"<details>",
"<summary>Other files</summary>",
"",
`- \`MultiAlt_${version}_Full-Setup.msi\`: the full installer (below).`,
"- `MultiAlt-Full-Setup.msi`: the same file as the full installer, under a name that never changes.",
"- `MultiAlt-Full-Setup.msi`: the full installer (below).",
"- `zz-…sig`: signatures for the auto-updater. You don't need them.",
];
if (publishPortable) {
Expand All @@ -440,7 +432,7 @@ jobs:
"",
"### Full installer",
"",
`\`MultiAlt_${version}_Full-Setup.msi\` has every feature, including extra Windows integrations (window and audio control, local Web API, Nexus). It updates itself to the next full version. For everyday use, most people should use \`MultiAlt-Setup.msi\`.`,
`\`MultiAlt-Full-Setup.msi\` has every feature, including extra Windows integrations (window and audio control, local Web API, Nexus). It updates itself to the next full version. For everyday use, most people should use \`MultiAlt-Setup.msi\`.`,
];

const download = [
Expand Down
3 changes: 3 additions & 0 deletions src/components/dialogs/DiagnosticsDialog.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ describe("DiagnosticsDialog — the task list while it runs", () => {
});

it("stops the list on the running step when the check cannot run", async () => {
// Passo longo: com o PC ocupado, o de 30 ms avançava a lista antes de o erro chegar à tela,
// e o passo marcado era o segundo (29/11/2026). Aqui o erro tem que pegar o primeiro.
taskPacing.stepMs = 60_000;
setInvokeHandler(() => {
throw "boom";
});
Expand Down
12 changes: 6 additions & 6 deletions src/components/layout/RescueFileReminder.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState } from "react";
import { useState } from "react";
import { Info } from "lucide-react";
import { useTr } from "../../i18n/text";
import { useNewAccountsSaveState } from "../../hooks/useNewAccountsSaveState";
Expand All @@ -15,12 +15,12 @@ import { useNewAccountsSaveState } from "../../hooks/useNewAccountsSaveState";
export function RescueFileReminder() {
const t = useTr();
const state = useNewAccountsSaveState();
const [dismissed, setDismissed] = useState(false);
// Guarda QUAL arquivo foi dispensado (não um sim/não zerado por efeito): um arquivo novo volta a
// aparecer, e o clique em "Dismiss" não corre contra o efeito que zerava a escolha (29/11/2026).
const [dismissedFile, setDismissedFile] = useState<string | null>(null);
const rescueFile = state?.rescueFile ?? null;

useEffect(() => setDismissed(false), [rescueFile]);

if (!rescueFile || dismissed) return null;
if (!rescueFile || dismissedFile === rescueFile) return null;

return (
<div role="status" data-tone="info" className="app-banner">
Expand All @@ -33,7 +33,7 @@ export function RescueFileReminder() {
</span>
<span className="app-banner-detail">{t("Rescue file: {{path}}", { path: rescueFile })}</span>
</div>
<button type="button" className="app-banner-action self-start" onClick={() => setDismissed(true)}>
<button type="button" className="app-banner-action self-start" onClick={() => setDismissedFile(rescueFile)}>
{t("Dismiss")}
</button>
</div>
Expand Down
Loading
Loading