Fix #6 stream video requests by range

This commit is contained in:
Alan Grainger
2024-11-10 21:00:41 +01:00
parent 2268d8a51b
commit 8a75d7d677
5 changed files with 49 additions and 12 deletions
+6 -2
View File
@@ -12,7 +12,7 @@ class Immich {
*/
async request (endpoint: string) {
try {
const res = await fetch(process.env.IMMICH_URL + '/api' + endpoint)
const res = await fetch(this.apiUrl() + endpoint)
if (res.status === 200) {
const contentType = res.headers.get('Content-Type') || ''
if (contentType.includes('application/json')) {
@@ -29,6 +29,10 @@ class Immich {
}
}
apiUrl () {
return process.env.IMMICH_URL + '/api'
}
/**
* Handle an incoming request for a shared link `key`. This is the main function which
* communicates with Immich and returns the output back to the visitor.
@@ -72,7 +76,7 @@ class Immich {
const asset = link.assets[0]
if (asset.type === AssetType.image && !getConfigOption('ipp.singleImageGallery')) {
// For photos, output the image directly unless configured to show a gallery
await render.assetBuffer(res, link.assets[0], request.size)
await render.assetBuffer(request, res, link.assets[0], request.size)
} else {
// Show a gallery page
const openItem = getConfigOption('ipp.singleItemAutoOpen', true) ? 1 : 0