Remove serverEndpoint completely and fix upload path (#434)

This commit is contained in:
Alex 2022-08-07 08:12:31 -05:00 committed by GitHub
parent b45024a97e
commit 953d18e795
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 2 additions and 11 deletions

View file

@ -1,4 +1,3 @@
import { serverEndpoint } from '$lib/constants';
import {
AlbumApi,
AssetApi,

View file

@ -4,7 +4,6 @@
import type { ImmichUser } from '$lib/models/immich-user';
import { createEventDispatcher, onMount } from 'svelte';
import { fade, fly, slide } from 'svelte/transition';
import { serverEndpoint } from '../../constants';
import TrayArrowUp from 'svelte-material-icons/TrayArrowUp.svelte';
import { clickOutside } from '../../utils/click-outside';
import { api } from '@api';
@ -131,7 +130,7 @@
>
{#if shouldShowProfileImage}
<img
src={`${serverEndpoint}/user/profile-image/${user.id}`}
src={`api/user/profile-image/${user.id}`}
alt="profile-img"
class="inline rounded-full h-20 w-20 object-cover shadow-md"
/>

View file

@ -1,12 +1,10 @@
<script lang="ts">
import { onDestroy, onMount } from 'svelte';
import { serverEndpoint } from '$lib/constants';
import Cloud from 'svelte-material-icons/Cloud.svelte';
import Dns from 'svelte-material-icons/Dns.svelte';
import LoadingSpinner from './loading-spinner.svelte';
import { api, ServerInfoResponseDto } from '@api';
let endpoint = serverEndpoint;
let isServerOk = true;
let serverVersion = '';
let serverInfo: ServerInfoResponseDto;

View file

@ -1,2 +1 @@
export const serverEndpoint: string = import.meta.env.VITE_SERVER_ENDPOINT;
export const loginPageMessage: string = import.meta.env.VITE_LOGIN_PAGE_MESSAGE;

View file

@ -1,12 +1,9 @@
import { Socket, io } from 'socket.io-client';
import { writable } from 'svelte/store';
import { serverEndpoint } from '../constants';
let websocket: Socket;
export const openWebsocketConnection = () => {
const websocketEndpoint = serverEndpoint.replace('/api', '');
try {
websocket = io('', {
path: '/api/socket.io',

View file

@ -1,6 +1,5 @@
/* @vite-ignore */
import * as exifr from 'exifr';
import { serverEndpoint } from '../constants';
import { uploadAssetsStore } from '$lib/stores/upload';
import type { UploadAsset } from '../models/upload-asset';
import { api, AssetFileUploadResponseDto } from '@api';
@ -168,7 +167,7 @@ async function fileUploader(asset: File, uploadType: UploadType) {
uploadAssetsStore.updateProgress(deviceAssetId, percentComplete);
};
request.open('POST', `api/asset/upload`);
request.open('POST', `/api/asset/upload`);
request.send(formData);
} catch (e) {