-
-
Notifications
You must be signed in to change notification settings - Fork 370
adding support for UDS proxies #2901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class-list.json | ||
pid |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"$schema": "https://unpkg.com/flowbite-react/schema.json", | ||
"components": [], | ||
"dark": true, | ||
"path": "src/components", | ||
"prefix": "", | ||
"rsc": true, | ||
"tsx": true, | ||
"version": 3 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* eslint-disable */ | ||
// @ts-nocheck | ||
// biome-ignore-all lint: auto-generated file | ||
|
||
// This file is auto-generated by the flowbite-react CLI. | ||
// Do not edit this file directly. | ||
// Instead, edit the .flowbite-react/config.json file. | ||
|
||
import { StoreInit } from "flowbite-react/store/init"; | ||
import React from "react"; | ||
|
||
export const CONFIG = { | ||
dark: true, | ||
prefix: "", | ||
version: 3, | ||
}; | ||
|
||
export function ThemeInit() { | ||
return <StoreInit {...CONFIG} />; | ||
} | ||
|
||
ThemeInit.displayName = "ThemeInit"; |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,97 +1,110 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { Radio, Label, Button, TextInput } from 'flowbite-react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { Radio, Label, Button, TextInput, Card } from 'flowbite-react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { SubmitHandler, useForm } from 'react-hook-form'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { ipcRenderer as ipc } from 'electron'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SETTINGS_STORE_EVENTS, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SettingStore, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} from '@altairgraphql/electron-interop'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { log } from './log'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
export function NetworkSettings() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const initialData = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ipc.sendSync(SETTINGS_STORE_EVENTS.GET_SETTINGS_DATA) || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
console.log(initialData); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const initialData = ipc.sendSync(SETTINGS_STORE_EVENTS.GET_SETTINGS_DATA) || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
log(initialData); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const { register, handleSubmit, watch } = useForm<SettingStore['settings']>({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
defaultValues: initialData, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const onSubmit: SubmitHandler<SettingStore['settings']> = data => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
console.log(data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const onSubmit: SubmitHandler<SettingStore['settings']> = (data) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
log(data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚨 issue (security): Logging submitted settings data may leak sensitive information. Limit logged fields to avoid exposing sensitive data, or remove this log in production. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ipc.sendSync(SETTINGS_STORE_EVENTS.UPDATE_SETTINGS_DATA, data); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ipc.sendSync('from-renderer:restart-app'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="ml-64 p-4"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<form onSubmit={handleSubmit(onSubmit)}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<fieldset className="flex max-w-md flex-col gap-4"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<legend className="mb-4">Configure proxy</legend> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Radio | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
id="proxy-none" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
value="none" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{...register('proxy_setting')} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Label htmlFor="proxy-none">No proxy</Label> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Radio | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
id="proxy-autodetect" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
value="autodetect" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{...register('proxy_setting')} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Label htmlFor="proxy-autodetect">Auto-detect proxy settings</Label> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Radio | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
id="proxy-system" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
value="system" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{...register('proxy_setting')} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Label htmlFor="proxy-system">Use system proxy settings</Label> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Radio id="proxy-pac" value="pac" {...register('proxy_setting')} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Label htmlFor="proxy-pac"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Use automatic configuration script | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</Label> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{watch('proxy_setting') === 'pac' && ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="ml-8 nested"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<TextInput | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type="text" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
placeholder="Address URL" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{...register('pac_address')} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Card> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<form onSubmit={handleSubmit(onSubmit)}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<fieldset className="flex max-w-md flex-col gap-4"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<legend className="mb-4 dark:text-white">Configure proxy</legend> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Radio id="proxy-none" value="none" {...register('proxy_setting')} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Label htmlFor="proxy-none">No proxy</Label> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Radio | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
id="proxy-autodetect" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
value="autodetect" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{...register('proxy_setting')} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Label htmlFor="proxy-autodetect">Auto-detect proxy settings</Label> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Radio | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
id="proxy-system" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
value="system" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{...register('proxy_setting')} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Label htmlFor="proxy-system">Use system proxy settings</Label> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Radio | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
id="proxy-proxyserver" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
value="proxy_server" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{...register('proxy_setting')} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Label htmlFor="proxy-proxyserver"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Use proxy server for connections | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</Label> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{watch('proxy_setting') === 'proxy_server' && ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="ml-8 nested flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<TextInput | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type="text" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
placeholder="Host" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{...register('proxy_host')} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Radio id="proxy-pac" value="pac" {...register('proxy_setting')} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Label htmlFor="proxy-pac">Use automatic configuration script</Label> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{watch('proxy_setting') === 'pac' && ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="ml-8 nested"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<TextInput | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type="text" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
placeholder="Address URL" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{...register('pac_address')} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Radio | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
id="proxy-proxyserver" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
value="proxy_server" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{...register('proxy_setting')} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<TextInput | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type="text" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
placeholder="Port" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{...register('proxy_port')} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Label htmlFor="proxy-proxyserver"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Use proxy server for connections | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</Label> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{watch('proxy_setting') === 'proxy_server' && ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="ml-8 nested flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<TextInput | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type="text" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
placeholder="Host" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{...register('proxy_host')} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<TextInput | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type="text" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
placeholder="Port" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{...register('proxy_port')} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Radio | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
id="proxy-unixsocket" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
value="uds_proxy" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{...register('proxy_setting')} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Label htmlFor="proxy-unixsocket">Use Unix domain socket proxy</Label> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{watch('proxy_setting') === 'uds_proxy' && ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="ml-8 nested flex flex-col gap-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<TextInput | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+93
to
+95
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: Consider validating socket_path input for common path errors. Since users can enter any value, adding validation or warnings for invalid paths (such as those not starting with '/') can help prevent configuration errors.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
type="text" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
placeholder="Socket path (e.g., /var/run/proxy.sock)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{...register('socket_path')} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+91
to
+101
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Validate the Unix socket path before restarting Saving - const { register, handleSubmit, watch } = useForm<SettingStore['settings']>({
- defaultValues: initialData,
- });
+ const {
+ register,
+ handleSubmit,
+ watch,
+ formState: { errors },
+ } = useForm<SettingStore['settings']>({
+ defaultValues: initialData,
+ });
+ const proxySetting = watch('proxy_setting');
@@
- {watch('proxy_setting') === 'uds_proxy' && (
+ {proxySetting === 'uds_proxy' && (
<div className="ml-8 nested flex flex-col gap-2">
<TextInput
type="text"
placeholder="Socket path (e.g., /var/run/proxy.sock)"
- {...register('socket_path')}
+ {...register('socket_path', {
+ validate: (value) =>
+ proxySetting !== 'uds_proxy' || value?.trim()
+ ? true
+ : 'Socket path is required when using a Unix domain socket proxy',
+ })}
/>
+ {errors.socket_path && (
+ <p className="text-sm text-red-600">
+ {errors.socket_path.message}
+ </p>
+ )}
</div>
)} 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Button type="submit">Save and restart</Button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<div className="flex items-center gap-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
<Button type="submit">Save and restart</Button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</fieldset> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</form> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</fieldset> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</form> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</Card> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
</div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const log = (...args: any[]) => { | ||
// eslint-disable-next-line no-console | ||
console.log('[Settings]', ...args); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
const flowbiteReact = require("flowbite-react/plugin/tailwindcss"); | ||
|
||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
content: [ | ||
'./index.html', | ||
'./src/**/*.{js,ts,jsx,tsx}', | ||
'node_modules/flowbite-react/lib/esm/**/*.js', | ||
'../../node_modules/flowbite-react/lib/esm/**/*.js', | ||
".flowbite-react/class-list.json" | ||
], | ||
theme: { | ||
extend: {}, | ||
}, | ||
// plugins: [require('flowbite/plugin')], | ||
}; | ||
plugins: [require('flowbite/plugin'), flowbiteReact], | ||
}; |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,4 +1,4 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { app, protocol, session, shell, dialog } from 'electron'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { app, protocol, shell, dialog } from 'electron'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { readFile } from 'fs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import path from 'path'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import isDev from 'electron-is-dev'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -12,6 +12,7 @@ import { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} from '@altairgraphql/electron-interop'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { error, log } from '../utils/log'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { findCustomProtocolUrlInArgv } from '../utils'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { setupProxy } from '../proxy'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
export class ElectronApp { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
store: InMemoryStore; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -60,39 +61,8 @@ export class ElectronApp { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Some APIs can only be used after this event occurs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
app.whenReady().then(async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const settings = store.get('settings'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
log(settings); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (settings) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
* @type Electron.Config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const proxyConfig: Electron.ProxyConfig = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
mode: 'direct', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
switch (settings.proxy_setting) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case 'none': | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
proxyConfig.mode = 'direct'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
break; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case 'autodetect': | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
proxyConfig.mode = 'auto_detect'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
break; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case 'system': | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
proxyConfig.mode = 'system'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
break; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case 'pac': | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
proxyConfig.mode = 'pac_script'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
proxyConfig.pacScript = settings.pac_address; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
break; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case 'proxy_server': | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
proxyConfig.mode = 'fixed_servers'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
proxyConfig.proxyRules = `${settings.proxy_host}:${settings.proxy_port}`; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
break; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
default: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
await session.defaultSession.setProxy(proxyConfig); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const proxy = await session.defaultSession.resolveProxy('http://localhost'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
log(proxy, proxyConfig); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
await setupProxy(settings); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
63
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handle proxy setup failures to keep the app booting If - await setupProxy(settings);
+ try {
+ await setupProxy(settings);
+ } catch (proxyError) {
+ error('Error setting up proxy', proxyError);
+ dialog.showErrorBox(
+ 'Proxy configuration error',
+ proxyError instanceof Error
+ ? proxyError.message
+ : String(proxyError)
+ );
+ return;
+ } 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
await this.windowManager.createWindow(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} catch (err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify Flowbite React component API compatibility.
The update from flowbite-react ^0.7.2 to ^0.12.9 is a significant version jump. While the learnings indicate no major breaking changes in 0.12.x, ensure all Flowbite React component usage across the codebase is compatible with the new version.
Run the following script to verify all Flowbite React component imports and usage:
Based on learnings
🏁 Script executed:
Length of output: 120
🏁 Script executed:
Length of output: 362
🏁 Script executed:
Length of output: 4105
Update Flowbite-React component API usage
<Tooltip id="…"/>
pattern with the v0.12.x API (e.g.<Tooltip content="…" placement="…">…</Tooltip>
).🤖 Prompt for AI Agents