Add Supa account and search changes

This commit is contained in:
Fabian Freund
2026-05-22 18:10:22 +02:00
parent 3a19865b2e
commit 51289f1266
374 changed files with 54061 additions and 5013 deletions
@@ -0,0 +1,62 @@
import 'package:copy_with_extension/copy_with_extension.dart';
import 'package:fast_equatable/fast_equatable.dart';
part 'captured_page_state.g.dart';
enum CapturedPageStatus { capturing, downloading, ready, downloadFailed }
@CopyWith()
class CapturedPageState with FastEquatable {
final Uri sourceUrl;
final CapturedPageStatus status;
final String? captureId;
final Uri? finalUrl;
final String? filename;
/// Capture engine used: `singlefile` or `shot-scraper`.
final String? method;
/// Engine-specific selector — preset (singlefile) or mode (shot-scraper).
final String? variant;
/// MIME type returned by the backend (e.g. `text/html`, `application/pdf`,
/// `image/png`). Used to choose the right file extension and to pick the
/// right viewer when opening the artifact locally.
final String? contentType;
final int? byteLength;
final String? localPath;
final String? downloadToken;
final String? errorMessage;
CapturedPageState({
required this.sourceUrl,
required this.status,
this.captureId,
this.finalUrl,
this.filename,
this.method,
this.variant,
this.contentType,
this.byteLength,
this.localPath,
this.downloadToken,
this.errorMessage,
});
@override
List<Object?> get hashParameters => [
sourceUrl,
status,
captureId,
finalUrl,
filename,
method,
variant,
contentType,
byteLength,
localPath,
downloadToken,
errorMessage,
];
}
@@ -0,0 +1,184 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'captured_page_state.dart';
// **************************************************************************
// CopyWithGenerator
// **************************************************************************
abstract class _$CapturedPageStateCWProxy {
CapturedPageState sourceUrl(Uri sourceUrl);
CapturedPageState status(CapturedPageStatus status);
CapturedPageState captureId(String? captureId);
CapturedPageState finalUrl(Uri? finalUrl);
CapturedPageState filename(String? filename);
CapturedPageState method(String? method);
CapturedPageState variant(String? variant);
CapturedPageState contentType(String? contentType);
CapturedPageState byteLength(int? byteLength);
CapturedPageState localPath(String? localPath);
CapturedPageState downloadToken(String? downloadToken);
CapturedPageState errorMessage(String? errorMessage);
/// Creates a new instance with the provided field values.
/// Passing `null` to a nullable field nullifies it, while `null` for a non-nullable field is ignored. To update a single field use `CapturedPageState(...).copyWith.fieldName(value)`.
///
/// Example:
/// ```dart
/// CapturedPageState(...).copyWith(id: 12, name: "My name")
/// ```
CapturedPageState call({
Uri sourceUrl,
CapturedPageStatus status,
String? captureId,
Uri? finalUrl,
String? filename,
String? method,
String? variant,
String? contentType,
int? byteLength,
String? localPath,
String? downloadToken,
String? errorMessage,
});
}
/// Callable proxy for `copyWith` functionality.
/// Use as `instanceOfCapturedPageState.copyWith(...)` or call `instanceOfCapturedPageState.copyWith.fieldName(value)` for a single field.
class _$CapturedPageStateCWProxyImpl implements _$CapturedPageStateCWProxy {
const _$CapturedPageStateCWProxyImpl(this._value);
final CapturedPageState _value;
@override
CapturedPageState sourceUrl(Uri sourceUrl) => call(sourceUrl: sourceUrl);
@override
CapturedPageState status(CapturedPageStatus status) => call(status: status);
@override
CapturedPageState captureId(String? captureId) => call(captureId: captureId);
@override
CapturedPageState finalUrl(Uri? finalUrl) => call(finalUrl: finalUrl);
@override
CapturedPageState filename(String? filename) => call(filename: filename);
@override
CapturedPageState method(String? method) => call(method: method);
@override
CapturedPageState variant(String? variant) => call(variant: variant);
@override
CapturedPageState contentType(String? contentType) =>
call(contentType: contentType);
@override
CapturedPageState byteLength(int? byteLength) => call(byteLength: byteLength);
@override
CapturedPageState localPath(String? localPath) => call(localPath: localPath);
@override
CapturedPageState downloadToken(String? downloadToken) =>
call(downloadToken: downloadToken);
@override
CapturedPageState errorMessage(String? errorMessage) =>
call(errorMessage: errorMessage);
@override
/// Creates a new instance with the provided field values.
/// Passing `null` to a nullable field nullifies it, while `null` for a non-nullable field is ignored. To update a single field use `CapturedPageState(...).copyWith.fieldName(value)`.
///
/// Example:
/// ```dart
/// CapturedPageState(...).copyWith(id: 12, name: "My name")
/// ```
CapturedPageState call({
Object? sourceUrl = const $CopyWithPlaceholder(),
Object? status = const $CopyWithPlaceholder(),
Object? captureId = const $CopyWithPlaceholder(),
Object? finalUrl = const $CopyWithPlaceholder(),
Object? filename = const $CopyWithPlaceholder(),
Object? method = const $CopyWithPlaceholder(),
Object? variant = const $CopyWithPlaceholder(),
Object? contentType = const $CopyWithPlaceholder(),
Object? byteLength = const $CopyWithPlaceholder(),
Object? localPath = const $CopyWithPlaceholder(),
Object? downloadToken = const $CopyWithPlaceholder(),
Object? errorMessage = const $CopyWithPlaceholder(),
}) {
return CapturedPageState(
sourceUrl: sourceUrl == const $CopyWithPlaceholder() || sourceUrl == null
? _value.sourceUrl
// ignore: cast_nullable_to_non_nullable
: sourceUrl as Uri,
status: status == const $CopyWithPlaceholder() || status == null
? _value.status
// ignore: cast_nullable_to_non_nullable
: status as CapturedPageStatus,
captureId: captureId == const $CopyWithPlaceholder()
? _value.captureId
// ignore: cast_nullable_to_non_nullable
: captureId as String?,
finalUrl: finalUrl == const $CopyWithPlaceholder()
? _value.finalUrl
// ignore: cast_nullable_to_non_nullable
: finalUrl as Uri?,
filename: filename == const $CopyWithPlaceholder()
? _value.filename
// ignore: cast_nullable_to_non_nullable
: filename as String?,
method: method == const $CopyWithPlaceholder()
? _value.method
// ignore: cast_nullable_to_non_nullable
: method as String?,
variant: variant == const $CopyWithPlaceholder()
? _value.variant
// ignore: cast_nullable_to_non_nullable
: variant as String?,
contentType: contentType == const $CopyWithPlaceholder()
? _value.contentType
// ignore: cast_nullable_to_non_nullable
: contentType as String?,
byteLength: byteLength == const $CopyWithPlaceholder()
? _value.byteLength
// ignore: cast_nullable_to_non_nullable
: byteLength as int?,
localPath: localPath == const $CopyWithPlaceholder()
? _value.localPath
// ignore: cast_nullable_to_non_nullable
: localPath as String?,
downloadToken: downloadToken == const $CopyWithPlaceholder()
? _value.downloadToken
// ignore: cast_nullable_to_non_nullable
: downloadToken as String?,
errorMessage: errorMessage == const $CopyWithPlaceholder()
? _value.errorMessage
// ignore: cast_nullable_to_non_nullable
: errorMessage as String?,
);
}
}
extension $CapturedPageStateCopyWith on CapturedPageState {
/// Returns a callable class used to build a new instance with modified fields.
/// Example: `instanceOfCapturedPageState.copyWith(...)` or `instanceOfCapturedPageState.copyWith.fieldName(...)`.
// ignore: library_private_types_in_public_api
_$CapturedPageStateCWProxy get copyWith =>
_$CapturedPageStateCWProxyImpl(this);
}
@@ -0,0 +1,67 @@
import 'package:flutter/material.dart';
/// Capture pipeline selector. Each choice maps to a (method, variant) pair
/// understood by the search backend's capture clients.
enum FetchMethodChoice {
/// Trafilatura — extracted reader-mode text + metadata. Not a "capture"
/// per se; goes through the `fetchPage` command.
trafilatura(method: null, variant: null),
/// SingleFile — self-contained HTML archive.
singlefileHtml(method: 'singlefile', variant: 'balanced'),
/// shot-scraper — PDF rendering.
shotScraperPdf(method: 'shot-scraper', variant: 'pdf'),
/// shot-scraper — PNG screenshot.
shotScraperPng(method: 'shot-scraper', variant: 'png');
const FetchMethodChoice({required this.method, required this.variant});
final String? method;
final String? variant;
static FetchMethodChoice? forCapture({
required String method,
required String variant,
}) {
for (final choice in FetchMethodChoice.values) {
if (choice.method == method && choice.variant == variant) {
return choice;
}
}
return null;
}
String get title => switch (this) {
FetchMethodChoice.trafilatura => 'Extracted Preview',
FetchMethodChoice.singlefileHtml => 'Full Page Capture',
FetchMethodChoice.shotScraperPdf => 'PDF Snapshot',
FetchMethodChoice.shotScraperPng => 'Image Snapshot',
};
String get shortLabel => switch (this) {
FetchMethodChoice.trafilatura => 'Preview',
FetchMethodChoice.singlefileHtml => 'Archive',
FetchMethodChoice.shotScraperPdf => 'PDF',
FetchMethodChoice.shotScraperPng => 'Image',
};
String get subtitle => switch (this) {
FetchMethodChoice.trafilatura =>
'Reader-optimized text and metadata for the in-app preview',
FetchMethodChoice.singlefileHtml =>
'Archive the full page with layout and assets for later use',
FetchMethodChoice.shotScraperPdf =>
'Render the page to a PDF for offline reading and sharing',
FetchMethodChoice.shotScraperPng =>
'Capture a full-page PNG screenshot of the rendered page',
};
IconData get icon => switch (this) {
FetchMethodChoice.trafilatura => Icons.description_outlined,
FetchMethodChoice.singlefileHtml => Icons.archive_outlined,
FetchMethodChoice.shotScraperPdf => Icons.picture_as_pdf_outlined,
FetchMethodChoice.shotScraperPng => Icons.image_outlined,
};
}