diff --git a/electron/connection-pool.ts b/electron/connection-pool.ts index c0ce7ad..e80f67c 100644 --- a/electron/connection-pool.ts +++ b/electron/connection-pool.ts @@ -22,6 +22,7 @@ export class ConnectionPool { user: conn.config.username || "root", password: conn.config.password || "", database: conn.config.database || "", + ssl: conn.config.ssl ? { rejectUnauthorized: false } : undefined, }); break; case "sqlite": @@ -56,6 +57,11 @@ export class ConnectionPool { database: conn.config.database || "postgres", password: conn.config.password || "", port: Number(conn.config.port || "5432"), + ssl: conn.config.ssl + ? { + rejectUnauthorized: false, + } + : undefined, }); break; default: diff --git a/electron/drivers/mysql.ts b/electron/drivers/mysql.ts index 826cea3..4a47713 100644 --- a/electron/drivers/mysql.ts +++ b/electron/drivers/mysql.ts @@ -1,5 +1,5 @@ import BaseDriver, { ColumnType, Result, ResultHeader } from "./base"; -import { Pool, PoolConnection, createPool } from "mysql2/promise"; +import { Pool, PoolConnection, SslOptions, createPool } from "mysql2/promise"; enum MySQLType { MYSQL_TYPE_DECIMAL, @@ -114,6 +114,7 @@ export interface MySqlConnectionConfig { password: string; host: string; port: number; + ssl?: SslOptions; } export default class MySQLDriver implements BaseDriver { diff --git a/electron/drivers/postgres.ts b/electron/drivers/postgres.ts index a0b480d..9e6face 100644 --- a/electron/drivers/postgres.ts +++ b/electron/drivers/postgres.ts @@ -7,6 +7,7 @@ export default class PostgresDriver extends BaseDriver { constructor(config: ConnectionConfig) { super(); + console.log("Connecting to Postgres", config); this.db = new pg.Pool(config); } diff --git a/package-lock.json b/package-lock.json index 50ccd9a..41552a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,18 +1,19 @@ { "name": "outerbase-studio-desktop", - "version": "0.1.0", + "version": "0.1.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "outerbase-studio-desktop", - "version": "0.1.0", + "version": "0.1.6", "dependencies": { "@dnd-kit/core": "^6.2.0", "@dnd-kit/sortable": "^9.0.0", "@electron/notarize": "^2.5.0", "@libsql/client": "^0.14.0", "@radix-ui/react-alert-dialog": "^1.1.2", + "@radix-ui/react-checkbox": "^1.1.2", "@radix-ui/react-dropdown-menu": "^2.1.2", "@radix-ui/react-label": "^2.1.0", "@radix-ui/react-select": "^2.1.2", @@ -1804,6 +1805,36 @@ } } }, + "node_modules/@radix-ui/react-checkbox": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@radix-ui/react-checkbox/-/react-checkbox-1.1.2.tgz", + "integrity": "sha512-/i0fl686zaJbDQLNKrkCbMyDm6FQMt4jg323k7HuqitoANm9sE23Ql8yOK3Wusk34HSLKDChhMux05FnP6KUkw==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.1.0", + "@radix-ui/react-compose-refs": "1.1.0", + "@radix-ui/react-context": "1.1.1", + "@radix-ui/react-presence": "1.1.1", + "@radix-ui/react-primitive": "2.0.0", + "@radix-ui/react-use-controllable-state": "1.1.0", + "@radix-ui/react-use-previous": "1.1.0", + "@radix-ui/react-use-size": "1.1.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-collection": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.1.0.tgz", diff --git a/package.json b/package.json index 6863a66..b172aec 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@electron/notarize": "^2.5.0", "@libsql/client": "^0.14.0", "@radix-ui/react-alert-dialog": "^1.1.2", + "@radix-ui/react-checkbox": "^1.1.2", "@radix-ui/react-dropdown-menu": "^2.1.2", "@radix-ui/react-label": "^2.1.0", "@radix-ui/react-select": "^2.1.2", diff --git a/src/components/ui/checkbox.tsx b/src/components/ui/checkbox.tsx new file mode 100644 index 0000000..0a6a9a5 --- /dev/null +++ b/src/components/ui/checkbox.tsx @@ -0,0 +1,28 @@ +import * as React from "react" +import * as CheckboxPrimitive from "@radix-ui/react-checkbox" +import { Check } from "lucide-react" + +import { cn } from "@/lib/utils" + +const Checkbox = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + + + + + +)) +Checkbox.displayName = CheckboxPrimitive.Root.displayName + +export { Checkbox } diff --git a/src/database/editor.tsx b/src/database/editor.tsx index 7fd2abb..9673510 100644 --- a/src/database/editor.tsx +++ b/src/database/editor.tsx @@ -1,16 +1,18 @@ import FileInput from "@/components/file-input"; import InputGroup from "@/components/input-group"; +import { Checkbox } from "@/components/ui/checkbox"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import { ConnectionStoreItem } from "@/lib/conn-manager-store"; +import { cn } from "@/lib/utils"; import type { OpenDialogOptions } from "electron"; import { produce } from "immer"; interface ConnectionEditorTemplateItem { name: keyof ConnectionStoreItem["config"]; label: string; - type: "text" | "password" | "file" | "textarea"; + type: "text" | "password" | "file" | "textarea" | "checkbox"; placeholder?: string; size?: string; required?: boolean; @@ -62,11 +64,11 @@ export default function ConnectionEditor({ { onChange( produce(value, (draft) => { - draft.config[item.name] = filePath; + draft.config[item.name] = filePath as never; }), ); }} @@ -80,17 +82,45 @@ export default function ConnectionEditor({