mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 08:01:35 +00:00
3c3c03455d
- Login.svelte: poll whoami after popup opens as a safety net for Safari
ITP — when the popup is opened without a fresh user gesture, cookies
and localStorage can be partitioned, leaving the existing postMessage
/ storage signaling unable to reach the parent. Polling is independent
of partitioning since it runs in the parent's own session. An
oauthFlowDone flag guards the three terminal paths (postMessage,
storage, poll) so onLoginSuccess fires exactly once. Adds compact
"oauth: signaled via {postMessage|storage|poll}" diagnostic logs.
- routes/user/login_callback/[client_name]/+page.svelte: replace `??`
with `||` on the cookie/localStorage fallback. The cookie check
returns a boolean, so `??` never fell through and the localStorage
branch was dead code.
- InstanceSettings.svelte: per-category save/discard for the
Auth/OAuth/SAML tab now sees auto_login_provider and
disable_password_login. getSettingsForCategory was returning only
scimSamlSetting for that tab, leaving the dirty check and per-category
save unable to detect changes to those fields.
- vite.config.js: drop a stale personal dev hostname from allowedHosts.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
131 lines
3.4 KiB
JavaScript
131 lines
3.4 KiB
JavaScript
import { sveltekit } from '@sveltejs/kit/vite'
|
|
import { readFileSync } from 'fs'
|
|
import { fileURLToPath } from 'url'
|
|
import mkcert from 'vite-plugin-mkcert'
|
|
|
|
const file = fileURLToPath(new URL('package.json', import.meta.url))
|
|
const json = readFileSync(file, 'utf8')
|
|
const version = JSON.parse(json)
|
|
|
|
const remoteUrl =
|
|
process.env.REMOTE ??
|
|
(process.env.BACKEND_PORT
|
|
? `http://localhost:${process.env.BACKEND_PORT}`
|
|
: 'https://app.windmill.dev/')
|
|
|
|
let plugin = {
|
|
name: 'configure-response-headers',
|
|
configureServer: (server) => {
|
|
server.middlewares.use((_req, res, next) => {
|
|
res.setHeader('Cross-Origin-Opener-Policy', 'same-origin')
|
|
res.setHeader('Cross-Origin-Embedder-Policy', 'require-corp')
|
|
next()
|
|
})
|
|
}
|
|
}
|
|
|
|
/** @type {import('vite').UserConfig} */
|
|
const config = {
|
|
server: {
|
|
https: process.env.HTTPS === 'true',
|
|
allowedHosts: [
|
|
'localhost',
|
|
'127.0.0.1',
|
|
'0.0.0.0',
|
|
'rubendev.wimill.xyz',
|
|
'windmill.xyz',
|
|
'app.windmill.xyz',
|
|
'public.windmill.xyz'
|
|
],
|
|
port: parseInt(process.env.FRONTEND_PORT) || 3000,
|
|
cors: { origin: '*' },
|
|
proxy: {
|
|
'^/\\.well-known/.*': {
|
|
target: remoteUrl,
|
|
changeOrigin: true,
|
|
cookieDomainRewrite: 'localhost'
|
|
},
|
|
'^/api/w/[^/]+/s3_proxy/.*': {
|
|
target: remoteUrl,
|
|
changeOrigin: false, // Important for signature to be correct
|
|
cookieDomainRewrite: 'localhost',
|
|
configure: (proxy, options) => {
|
|
proxy.on('proxyReq', (proxyReq, req, res) => {
|
|
// Prevent collapsing slashes during URL normalization
|
|
const originalPath = req.url
|
|
|
|
proxyReq.path = originalPath
|
|
})
|
|
}
|
|
},
|
|
'^/api/.*': {
|
|
target: remoteUrl,
|
|
changeOrigin: true,
|
|
cookieDomainRewrite: 'localhost'
|
|
},
|
|
'^/ws/.*': {
|
|
target: process.env.REMOTE_LSP ?? process.env.REMOTE_EXTRA ?? 'https://app.windmill.dev',
|
|
changeOrigin: true,
|
|
ws: true
|
|
},
|
|
'^/ws_mp/.*': {
|
|
target: process.env.REMOTE_MP ?? process.env.REMOTE_EXTRA ?? 'https://app.windmill.dev',
|
|
changeOrigin: true,
|
|
ws: true
|
|
},
|
|
'^/ws_debug/.*': {
|
|
target: process.env.REMOTE_DEBUG ?? process.env.REMOTE_EXTRA ?? 'https://app.windmill.dev',
|
|
changeOrigin: true,
|
|
ws: true
|
|
},
|
|
'^/ui_builder/.*': {
|
|
target: 'http://localhost:4000',
|
|
changeOrigin: true,
|
|
headers: {
|
|
'Cross-Origin-Opener-Policy': 'same-origin',
|
|
'Cross-Origin-Embedder-Policy': 'require-corp',
|
|
'Cross-Origin-Resource-Policy': 'cross-origin'
|
|
}
|
|
}
|
|
}
|
|
},
|
|
preview: { port: 3001 },
|
|
plugins: [sveltekit(), ...(process.env.HTTPS === 'true' ? [mkcert()] : []), plugin],
|
|
define: { __pkg__: version },
|
|
optimizeDeps: {
|
|
include: ['highlight.js', 'highlight.js/lib/core', 'monaco-vim'],
|
|
exclude: [
|
|
'@codingame/monaco-vscode-standalone-typescript-language-features',
|
|
'@codingame/monaco-vscode-standalone-languages',
|
|
'windmill-client'
|
|
]
|
|
},
|
|
worker: { format: 'es' },
|
|
resolve: {
|
|
alias: {
|
|
path: 'path-browserify',
|
|
'monaco-editor/esm/vs/editor/contrib/hover/browser/hover':
|
|
'monaco-editor/esm/vs/editor/contrib/hover/browser/hoverContribution'
|
|
},
|
|
dedupe: ['vscode', 'monaco-editor']
|
|
},
|
|
assetsInclude: ['**/*.wasm'],
|
|
test: {
|
|
expect: { requireAssertions: true },
|
|
projects: [
|
|
{
|
|
extends: './vite.config.js',
|
|
test: {
|
|
name: 'server',
|
|
environment: 'node',
|
|
include: ['src/**/*.{test,spec}.{js,ts}'],
|
|
exclude: ['src/**/*.svelte.{test,spec}.{js,ts}'],
|
|
setupFiles: ['src/lib/test-setup.ts']
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
|
|
export default config
|