#72 add og-image from the gallery's first thumbnail
This commit is contained in:
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "immich-public-proxy",
|
"name": "immich-public-proxy",
|
||||||
"version": "1.9.0",
|
"version": "1.9.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "immich-public-proxy",
|
"name": "immich-public-proxy",
|
||||||
"version": "1.9.0",
|
"version": "1.9.1",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"archiver": "^7.0.1",
|
"archiver": "^7.0.1",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "immich-public-proxy",
|
"name": "immich-public-proxy",
|
||||||
"version": "1.9.0",
|
"version": "1.9.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "ts-node src/index.ts",
|
"dev": "ts-node src/index.ts",
|
||||||
"build": "npx tsc",
|
"build": "npx tsc",
|
||||||
|
|||||||
+9
-1
@@ -88,6 +88,14 @@ class Render {
|
|||||||
*/
|
*/
|
||||||
async gallery (res: Response, share: SharedLink, openItem?: number) {
|
async gallery (res: Response, share: SharedLink, openItem?: number) {
|
||||||
const items = []
|
const items = []
|
||||||
|
|
||||||
|
// Originally I had the base URL as a config option in .env.
|
||||||
|
// The issue with that is people who may be wanting to route in via multiple
|
||||||
|
// public URLs. So instead we generate the base URL from the incoming request data.
|
||||||
|
// This may cause issues with some reverse proxies, in which case just make sure
|
||||||
|
// that you're sending the correct `host` header to IPP.
|
||||||
|
const baseUrl = res.req.protocol + '://' + res.req.headers.host
|
||||||
|
|
||||||
for (const asset of share.assets) {
|
for (const asset of share.assets) {
|
||||||
let video, downloadUrl
|
let video, downloadUrl
|
||||||
if (asset.type === AssetType.video) {
|
if (asset.type === AssetType.video) {
|
||||||
@@ -112,7 +120,7 @@ class Render {
|
|||||||
items.push({
|
items.push({
|
||||||
previewUrl: immich.photoUrl(share.key, asset.id, ImageSize.preview),
|
previewUrl: immich.photoUrl(share.key, asset.id, ImageSize.preview),
|
||||||
downloadUrl,
|
downloadUrl,
|
||||||
thumbnailUrl: immich.photoUrl(share.key, asset.id, ImageSize.thumbnail),
|
thumbnailUrl: baseUrl + immich.photoUrl(share.key, asset.id, ImageSize.thumbnail),
|
||||||
video
|
video
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
|
||||||
<title><%- title %></title>
|
<title><%- title %></title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||||
|
<%
|
||||||
|
// Add an og-image using the first image's thumbnail
|
||||||
|
if (items?.[0]?.thumbnailUrl) {
|
||||||
|
%>
|
||||||
|
<meta property="og:image" content="<%- items[0].thumbnailUrl %>"/>
|
||||||
|
<% } %>
|
||||||
<link rel="icon" href="/share/static/favicon.ico" type="image/x-icon">
|
<link rel="icon" href="/share/static/favicon.ico" type="image/x-icon">
|
||||||
<link type="text/css" rel="stylesheet" href="/share/static/style.css"/>
|
<link type="text/css" rel="stylesheet" href="/share/static/style.css"/>
|
||||||
<link type="text/css" rel="stylesheet" href="/share/static/lg/lightgallery-bundle.min.css"/>
|
<link type="text/css" rel="stylesheet" href="/share/static/lg/lightgallery-bundle.min.css"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user