Send unfurler fallback imgs directly

This commit is contained in:
Mononaut
2023-08-06 15:49:11 +09:00
parent 9aa778e44e
commit 8dbf9f29cf
9 changed files with 8 additions and 11 deletions

View File

@@ -8,6 +8,7 @@ import ReusablePage from './concurrency/ReusablePage';
import ReusableSSRPage from './concurrency/ReusablePage';
import { parseLanguageUrl } from './language/lang';
import { matchRoute } from './routes';
import nodejsPath from 'path';
import logger from './logger';
import { TimeoutError } from "puppeteer";
const puppeteerConfig = require('../puppeteer.config.json');
@@ -228,11 +229,7 @@ class Server {
if (!img) {
// proxy fallback image from the frontend
if (this.secureHost) {
https.get(config.SERVER.HOST + matchedRoute.fallbackImg, (got) => got.pipe(res));
} else {
http.get(config.SERVER.HOST + matchedRoute.fallbackImg, (got) => got.pipe(res));
}
res.sendFile(nodejsPath.join(__dirname, matchedRoute.fallbackImg));
} else {
res.contentType('image/png');
res.send(img);

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 KiB

View File

@@ -30,7 +30,7 @@ const routes = {
},
lightning: {
title: "Lightning",
fallbackImg: '/resources/previews/lightning.png',
fallbackImg: '/resources/img/lightning.png',
routes: {
node: {
render: true,
@@ -68,7 +68,7 @@ const routes = {
},
mining: {
title: "Mining",
fallbackImg: '/resources/previews/mining.png',
fallbackImg: '/resources/img/mining.png',
routes: {
pool: {
render: true,
@@ -83,13 +83,13 @@ const routes = {
const networks = {
bitcoin: {
fallbackImg: '/resources/previews/dashboard.png',
fallbackImg: '/resources/img/dashboard.png',
routes: {
...routes // all routes supported
}
},
liquid: {
fallbackImg: '/resources/liquid/liquid-network-preview.png',
fallbackImg: '/resources/img/liquid.png',
routes: { // only block, address & tx routes supported
block: routes.block,
address: routes.address,
@@ -97,7 +97,7 @@ const networks = {
}
},
bisq: {
fallbackImg: '/resources/bisq/bisq-markets-preview.png',
fallbackImg: '/resources/img/bisq.png',
routes: {} // no routes supported
}
};