mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-05-24 08:22:10 -04:00
use origin instead of url for web
This commit is contained in:
committed by
Oscar Beaumont
parent
0d554e9d06
commit
9966d8eb65
@@ -1,12 +1,14 @@
|
||||
import { createWSClient, loggerLink, splitLink, wsLink } from '@rspc/client';
|
||||
import { createWSClient, loggerLink, wsLink } from '@rspc/client';
|
||||
import { getDebugState, hooks, queryClient } from '@sd/client';
|
||||
import SpacedriveInterface, { Platform, PlatformProvider } from '@sd/interface';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
globalThis.isDev = import.meta.env.DEV;
|
||||
|
||||
const serverOrigin = import.meta.env.VITE_SDSERVER_ORIGIN || 'localhost:8080';
|
||||
|
||||
const wsClient = createWSClient({
|
||||
url: import.meta.env.VITE_SDSERVER_BASE_URL || 'ws://localhost:8080/rspc/ws'
|
||||
url: `ws://${serverOrigin}/rspc/ws`
|
||||
});
|
||||
|
||||
const client = hooks.createClient({
|
||||
@@ -20,11 +22,12 @@ const client = hooks.createClient({
|
||||
]
|
||||
});
|
||||
|
||||
const http = isDev ? 'http' : 'https';
|
||||
|
||||
const platform: Platform = {
|
||||
platform: 'web',
|
||||
getThumbnailUrlById: (casId) =>
|
||||
`${import.meta.env.VITE_SDSERVER_BASE_URL || 'http://localhost:8080'
|
||||
}/spacedrive/thumbnail/${encodeURIComponent(casId)}.webp`,
|
||||
`${http}://${serverOrigin}/spacedrive/thumbnail/${encodeURIComponent(casId)}.webp`,
|
||||
openLink: (url) => window.open(url, '_blank')?.focus(),
|
||||
demoMode: true
|
||||
};
|
||||
|
||||
2
apps/web/src/env.d.ts
vendored
2
apps/web/src/env.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_SDSERVER_BASE_URL: string;
|
||||
readonly VITE_SDSERVER_ORIGIN: string;
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
|
||||
Reference in New Issue
Block a user