mirror of
https://github.com/aljazceru/ditto.git
synced 2025-12-31 04:04:24 +01:00
storeMiddleware: pass through admin UserStore
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
import { AppMiddleware } from '@/app.ts';
|
||||
import { Conf } from '@/config.ts';
|
||||
import { UserStore } from '@/storages/UserStore.ts';
|
||||
import { eventsDB } from '@/storages.ts';
|
||||
|
||||
/** Store middleware. */
|
||||
const storeMiddleware: AppMiddleware = async (c, next) => {
|
||||
const pubkey = c.get('pubkey');
|
||||
const adminStore = new UserStore(Conf.pubkey, eventsDB);
|
||||
|
||||
if (pubkey) {
|
||||
const store = new UserStore(pubkey, eventsDB);
|
||||
const store = new UserStore(pubkey, adminStore);
|
||||
c.set('store', store);
|
||||
} else {
|
||||
c.set('store', eventsDB);
|
||||
c.set('store', adminStore);
|
||||
}
|
||||
await next();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user