mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-07 07:34:25 +01:00
Rename all middleware to thingMiddleware
This commit is contained in:
@@ -16,7 +16,7 @@ import {
|
||||
* NIP-98 auth.
|
||||
* https://github.com/nostr-protocol/nips/blob/master/98.md
|
||||
*/
|
||||
function auth98(opts: ParseAuthRequestOpts = {}): AppMiddleware {
|
||||
function auth98Middleware(opts: ParseAuthRequestOpts = {}): AppMiddleware {
|
||||
return async (c, next) => {
|
||||
const req = localRequest(c);
|
||||
const result = await parseAuthRequest(req, opts);
|
||||
@@ -108,4 +108,4 @@ async function obtainProof(c: AppContext, opts?: ParseAuthRequestOpts) {
|
||||
}
|
||||
}
|
||||
|
||||
export { auth98, requireProof, requireRole };
|
||||
export { auth98Middleware, requireProof, requireRole };
|
||||
@@ -5,7 +5,7 @@ import ExpiringCache from '@/utils/expiring-cache.ts';
|
||||
|
||||
const debug = Debug('ditto:middleware:cache');
|
||||
|
||||
export const cache = (options: {
|
||||
export const cacheMiddleware = (options: {
|
||||
cacheName: string;
|
||||
expires?: number;
|
||||
}): MiddlewareHandler => {
|
||||
@@ -1,7 +1,7 @@
|
||||
import { AppMiddleware } from '@/app.ts';
|
||||
import { Conf } from '@/config.ts';
|
||||
|
||||
const csp = (): AppMiddleware => {
|
||||
export const cspMiddleware = (): AppMiddleware => {
|
||||
return async (c, next) => {
|
||||
const { host, protocol, origin } = Conf.url;
|
||||
const wsProtocol = protocol === 'http:' ? 'ws:' : 'wss:';
|
||||
@@ -26,5 +26,3 @@ const csp = (): AppMiddleware => {
|
||||
await next();
|
||||
};
|
||||
};
|
||||
|
||||
export { csp };
|
||||
@@ -3,7 +3,7 @@ import { UserStore } from '@/storages/UserStore.ts';
|
||||
import { Storages } from '@/storages.ts';
|
||||
|
||||
/** Store middleware. */
|
||||
const storeMiddleware: AppMiddleware = async (c, next) => {
|
||||
export const storeMiddleware: AppMiddleware = async (c, next) => {
|
||||
const pubkey = await c.get('signer')?.getPublicKey();
|
||||
|
||||
if (pubkey) {
|
||||
@@ -14,5 +14,3 @@ const storeMiddleware: AppMiddleware = async (c, next) => {
|
||||
}
|
||||
await next();
|
||||
};
|
||||
|
||||
export { storeMiddleware };
|
||||
Reference in New Issue
Block a user