X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fexpress-utils.ts;h=b715fb7d0a379debeb5beb184b73e065f3441ef9;hb=41a676db3989fe3eca91301ac5f5aea30d98654a;hp=1d7bee87edfe424557cdc42c62983c17b428f4fc;hpb=06215f15e0a9fea2ef95b8b49cb2b5868fb64017;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/express-utils.ts b/server/helpers/express-utils.ts index 1d7bee87e..b715fb7d0 100644 --- a/server/helpers/express-utils.ts +++ b/server/helpers/express-utils.ts @@ -95,11 +95,19 @@ function createReqFiles ( return multer({ storage }).fields(fields) } +function isUserAbleToSearchRemoteURI (res: express.Response) { + const user: User = res.locals.oauth ? res.locals.oauth.token.User : undefined + + return CONFIG.SEARCH.REMOTE_URI.ANONYMOUS === true || + (CONFIG.SEARCH.REMOTE_URI.USERS === true && user !== undefined) +} + // --------------------------------------------------------------------------- export { buildNSFWFilter, getHostWithPort, + isUserAbleToSearchRemoteURI, badRequest, createReqFiles, cleanUpReqFiles