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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ What's new in ps5upload, written for humans.

## Unreleased

**Files on a phone**
- **Name and path fields get the full width (#936).** New folder, New file, Rename, Download from a link and Go to path no longer squeeze the text box: on a phone the field takes the width of the card and its buttons sit on their own line, so you can see what you type and the buttons never break mid-word. Tablets and computers look as before.

**Convert**
- **A running build is found again even if the page closed within seconds of starting it (#954).** The link to the build is saved at once instead of with the next progress update.

## 12.6.34

**Payloads**
- **Your own payload sources are back.** In Payloads, add a GitHub, Gitea or Forgejo project that publishes payload files, and pick the file once (for example `kstuff.elf`). Its card shows the release you have, says when a newer one is out, and has Download, Update and Send to PS5. Nothing happens on its own: it checks only when you open Payloads or press Check, downloads only when you press Download, and before sending shows the file, its release, size and checksum. Only add projects you trust. The built-in list stays a guide with links.

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.6.33
12.6.34
186 changes: 186 additions & 0 deletions client/e2e/files-phone-name-editor.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
import { expect, test, type Locator, type Page } from "@playwright/test";

import { routeEngine, seedConsole } from "./fixtures/engine";

// #936: on a phone, Files' New folder, Rename, Go to path and Download from a link put their
// field on a line of its own across the screen, with the buttons under it, each on one line. In
// one row the name box was a few pixels wide and "Create" / "Cancel" broke mid-word. Also in a
// wide font and in German and Russian. Enter does it, Back closes it. A computer keeps its row.

const WIDE_FONT = "*{font-family:Verdana,'DejaVu Sans',sans-serif!important}";
const PHONE_UA =
"Mozilla/5.0 (Linux; Android 15; Pixel 9) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Mobile Safari/537.36";
const FILE = "notes.txt";
const TYPED = "My new folder for the games";
/** Screenshots go here when set (a folder of the one running the suite). */
const SHOTS = process.env.PS5UPLOAD_E2E_SHOTS;

const NEW_FOLDER: Record<string, string> = { en: "New folder", de: "Neuer Ordner", ru: "Новая папка" };
const LINK: Record<string, string> = {
en: "Download from a link",
de: "Von einem Link herunterladen",
ru: "Скачать по ссылке",
};

async function open(page: Page, lang: string, mkdirs: string[] = []) {
await seedConsole(page);
await page.addInitScript((lang) => {
window.localStorage.setItem("ps5upload.lang", lang);
window.localStorage.setItem("ps5upload.fs.lastPath", JSON.stringify({ "192.168.1.100": "/mnt/usb0" }));
}, lang);
await routeEngine(page, (path, req) => {
if (path === "/api/version") return { version: "12.6.34", caps: {} };
if (path === "/api/ps5/status")
return { ok: true, version: "12.6.34", ucred_elevated: true, ps5_kernel: "releases/10.00", instance_id: 1, command_count: 1 };
if (path === "/api/ps5/volumes")
return {
volumes: [{ path: "/mnt/usb0", fs_type: "exfatfs", total_bytes: 1e12, free_bytes: 5e11, writable: true }],
};
if (path === "/api/ps5/list-dir")
return { entries: [{ name: FILE, kind: "file", size: 2048, mtime: 1_761_800_000 }], truncated: false };
if (path === "/api/ps5/files/prefs") return { supported: true, favorites: [], recent: [], last: null };
if (path === "/api/ps5/fs/mkdir") mkdirs.push((req.postDataJSON() as { path: string }).path);
return undefined;
});
await page.goto("/files", { waitUntil: "domcontentloaded" });
return page.getByRole("main");
}

/** Lines each button's label takes (1 = whole on one line). */
async function labelLines(buttons: Locator): Promise<Record<string, number>> {
return buttons.evaluateAll((els) =>
Object.fromEntries(
els.map((b) => {
const r = document.createRange();
r.selectNodeContents(b);
const tops = new Set(Array.from(r.getClientRects()).map((c) => Math.round(c.top)));
return [(b.textContent ?? "").trim(), tops.size];
}),
),
);
}

/** The field is most of the screen's width and what was typed shows. */
async function expectWideField(field: Locator, width: number, min = 0.7) {
const box = (await field.boundingBox())!;
expect(box.width, "field width").toBeGreaterThanOrEqual(width * min);
expect(box.x).toBeGreaterThanOrEqual(0);
expect(box.x + box.width).toBeLessThanOrEqual(width + 0.5);
await expect(field).toBeInViewport({ ratio: 1 });
// Where the typing is shows: the whole value, or (a long link in a wide font) its end.
const endShows = await field.evaluate(
(el: HTMLInputElement) => el.scrollLeft + el.clientWidth >= el.scrollWidth - 1,
);
expect(endShows, "the end of what was typed shows").toBe(true);
}

async function shot(page: Page, name: string) {
if (SHOTS) await page.screenshot({ path: `${SHOTS}/${name}.png` });
}

for (const viewport of [
{ width: 360, height: 800 },
{ width: 390, height: 844 },
{ width: 844, height: 390 },
]) {
test.describe(`phone ${viewport.width}x${viewport.height}`, () => {
test.use({ viewport, hasTouch: true, isMobile: true, userAgent: PHONE_UA });

for (const [lang, wide] of [["en", false], ["de", false], ["de", true], ["ru", true]] as const) {
const tag = `${viewport.width}x${viewport.height}-${lang}${wide ? "-wide" : ""}`;

test(`New folder: a full-width name, buttons whole, Enter makes it, Back closes it (${lang}${wide ? ", wide font" : ""})`, async ({
page,
}) => {
const mkdirs: string[] = [];
const main = await open(page, lang, mkdirs);
if (wide) await page.addStyleTag({ content: WIDE_FONT });
await main.getByTestId("fs-phone-more").click({ timeout: 60_000 });
await page.getByRole("menuitem", { name: NEW_FOLDER[lang], exact: true }).click();
const card = main.getByTestId("fs-mkdir");
const field = card.getByTestId("fs-mkdir-name");
await expect(field).toBeFocused();
await field.fill(lang === "en" ? TYPED : "Neuer Ordner für die Spiele");
// Narrower in landscape: the card shares the width with nothing, but a 844 px screen is wide.
await expectWideField(field, viewport.width, viewport.width > 600 ? 0.6 : 0.7);
const lines = await labelLines(card.getByRole("button"));
for (const [label, n] of Object.entries(lines)) expect(n, label).toBe(1);
// Under the field, not beside it.
const fieldBox = (await field.boundingBox())!;
for (const b of await card.getByRole("button").all())
expect((await b.boundingBox())!.y).toBeGreaterThan(fieldBox.y + fieldBox.height - 1);
await shot(page, `mkdir-${tag}`);

await page.goBack();
await expect(card).toHaveCount(0);
expect(new URL(page.url()).pathname).toBe("/files");

await main.getByTestId("fs-phone-more").click();
await page.getByRole("menuitem", { name: NEW_FOLDER[lang], exact: true }).click();
await card.getByTestId("fs-mkdir-name").fill("games");
await card.getByTestId("fs-mkdir-name").press("Enter");
await expect.poll(() => mkdirs).toEqual(["/mnt/usb0/games"]);
});

test(`Rename, Go to path and Download from a link: a wide field (${lang}${wide ? ", wide font" : ""})`, async ({
page,
}) => {
const main = await open(page, lang);
if (wide) await page.addStyleTag({ content: WIDE_FONT });

// Rename, from the row's ⋮.
await main.getByTestId("fs-row-end").getByRole("button").first().click({ timeout: 60_000 });
await page.getByRole("menuitem").first().click();
const rename = main.getByTestId("fs-rename-input");
await expect(rename).toBeFocused();
await rename.fill("notes from the console.txt");
await expectWideField(rename, viewport.width, 0.6);
await shot(page, `rename-${tag}`);
await page.goBack();
await expect(rename).toHaveCount(0);

// Go to path: the pencil in the path row.
await main.getByTestId("fs-path-edit").click();
const pathField = main.getByTestId("fs-path-input");
await expect(pathField).toBeFocused();
await pathField.fill("/mnt/usb0/homebrew");
await expectWideField(pathField, viewport.width, 0.6);
await shot(page, `path-${tag}`);
await page.goBack();
await expect(pathField).toHaveCount(0);

// Download from a link, from the page's ⋮.
await main.getByTestId("fs-phone-more").click();
await page.getByRole("menuitem", { name: LINK[lang], exact: true }).click();
const card = main.getByTestId("fs-link-download");
const url = card.getByTestId("fs-link-url");
await expect(url).toBeFocused();
await url.fill("https://example.com/game.pkg");
await expectWideField(url, viewport.width, viewport.width > 600 ? 0.6 : 0.7);
const lines = await labelLines(card.getByRole("button"));
for (const [label, n] of Object.entries(lines)) expect(n, label).toBe(1);
await shot(page, `link-${tag}`);
await page.goBack();
await expect(card).toHaveCount(0);
});
}
});
}

test.describe("desktop width", () => {
test.use({ viewport: { width: 1280, height: 800 } });

test("New folder keeps its one row", async ({ page }) => {
const main = await open(page, "en");
await main.getByRole("button", { name: "New folder", exact: true }).first().click({ timeout: 60_000 });
const card = main.getByTestId("fs-mkdir");
const field = card.getByTestId("fs-mkdir-name");
await expect(field).toBeFocused();
const fieldBox = (await field.boundingBox())!;
for (const b of await card.getByRole("button").all()) {
const box = (await b.boundingBox())!;
expect(Math.abs(box.y + box.height / 2 - (fieldBox.y + fieldBox.height / 2))).toBeLessThan(4);
}
await shot(page, "mkdir-desktop-1280");
});
});
4 changes: 2 additions & 2 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "ps5upload-client",
"private": true,
"type": "module",
"version": "12.6.33",
"version": "12.6.34",
"description": "The all-in-one PS5 companion app.",
"homepage": "https://github.com/phantomptr/ps5upload",
"author": "PhantomPtr <phantomptr@gmail.com>",
Expand Down
30 changes: 15 additions & 15 deletions client/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ps5upload-desktop"
version = "12.6.33"
version = "12.6.34"
description = "The all-in-one PS5 companion app."
license = "GPL-3.0-or-later"
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion client/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "PS5Upload",
"version": "12.6.33",
"version": "12.6.34",
"identifier": "com.phantomptr.ps5upload",
"build": {
"beforeDevCommand": "npm run dev:vite",
Expand Down
Loading
Loading