lint
This commit is contained in:
parent
193ba6691d
commit
b382e8701b
|
@ -44,14 +44,22 @@ export const fetchAlbumURL = async (albumID: string): Promise<string> => {
|
|||
|
||||
export const fetchAlbum = async (albumID: string): Promise<Comment[]> => {
|
||||
// https://api.imgur.com/post/v1/albums/zk7mdKH?client_id=${CLIENT_ID}&include=media%2Caccount
|
||||
const response = await got(`https://api.imgur.com/post/v1/albums/${albumID}?client_id=${CONFIG.imgur_client_id}&include=media%2Caccount`, { agent });
|
||||
const response = await got(
|
||||
`https://api.imgur.com/post/v1/albums/${albumID}?client_id=${CONFIG.imgur_client_id}&include=media%2Caccount`,
|
||||
{ agent }
|
||||
);
|
||||
return JSON.parse(response.body);
|
||||
}
|
||||
|
||||
export const fetchComments = async (galleryID: string): Promise<Comment[]> => {
|
||||
/* eslint-disable max-len */
|
||||
// https://api.imgur.com/comment/v1/comments?client_id=${CLIENT_ID}%5Bpost%5D=eq%3Ag1bk7CB&include=account%2Cadconfig&per_page=30&sort=best
|
||||
const response = await got(`https://api.imgur.com/comment/v1/comments?client_id=${CONFIG.imgur_client_id}&filter%5Bpost%5D=eq%3A${galleryID}&include=account%2Cadconfig&per_page=30&sort=best`, { agent });
|
||||
const response = await got(
|
||||
`https://api.imgur.com/comment/v1/comments?client_id=${CONFIG.imgur_client_id}&filter%5Bpost%5D=eq%3A${galleryID}&include=account%2Cadconfig&per_page=30&sort=best`,
|
||||
{ agent }
|
||||
);
|
||||
return JSON.parse(response.body).data;
|
||||
/* eslint-enable max-len */
|
||||
}
|
||||
|
||||
export const fetchGallery = async (galleryID: string): Promise<Gallery> => {
|
||||
|
|
|
@ -26,14 +26,14 @@ export const handleAlbum = async (request: Hapi.Request, h: Hapi.ResponseToolkit
|
|||
pageTitle: CONFIG.page_title,
|
||||
util,
|
||||
});
|
||||
} else {
|
||||
}
|
||||
const url = await fetchAlbumURL(albumID);
|
||||
return h.view('bare-album', {
|
||||
url,
|
||||
pageTitle: CONFIG.page_title,
|
||||
util,
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export const handleUser = (request: Hapi.Request, h: Hapi.ResponseToolkit) => {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
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';
|
||||
|
@ -34,7 +33,7 @@ const init = async () => {
|
|||
directory: {
|
||||
path: Path.join(__dirname, 'static/css')
|
||||
}
|
||||
} as any)
|
||||
} as any) // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
});
|
||||
server.views({
|
||||
engines: {
|
||||
|
|
|
@ -5,15 +5,6 @@ interface Account {
|
|||
created_at: string;
|
||||
}
|
||||
|
||||
interface Gallery {
|
||||
id: string;
|
||||
title: string;
|
||||
account: Account;
|
||||
media: Media[];
|
||||
tags: Tag[];
|
||||
cover: Media;
|
||||
}
|
||||
|
||||
type MediaMimeType = 'image/jpeg' | 'image/png' | 'image/gif';
|
||||
type MediaType = 'image';
|
||||
type MediaExt = 'jpeg' | 'png' | 'gif';
|
||||
|
@ -64,8 +55,8 @@ interface Comment {
|
|||
platform_id: number;
|
||||
platform: MediaPlatform;
|
||||
created_at: string;
|
||||
updated_at: "2021-10-01T00:08:51Z",
|
||||
deleted_at: null,
|
||||
updated_at: string;
|
||||
deleted_at: null;
|
||||
next: null; //?
|
||||
comments: Comment[];
|
||||
account: {
|
||||
|
@ -75,3 +66,11 @@ interface Comment {
|
|||
}
|
||||
}
|
||||
|
||||
interface Gallery {
|
||||
id: string;
|
||||
title: string;
|
||||
account: Account;
|
||||
media: Media[];
|
||||
tags: Tag[];
|
||||
cover: Media;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue