Allow desktop app to connect to selfhosted servers (#4902)

# Description of Changes
Changes the desktop app to allow connections to self-hosted servers on
first startup. This was quite involved and hit loads of CORS issues all
through the stack, but I think it's working now. This also changes the
bundled backend to spawn on an OS-decided port rather than always
spawning on `8080`, which means that the user can have other things
running on port `8080` now and the app will still work fine. There were
quite a few places that needed to be updated to decouple the app from
explicitly using `8080` and I was originally going to split those
changes out into another PR (#4939), but I couldn't get it working
independently in the time I had, so the diff here is just going to be
complex and contian two distinct changes - sorry 🙁
This commit is contained in:
James Brunton
2025-11-20 10:03:34 +00:00
committed by GitHub
parent 75414b89f9
commit f4725b98b0
43 changed files with 3209 additions and 218 deletions
+79 -44
View File
@@ -2,52 +2,87 @@ import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react-swc';
import tsconfigPaths from 'vite-tsconfig-paths';
export default defineConfig((configEnv) => {
const isProprietary = process.env.DISABLE_ADDITIONAL_FEATURES !== 'true';
const isDesktopMode =
configEnv.mode === 'desktop' ||
process.env.STIRLING_DESKTOP === 'true' ||
process.env.VITE_DESKTOP === 'true';
const baseProject = isProprietary ? './tsconfig.proprietary.json' : './tsconfig.core.json';
const desktopProject = isProprietary ? './tsconfig.desktop.json' : baseProject;
const tsconfigProject = isDesktopMode ? desktopProject : baseProject;
return {
plugins: [
react(),
tsconfigPaths({
projects: [tsconfigProject],
}),
export default defineConfig({
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./src/core/setupTests.ts'],
css: false,
exclude: [
'node_modules/',
'src/**/*.spec.ts', // Exclude Playwright E2E tests
'src/tests/test-fixtures/**'
],
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./src/core/setupTests.ts'],
css: false, // Disable CSS processing to speed up tests
include: [
'src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'
],
testTimeout: 10000,
hookTimeout: 10000,
coverage: {
reporter: ['text', 'json', 'html'],
exclude: [
'node_modules/',
'src/**/*.spec.ts', // Exclude Playwright E2E tests
'src/tests/test-fixtures/**'
],
testTimeout: 10000, // 10 second timeout
hookTimeout: 10000, // 10 second timeout for setup/teardown
coverage: {
reporter: ['text', 'json', 'html'],
exclude: [
'node_modules/',
'src/core/setupTests.ts',
'**/*.d.ts',
'src/tests/test-fixtures/**',
'src/**/*.spec.ts' // Exclude Playwright files from coverage
]
}
'src/core/setupTests.ts',
'**/*.d.ts',
'src/tests/test-fixtures/**',
'src/**/*.spec.ts'
]
},
esbuild: {
target: 'es2020' // Use older target to avoid warnings
}
};
projects: [
{
test: {
name: 'core',
include: ['src/core/**/*.test.{ts,tsx}'],
environment: 'jsdom',
globals: true,
setupFiles: ['./src/core/setupTests.ts'],
},
plugins: [
react(),
tsconfigPaths({
projects: ['./tsconfig.core.json'],
}),
],
esbuild: {
target: 'es2020'
}
},
{
test: {
name: 'proprietary',
include: ['src/proprietary/**/*.test.{ts,tsx}'],
environment: 'jsdom',
globals: true,
setupFiles: ['./src/core/setupTests.ts'],
},
plugins: [
react(),
tsconfigPaths({
projects: ['./tsconfig.proprietary.json'],
}),
],
esbuild: {
target: 'es2020'
}
},
{
test: {
name: 'desktop',
include: ['src/desktop/**/*.test.{ts,tsx}'],
environment: 'jsdom',
globals: true,
setupFiles: ['./src/core/setupTests.ts'],
},
plugins: [
react(),
tsconfigPaths({
projects: ['./tsconfig.desktop.json'],
}),
],
esbuild: {
target: 'es2020'
}
},
],
},
esbuild: {
target: 'es2020'
}
});