refactor(api): /raw -> /r
This commit is contained in:
parent
b5c83f92e3
commit
7b44f17a64
3 changed files with 5 additions and 5 deletions
|
@ -60,7 +60,7 @@ function shouldUseYarn() {
|
|||
const prisma = new PrismaClient();
|
||||
|
||||
const srv = createServer(async (req, res) => {
|
||||
if (req.url.startsWith('/raw')) {
|
||||
if (req.url.startsWith('/r')) {
|
||||
const parts = req.url.split('/');
|
||||
if (!parts[2] || parts[2] === '') return;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ export default function EmbeddedImage({ image, title, username, color, normal, e
|
|||
const imageEl = document.getElementById('image_content') as HTMLImageElement;
|
||||
|
||||
const original = new Image;
|
||||
original.src = dataURL('/raw');
|
||||
original.src = dataURL('/r');
|
||||
|
||||
if (original.width > innerWidth) {
|
||||
imageEl.width = Math.floor(original.width * Math.min((innerHeight / original.height), (innerWidth / original.width)));
|
||||
|
@ -44,7 +44,7 @@ export default function EmbeddedImage({ image, title, username, color, normal, e
|
|||
<meta property='og:url' content={dataURL(normal)} />
|
||||
</>
|
||||
)}
|
||||
<meta property='og:image' content={dataURL('/raw')} />
|
||||
<meta property='og:image' content={dataURL('/r')} />
|
||||
<meta property='twitter:card' content='summary_large_image' />
|
||||
<title>{image.file}</title>
|
||||
</Head>
|
||||
|
@ -54,7 +54,7 @@ export default function EmbeddedImage({ image, title, username, color, normal, e
|
|||
alignItems='center'
|
||||
minHeight='100vh'
|
||||
>
|
||||
<img src={dataURL('/raw')} alt={dataURL('/raw')} id='image_content' />
|
||||
<img src={dataURL('/r')} alt={dataURL('/r')} id='image_content' />
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
|
|
|
@ -54,7 +54,7 @@ async function handler(req: NextApiReq, res: NextApiRes) {
|
|||
|
||||
|
||||
// @ts-ignore
|
||||
images.map(image => image.url = `/raw/${image.file}`);
|
||||
images.map(image => image.url = `/r/${image.file}`);
|
||||
if (req.query.filter && req.query.filter === 'image') images = images.filter(x => x.mimetype.startsWith('image'));
|
||||
|
||||
return res.json(req.query.paged ? chunk(images, 16) : images);
|
||||
|
|
Loading…
Add table
Reference in a new issue