Make comments optional
Since they require CLIENT_ID
This commit is contained in:
parent
6afd222515
commit
eb6b87cf1f
Binary file not shown.
@ -5,4 +5,5 @@ export default {
|
|||||||
http_proxy: process.env.RIMGU_HTTP_PROXY || null,
|
http_proxy: process.env.RIMGU_HTTP_PROXY || null,
|
||||||
https_proxy: process.env.RIMGU_HTTPS_PROXY || null,
|
https_proxy: process.env.RIMGU_HTTPS_PROXY || null,
|
||||||
imgur_client_id: process.env.RIMGU_IMGUR_CLIENT_ID || null,
|
imgur_client_id: process.env.RIMGU_IMGUR_CLIENT_ID || null,
|
||||||
|
disable_comments: process.env.RIMGU_DISABLE_COMMENTS === 'true',
|
||||||
};
|
};
|
||||||
|
@ -3,6 +3,8 @@ import '@hapi/vision';
|
|||||||
import { fetchAlbumURL, fetchComments, fetchGallery, fetchMedia } from './fetchers';
|
import { fetchAlbumURL, fetchComments, fetchGallery, fetchMedia } from './fetchers';
|
||||||
import * as util from './util';
|
import * as util from './util';
|
||||||
|
|
||||||
|
import CONFIG from './config';
|
||||||
|
|
||||||
export const handleMedia = async (request: Hapi.Request, h: Hapi.ResponseToolkit) => {
|
export const handleMedia = async (request: Hapi.Request, h: Hapi.ResponseToolkit) => {
|
||||||
const {
|
const {
|
||||||
baseName,
|
baseName,
|
||||||
@ -36,7 +38,9 @@ export const handleTag = (request: Hapi.Request, h: Hapi.ResponseToolkit) => {
|
|||||||
export const handleGallery = async (request: Hapi.Request, h: Hapi.ResponseToolkit) => {
|
export const handleGallery = async (request: Hapi.Request, h: Hapi.ResponseToolkit) => {
|
||||||
const galleryID = request.params.galleryID;
|
const galleryID = request.params.galleryID;
|
||||||
const gallery = await fetchGallery(galleryID);
|
const gallery = await fetchGallery(galleryID);
|
||||||
const comments = await fetchComments(galleryID);
|
const comments = CONFIG.disable_comments
|
||||||
|
? null
|
||||||
|
: await fetchComments(galleryID);
|
||||||
return h.view('gallery', {
|
return h.view('gallery', {
|
||||||
...gallery,
|
...gallery,
|
||||||
comments,
|
comments,
|
||||||
|
@ -60,12 +60,13 @@ html
|
|||||||
a(class='TagPill'
|
a(class='TagPill'
|
||||||
style='background: linear-gradient(0deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)) repeat scroll 0% 0%, rgba(0, 0, 0, 0) url("/' + tag.background_id + '_d.jpg?maxwidth=200&fidelity=grand") repeat scroll 0% 0%;'
|
style='background: linear-gradient(0deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)) repeat scroll 0% 0%, rgba(0, 0, 0, 0) url("/' + tag.background_id + '_d.jpg?maxwidth=200&fidelity=grand") repeat scroll 0% 0%;'
|
||||||
href='/t/'+tag.tag) #{tag.tag}
|
href='/t/'+tag.tag) #{tag.tag}
|
||||||
div(class='CommentsList')
|
if comments != null
|
||||||
div(class='CommentsList-headline')
|
div(class='CommentsList')
|
||||||
div(class='CommentsList-headline--counter')
|
div(class='CommentsList-headline')
|
||||||
span #{comments.length} Comments
|
div(class='CommentsList-headline--counter')
|
||||||
div
|
span #{comments.length} Comments
|
||||||
div(class='CommentsList-comments')
|
div
|
||||||
div(class='CommentsList-comments--container')
|
div(class='CommentsList-comments')
|
||||||
each comment in comments
|
div(class='CommentsList-comments--container')
|
||||||
+commentbox(comment)
|
each comment in comments
|
||||||
|
+commentbox(comment)
|
||||||
|
Loading…
Reference in New Issue
Block a user