Merge branch 'app-store' into 'main'
Make storeMiddleware available in every request See merge request soapbox-pub/ditto!192
This commit is contained in:
commit
8902dc28c1
|
@ -91,7 +91,7 @@ interface AppEnv extends HonoEnv {
|
||||||
/** User associated with the pubkey, if any. */
|
/** User associated with the pubkey, if any. */
|
||||||
user?: User;
|
user?: User;
|
||||||
/** Store */
|
/** Store */
|
||||||
store?: NStore;
|
store: NStore;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ app.get('/api/v1/streaming', streamingController);
|
||||||
app.get('/api/v1/streaming/', streamingController);
|
app.get('/api/v1/streaming/', streamingController);
|
||||||
app.get('/relay', relayController);
|
app.get('/relay', relayController);
|
||||||
|
|
||||||
app.use('*', csp(), cors({ origin: '*', exposeHeaders: ['link'] }), auth19, auth98());
|
app.use('*', csp(), cors({ origin: '*', exposeHeaders: ['link'] }), auth19, auth98(), storeMiddleware);
|
||||||
|
|
||||||
app.get('/.well-known/webfinger', webfingerController);
|
app.get('/.well-known/webfinger', webfingerController);
|
||||||
app.get('/.well-known/host-meta', hostMetaController);
|
app.get('/.well-known/host-meta', hostMetaController);
|
||||||
|
@ -173,8 +173,8 @@ app.delete('/api/v1/statuses/:id{[0-9a-f]{64}}', requirePubkey, deleteStatusCont
|
||||||
app.post('/api/v1/media', mediaController);
|
app.post('/api/v1/media', mediaController);
|
||||||
app.post('/api/v2/media', mediaController);
|
app.post('/api/v2/media', mediaController);
|
||||||
|
|
||||||
app.get('/api/v1/timelines/home', requirePubkey, storeMiddleware, homeTimelineController);
|
app.get('/api/v1/timelines/home', requirePubkey, homeTimelineController);
|
||||||
app.get('/api/v1/timelines/public', storeMiddleware, publicTimelineController);
|
app.get('/api/v1/timelines/public', publicTimelineController);
|
||||||
app.get('/api/v1/timelines/tag/:hashtag', hashtagTimelineController);
|
app.get('/api/v1/timelines/tag/:hashtag', hashtagTimelineController);
|
||||||
|
|
||||||
app.get('/api/v1/preferences', preferencesController);
|
app.get('/api/v1/preferences', preferencesController);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { NostrFilter, NStore } from '@nostrify/nostrify';
|
import { NostrFilter } from '@nostrify/nostrify';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
import { type AppContext, type AppController } from '@/app.ts';
|
import { type AppContext, type AppController } from '@/app.ts';
|
||||||
|
@ -45,7 +45,7 @@ const hashtagTimelineController: AppController = (c) => {
|
||||||
/** Render statuses for timelines. */
|
/** Render statuses for timelines. */
|
||||||
async function renderStatuses(c: AppContext, filters: NostrFilter[]) {
|
async function renderStatuses(c: AppContext, filters: NostrFilter[]) {
|
||||||
const { signal } = c.req.raw;
|
const { signal } = c.req.raw;
|
||||||
const store = c.get('store') as NStore;
|
const store = c.get('store');
|
||||||
|
|
||||||
const events = await store
|
const events = await store
|
||||||
.query(filters, { signal })
|
.query(filters, { signal })
|
||||||
|
|
Loading…
Reference in New Issue