diff --git a/src/pages/feed/[id].tsx b/src/pages/feed/[id].tsx
new file mode 100644
index 00000000..0639784b
--- /dev/null
+++ b/src/pages/feed/[id].tsx
@@ -0,0 +1,40 @@
+/* eslint-disable @typescript-eslint/no-explicit-any */
+import BaseLayout from '@layouts/baseLayout';
+import UserLayout from '@layouts/userLayout';
+
+import { GetStaticPaths } from 'next';
+import { JSXElementConstructor, ReactElement, ReactFragment, ReactPortal } from 'react';
+
+export default function Page({ id }: { id: string }) {
+ return
{id}
;
+}
+
+export const getStaticPaths: GetStaticPaths = async () => {
+ return {
+ paths: [],
+ fallback: 'blocking',
+ };
+};
+
+export async function getStaticProps(context) {
+ const id = context.params.id;
+ return {
+ props: { id },
+ };
+}
+
+Page.getLayout = function getLayout(
+ page:
+ | string
+ | number
+ | boolean
+ | ReactElement
>
+ | ReactFragment
+ | ReactPortal
+) {
+ return (
+
+ {page}
+
+ );
+};
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index 818c9f05..8c8aef36 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -17,30 +17,36 @@ import {
} from 'react';
import Database from 'tauri-plugin-sql-api';
+const db = typeof window !== 'undefined' ? await Database.load('sqlite:lume.db') : null;
+
export default function Page() {
const [done, setDone] = useState(false);
const initDB = useCallback(async () => {
- const db = await Database.load('sqlite:lume.db');
- await db.execute(
- 'CREATE TABLE IF NOT EXISTS accounts (id INTEGER PRIMARY KEY, privkey TEXT NOT NULL, pubkey TEXT NOT NULL, npub TEXT, nsec TEXT, metadata JSON, UNIQUE(privkey));'
- );
- await db.execute(
- 'CREATE TABLE IF NOT EXISTS followings (id INTEGER PRIMARY KEY, pubkey TEXT NOT NULL, account TEXT, UNIQUE(pubkey));'
- );
- await db.execute(
- 'CREATE TABLE IF NOT EXISTS note_reactions (id INTEGER PRIMARY KEY, reaction_id TEXT NOT NULL, e TEXT, p TEXT, UNIQUE(reaction_id));'
- );
- await db.execute(
- 'CREATE TABLE IF NOT EXISTS note_replies (id INTEGER PRIMARY KEY, reply_id TEXT NOT NULL, e TEXT, p TEXT, UNIQUE(reply_id));'
- );
- await db.execute(
- 'CREATE TABLE IF NOT EXISTS notes (id INTEGER PRIMARY KEY, event_id TEXT, event JSON, UNIQUE(event_id));'
- );
- await db.execute(
- 'CREATE TABLE IF NOT EXISTS block_pubkeys (id INTEGER PRIMARY KEY, pubkey TEXT, UNIQUE(pubkey));'
- );
- await db.close();
+ if (db) {
+ await db.execute(
+ 'CREATE TABLE IF NOT EXISTS accounts (id INTEGER PRIMARY KEY, privkey TEXT NOT NULL, pubkey TEXT NOT NULL, npub TEXT, nsec TEXT, metadata JSON, UNIQUE(privkey));'
+ );
+ await db.execute(
+ 'CREATE TABLE IF NOT EXISTS followings (id INTEGER PRIMARY KEY, pubkey TEXT NOT NULL, account TEXT, UNIQUE(pubkey));'
+ );
+ await db.execute(
+ 'CREATE TABLE IF NOT EXISTS note_reactions (id INTEGER PRIMARY KEY, reaction_id TEXT NOT NULL, e TEXT, p TEXT, UNIQUE(reaction_id));'
+ );
+ await db.execute(
+ 'CREATE TABLE IF NOT EXISTS note_replies (id INTEGER PRIMARY KEY, reply_id TEXT NOT NULL, e TEXT, p TEXT, UNIQUE(reply_id));'
+ );
+ await db.execute(
+ 'CREATE TABLE IF NOT EXISTS notes (id INTEGER PRIMARY KEY, event_id TEXT, event JSON, UNIQUE(event_id));'
+ );
+ await db.execute(
+ 'CREATE TABLE IF NOT EXISTS cache_profiles (id INTEGER PRIMARY KEY, pubkey TEXT, metadata JSON, UNIQUE(pubkey));'
+ );
+ await db.execute(
+ 'CREATE TABLE IF NOT EXISTS block_pubkeys (id INTEGER PRIMARY KEY, pubkey TEXT, UNIQUE(pubkey));'
+ );
+ await db.close();
+ }
setDone(true);
}, []);