Skip to content

High performance self-hosted photo and video management solution.

Fixed issue socket-io cannot be connected in production build on web

Alex Tranc4247bfea387
diff --git a/server/apps/immich/src/api-v1/asset/asset.service.ts b/server/apps/immich/src/api-v1/asset/asset.service.ts
index 5e7f761738..bd20115f90 100644
--- a/server/apps/immich/src/api-v1/asset/asset.service.ts
+++ b/server/apps/immich/src/api-v1/asset/asset.service.ts
@@ -244,7 +244,7 @@ export class AssetService {
}
/** Sending Partial Content With HTTP Code 206 */
-
+ console.log('send partial', end - start + 1);
res.status(206).set({
'Content-Range': `bytes ${start}-${end}/${size}`,
'Accept-Ranges': 'bytes',
diff --git a/web/src/lib/components/asset-viewer/immich-thumbnail.svelte b/web/src/lib/components/asset-viewer/immich-thumbnail.svelte
index d7fa9ac04c..04fc4a54ab 100644
--- a/web/src/lib/components/asset-viewer/immich-thumbnail.svelte
+++ b/web/src/lib/components/asset-viewer/immich-thumbnail.svelte
@@ -45,26 +45,32 @@
const loadVideoData = async () => {
isThumbnailVideoPlaying = false;
const videoUrl = `/asset/file?aid=${asset.deviceAssetId}&did=${asset.deviceId}&isWeb=true`;
+
if ($session.user) {
try {
const res = await fetch(serverEndpoint + videoUrl, {
method: 'GET',
headers: {
Authorization: 'bearer ' + $session.user.accessToken,
+ 'Accept-Range': 'bytes',
},
});
videoData = URL.createObjectURL(await res.blob());
+
videoPlayerNode.src = videoData;
+ // videoPlayerNode.src = videoData + '#t=0,5';
videoPlayerNode.load();
videoPlayerNode.onloadeddata = () => {
console.log('first frame load');
};
+
videoPlayerNode.oncanplaythrough = () => {
console.log('can play through');
};
+
videoPlayerNode.oncanplay = () => {
console.log('can play');
videoPlayerNode.muted = true;
diff --git a/web/svelte.config.js b/web/svelte.config.js
index 36077842ab..e52d5163f5 100644
--- a/web/svelte.config.js
+++ b/web/svelte.config.js
@@ -10,6 +10,13 @@ const config = {
methodOverride: {
allowed: ['PATCH', 'DELETE'],
},
+ vite: {
+ resolve: {
+ alias: {
+ 'xmlhttprequest-ssl': './node_modules/engine.io-client/lib/xmlhttprequest.js',
+ },
+ },
+ },
},
};