init nostr and add userinfo provider

This commit is contained in:
DASHU
2025-07-22 19:07:51 +08:00
parent 08bb4c63b4
commit 1d918dac20
11 changed files with 930 additions and 88 deletions

View File

@@ -4,7 +4,7 @@ import 'package:sqflite/sqflite.dart';
import '../const/base.dart';
class DB {
static const _VERSION = 2;
static const _VERSION = 3;
static const _dbName = "nowser.db";
@@ -43,14 +43,28 @@ class DB {
"create table bookmark(id integer not null constraint bookmark_pk primary key autoincrement,title text,url text not null,favicon text,weight integer,added_to_index integer, added_to_qa integer,created_at integer);");
db.execute(
"create table browser_history(id integer not null constraint browser_history_pk primary key autoincrement,title text,url text not null,favicon text,created_at integer);");
db.execute(
"create table event(id text,pubkey text,created_at integer,kind integer,tags text,content text);");
db.execute("create unique index event_key_index_id_uindex on event (id);");
db.execute("create index event_date_index on event (kind, created_at);");
}
static Future<void> _onUpgrade(
Database db, int oldVersion, int newVersion) async {
if (oldVersion == 1) {
if (oldVersion < 2) {
db.execute(
"alter table bookmark add added_to_qa integer after added_to_index");
}
if (oldVersion < 3) {
db.execute(
"create table event(id text,pubkey text,created_at integer,kind integer,tags text,content text);");
db.execute(
"create unique index event_key_index_id_uindex on event (id);");
db.execute(
"create index event_date_index on event (kind, created_at);");
}
}
static Future<Database> getCurrentDatabase() async {