feat: add a hub for the client's own pages and gate mews:do action links

This commit is contained in:
randogoth 2026-10-11 13:05:07 +03:00
parent df705d831f
commit b311b9f7dd
21 changed files with 966 additions and 404 deletions

View file

@ -91,6 +91,19 @@ class MewsDatabase extends _$MewsDatabase {
return row?.url;
}
/// Row counts for the hub, so it can say what each page holds without
/// reading every row.
Future<int> countHistory() => _countOf(historyItems, historyItems.id);
Future<int> countBookmarks() => _countOf(bookmarks, bookmarks.id);
Future<int> countSubscriptions() => _countOf(subscriptions, subscriptions.id);
Future<int> _countOf(ResultSetImplementation<HasResultSet, dynamic> table,
GeneratedColumn<int> column) async {
final total = column.count();
final query = selectOnly(table)..addColumns([total]);
return (await query.getSingle()).read(total) ?? 0;
}
/// The most recent external visits, newest first.
Future<List<HistoryItem>> recentVisits({int limit = 50}) async {
final query = (select(historyItems)