feat: offer a non-Mews web page as a simplified view or in the browser

This commit is contained in:
randogoth 2026-10-12 11:13:34 +03:00
parent cea66fbb42
commit 00e42c925c
24 changed files with 863 additions and 152 deletions

View file

@ -23,11 +23,15 @@ class LoadFailed extends BrowseError {
const LoadFailed();
}
/// A page the strict Mews parse refused. [simplified] is the same markup read
/// as far as the Mews subset reaches, for the reader who asks to see it, and is
/// null when nothing legible came out. [declaresMews] separates a page with a
/// real markup error from an ordinary web page.
class BrokenPage extends BrowseError {
const BrokenPage(this.source);
const BrokenPage({this.simplified, this.declaresMews = false});
/// The markup that failed to parse; "show page text" recovers its content.
final String source;
final MewsPage? simplified;
final bool declaresMews;
}
/// A protocol status with the site's own message for the reader: a temporary
@ -435,9 +439,9 @@ class BrowserController {
));
await _db.recordVisit(url, page.title);
}
case FetchParseError(:final source):
case FetchParseError(:final simplified, :final declaresMews):
currentPage.value = null;
error.value = BrokenPage(source);
error.value = BrokenPage(simplified: simplified, declaresMews: declaresMews);
case FetchProtocolError(:final message):
currentPage.value = null;
error.value = ProtocolFailure(message);