mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-24 07:39:41 +02:00
add support for meta tags on share pages (#867)
This commit is contained in:
parent
5454d2c8b8
commit
5839992c19
9 changed files with 190 additions and 118 deletions
|
@ -2,6 +2,24 @@ export const useAsyncKey = function () {
|
|||
return String(Date.now());
|
||||
};
|
||||
|
||||
export function detectServerBaseUrl(req: any) {
|
||||
if (!req || req === undefined) {
|
||||
return "";
|
||||
}
|
||||
if (req.headers.referer) {
|
||||
const url = new URL(req.headers.referer);
|
||||
return `${url.protocol}//${url.host}`;
|
||||
} else if (req.headers.host) {
|
||||
const protocol = req.connection.encrypted ? "https" : "http:";
|
||||
return `${protocol}//${req.headers.host}`;
|
||||
} else if (req.connection.remoteAddress) {
|
||||
const protocol = req.connection.encrypted ? "https" : "http:";
|
||||
return `${protocol}//${req.connection.localAddress}:${req.connection.localPort}`;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
export function uuid4() {
|
||||
// @ts-ignore
|
||||
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue