handle user cover
This commit is contained in:
parent
1da6e52be6
commit
903eb2b9ba
@ -54,6 +54,14 @@ export const handleUser = async (request: Hapi.Request, h: Hapi.ResponseToolkit)
|
||||
});
|
||||
};
|
||||
|
||||
export const handleUserCover = async (request: Hapi.Request, h: Hapi.ResponseToolkit) => {
|
||||
const userID = request.params.userID;
|
||||
const result = await fetchMedia(`/user/${userID}/cover?maxwidth=2560`);
|
||||
const response = h.response(result.rawBody)
|
||||
.header('Content-Type', result.headers["content-type"] || `image/jpeg`);
|
||||
return response;
|
||||
};
|
||||
|
||||
export const handleTag = async (request: Hapi.Request, h: Hapi.ResponseToolkit) => {
|
||||
// https://imgur.com/t/funny
|
||||
if (!CONFIG.use_api) {
|
||||
|
@ -2,7 +2,7 @@ import Hapi = require('@hapi/hapi');
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const Exiting = require('exiting');
|
||||
import Path = require('path');
|
||||
import { handleAlbum, handleGallery, handleMedia, handleTag, handleUser } from './handlers';
|
||||
import { handleAlbum, handleGallery, handleMedia, handleTag, handleUser, handleUserCover } from './handlers';
|
||||
|
||||
import CONFIG from './config';
|
||||
|
||||
@ -65,6 +65,11 @@ const init = async () => {
|
||||
path: '/user/{userID?}',
|
||||
handler: handleUser,
|
||||
});
|
||||
server.route({
|
||||
method: 'GET',
|
||||
path: '/user/{userID}/cover',
|
||||
handler: handleUserCover,
|
||||
});
|
||||
server.route({
|
||||
method: 'GET',
|
||||
path: '/gallery/{galleryID}',
|
||||
|
Loading…
Reference in New Issue
Block a user