Revert "Use current host for outfit share tags"
This reverts commit a0121f09ea
.
I didn't realize that VERCEL_URL wouldn't use the canonical URL. And thinking further about the Open Graph semantics, I think having just one canonical host makes more sense, even if it makes testing a bit more annoying in some cases.
This commit is contained in:
parent
a0121f09ea
commit
ae82a6236f
1 changed files with 10 additions and 9 deletions
|
@ -27,12 +27,6 @@ import fetch from "node-fetch";
|
||||||
import connectToDb from "../src/server/db";
|
import connectToDb from "../src/server/db";
|
||||||
import { normalizeRow } from "../src/server/util";
|
import { normalizeRow } from "../src/server/util";
|
||||||
|
|
||||||
const DTI_HOST = process.env.VERCEL_URL
|
|
||||||
? `https://${process.env.VERCEL_URL}`
|
|
||||||
: process.env.NODE_ENV === "development"
|
|
||||||
? "http://localhost:3000"
|
|
||||||
: "https://impress-2020.openneo.net";
|
|
||||||
|
|
||||||
async function handle(req, res) {
|
async function handle(req, res) {
|
||||||
// Load index.html as our initial page content. If this fails, it probably
|
// Load index.html as our initial page content. If this fails, it probably
|
||||||
// means something is misconfigured in a big way; we don't have a great way
|
// means something is misconfigured in a big way; we don't have a great way
|
||||||
|
@ -82,8 +76,10 @@ async function handle(req, res) {
|
||||||
const updatedAtTimestamp = Math.floor(
|
const updatedAtTimestamp = Math.floor(
|
||||||
new Date(outfit.updatedAt).getTime() / 1000
|
new Date(outfit.updatedAt).getTime() / 1000
|
||||||
);
|
);
|
||||||
const outfitUrl = `${DTI_HOST}/outfits/${encodeURIComponent(outfit.id)}`;
|
const outfitUrl = `https://impress-2020.openneo.net/outfits/${encodeURIComponent(
|
||||||
const imageUrl = `${DTI_HOST}/api/outfitImage?size=600&id=${encodeURIComponent(
|
outfit.id
|
||||||
|
)}`;
|
||||||
|
const imageUrl = `https://impress-2020.openneo.net/api/outfitImage?size=600&id=${encodeURIComponent(
|
||||||
outfit.id
|
outfit.id
|
||||||
)}&updatedAt=${updatedAtTimestamp}`;
|
)}&updatedAt=${updatedAtTimestamp}`;
|
||||||
const metaTags = `
|
const metaTags = `
|
||||||
|
@ -116,7 +112,12 @@ async function loadIndexPageHtml() {
|
||||||
if (cachedIndexPageHtml == null) {
|
if (cachedIndexPageHtml == null) {
|
||||||
// Request the same built copy of index.html that we're already serving at
|
// Request the same built copy of index.html that we're already serving at
|
||||||
// our homepage.
|
// our homepage.
|
||||||
const liveIndexPageHtml = await fetch(`${DTI_HOST}/`).then((res) =>
|
const homepageUrl = process.env.VERCEL_URL
|
||||||
|
? `https://${process.env.VERCEL_URL}/`
|
||||||
|
: process.env.NODE_ENV === "development"
|
||||||
|
? "http://localhost:3000/"
|
||||||
|
: "https://impress-2020.openneo.net/";
|
||||||
|
const liveIndexPageHtml = await fetch(homepageUrl).then((res) =>
|
||||||
res.text()
|
res.text()
|
||||||
);
|
);
|
||||||
cachedIndexPageHtml = liveIndexPageHtml;
|
cachedIndexPageHtml = liveIndexPageHtml;
|
||||||
|
|
Loading…
Reference in a new issue