diff --git a/frontend/src/app/services/seo.service.ts b/frontend/src/app/services/seo.service.ts index d536b4938..4fc25be52 100644 --- a/frontend/src/app/services/seo.service.ts +++ b/frontend/src/app/services/seo.service.ts @@ -72,11 +72,9 @@ export class SeoService { clearSoft404() { window['soft404'] = false; - console.log('cleared soft 404'); } logSoft404() { window['soft404'] = true; - console.log('set soft 404'); } } diff --git a/unfurler/package.json b/unfurler/package.json index ec0a153b6..e9d2dca25 100644 --- a/unfurler/package.json +++ b/unfurler/package.json @@ -9,7 +9,7 @@ "main": "index.ts", "scripts": { "tsc": "./node_modules/typescript/bin/tsc", - "build": "npm run tsc", + "build": "npm run tsc && cp -r src/resources dist/resources", "start": "node --max-old-space-size=2048 dist/index.js", "unfurler": "node --max-old-space-size=4096 dist/index.js", "lint": "./node_modules/.bin/eslint . --ext .ts", diff --git a/unfurler/src/index.ts b/unfurler/src/index.ts index de13215e4..f3acd61bf 100644 --- a/unfurler/src/index.ts +++ b/unfurler/src/index.ts @@ -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'); @@ -50,6 +51,12 @@ class Server { this.canonicalHost = canonical; this.startServer(); + + setTimeout(async () => { + logger.info(`killing myself now`); + await this.stopServer(); + process.exit(0); + }, 3600_000 * (1 + Math.random())) } async startServer() { @@ -222,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); diff --git a/unfurler/src/resources/img/bisq.png b/unfurler/src/resources/img/bisq.png new file mode 100644 index 000000000..2b5e1250b Binary files /dev/null and b/unfurler/src/resources/img/bisq.png differ diff --git a/unfurler/src/resources/img/dashboard.png b/unfurler/src/resources/img/dashboard.png new file mode 100644 index 000000000..60c8bcc6a Binary files /dev/null and b/unfurler/src/resources/img/dashboard.png differ diff --git a/unfurler/src/resources/img/lightning.png b/unfurler/src/resources/img/lightning.png new file mode 100644 index 000000000..4686b0ef0 Binary files /dev/null and b/unfurler/src/resources/img/lightning.png differ diff --git a/unfurler/src/resources/img/liquid.png b/unfurler/src/resources/img/liquid.png new file mode 100644 index 000000000..72942110c Binary files /dev/null and b/unfurler/src/resources/img/liquid.png differ diff --git a/unfurler/src/resources/img/mempool.png b/unfurler/src/resources/img/mempool.png new file mode 100644 index 000000000..60c8bcc6a Binary files /dev/null and b/unfurler/src/resources/img/mempool.png differ diff --git a/unfurler/src/resources/img/mining.png b/unfurler/src/resources/img/mining.png new file mode 100644 index 000000000..6a2aa1b41 Binary files /dev/null and b/unfurler/src/resources/img/mining.png differ diff --git a/unfurler/src/routes.ts b/unfurler/src/routes.ts index f9280369c..1beb0380a 100644 --- a/unfurler/src/routes.ts +++ b/unfurler/src/routes.ts @@ -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 } };