PEP-304: подписки в лимите — не «нет подписки»; время людям — в поясе платформы #292

Merged
peppa-bot merged 4 commits from task/pep-304 into main 2026-11-27 05:31:19 +00:00
7 changed files with 14 additions and 10 deletions
Showing only changes of commit bc14e5824c - Show all commits

View File

@ -1,4 +1,4 @@
import Link from "next/link";
import Link from "@/components/Link";
import { notFound } from "next/navigation";
import { ExternalLink, KeyRound } from "lucide-react";
import { accessRequestForUser, catalogService, connectionsForRequest, type AccessRequestView, type CatalogService, type ConnectionView } from "@peppa/core";

View File

@ -1,4 +1,4 @@
import Link from "next/link";
import Link from "@/components/Link";
import { notFound } from "next/navigation";
import { MessageCircleQuestion } from "lucide-react";
import { isSuperadmin } from "@peppa/core";

View File

@ -1,4 +1,4 @@
import Link from "next/link";
import Link from "@/components/Link";
import { KeyRound } from "lucide-react";
import type { AccessRequestView } from "@peppa/core";
import type { Translator } from "@peppa/shared/i18n";

View File

@ -287,6 +287,6 @@ nonce, созданные сервером для этого потока; по
| адрес | показ |
|---|---|
| http://git.telecom.quest/avatars/1 | https://git.telecom.quest/avatars/1 |
| https://git.telecom.quest/avatars/1 | https://git.telecom.quest/avatars/1 |
| http://git.vibe42.kz/avatars/1 | https://git.vibe42.kz/avatars/1 |
| https://git.vibe42.kz/avatars/1 | https://git.vibe42.kz/avatars/1 |
| javascript:alert(1) | нет картинки |

View File

@ -262,6 +262,9 @@ export function observeDb(): DatabaseSync {
}
/** Tests: forget opened files. */
/** Index of the migration whose SQL mentions `needle` (the `user_version` right before it); -1 — none. For tests that put a file back before one migration. */
export const observeMigrationIndex = (needle: string): number => MIGRATIONS.findIndex((m) => m.some((sql) => sql.includes(needle)));
export function closeObserveDb(): void {
for (const db of opened.values()) db.close();
opened.clear();

View File

@ -88,8 +88,8 @@ describe("PEP-272: ответы веба не раскрывают служеб
});
for (const [url, shown] of [
["http://git.telecom.quest/avatars/1", "https://git.telecom.quest/avatars/1"],
["https://git.telecom.quest/avatars/1", "https://git.telecom.quest/avatars/1"],
["http://git.vibe42.kz/avatars/1", "https://git.vibe42.kz/avatars/1"],
["https://git.vibe42.kz/avatars/1", "https://git.vibe42.kz/avatars/1"],
["javascript:alert(1)", null],
["", null],
] as const) {
@ -99,7 +99,7 @@ describe("PEP-272: ответы веба не раскрывают служеб
}
test("Аватар Gitea по http сохраняется как https", async () => {
const u = await core.upsertUserFromGitea(db, { id: 72001, login: "mock-avatar", avatar_url: "http://git.telecom.quest/avatars/7" }, { access_token: "x" });
assert.equal(u.avatarUrl, "https://git.telecom.quest/avatars/7");
const u = await core.upsertUserFromGitea(db, { id: 72001, login: "mock-avatar", avatar_url: "http://git.vibe42.kz/avatars/7" }, { access_token: "x" });
assert.equal(u.avatarUrl, "https://git.vibe42.kz/avatars/7");
});
});

View File

@ -72,7 +72,8 @@ function oldMonitor(hosts: string[]): number {
VALUES ('Интернет', 'internet', ?, 60, 5000, 3, 2, 'system', ?, ?, ?) RETURNING id`,
)
.get(JSON.stringify({ hosts }), iso, iso, iso) as { id: number };
raw.exec("PRAGMA user_version = 3");
// The version right before the PEP-281 migration — other migrations (PEP-217: web_vitals) stay applied.
raw.exec(`PRAGMA user_version = ${core.observeMigrationIndex(OLD_HOST)}`);
raw.close();
return row.id;
}