Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/api/src/app/api/auth/desktop/connect/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export async function GET(request: Request) {
const url = new URL(request.url);
const provider = url.searchParams.get("provider");
const state = url.searchParams.get("state");
const protocol = url.searchParams.get("protocol") || "superset";

if (!provider || !state) {
return new Response("Missing provider or state", { status: 400 });
Expand All @@ -18,6 +19,7 @@ export async function GET(request: Request) {

const successUrl = new URL(`${env.NEXT_PUBLIC_WEB_URL}/auth/desktop/success`);
successUrl.searchParams.set("desktop_state", state);
successUrl.searchParams.set("protocol", protocol);

const result = await auth.api.signInSocial({
body: {
Expand Down
15 changes: 15 additions & 0 deletions apps/desktop/electron-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ const config: Configuration = {
"**/node_modules/bindings/**/*",
"**/node_modules/file-uri-to-path/**/*",
"**/node_modules/node-pty/**/*",
// ssh2 has native crypto module for SSH connections
"**/node_modules/ssh2/**/*",
"**/node_modules/cpu-features/**/*",
// Sound files must be unpacked so external audio players (afplay, paplay, etc.) can access them
"**/resources/sounds/**/*",
],
Expand Down Expand Up @@ -90,6 +93,18 @@ const config: Configuration = {
to: "node_modules/node-pty",
filter: ["**/*"],
},
// ssh2 for SSH remote connections
{
from: "node_modules/ssh2",
to: "node_modules/ssh2",
filter: ["**/*"],
},
// cpu-features is a dependency of ssh2
{
from: "node_modules/cpu-features",
to: "node_modules/cpu-features",
filter: ["**/*"],
},
"!**/.DS_Store",
],

Expand Down
1 change: 1 addition & 0 deletions apps/desktop/electron.vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export default defineConfig({
"electron",
"better-sqlite3",
"node-pty",
"ssh2",
/^@sentry\/electron/,
],
},
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"semver": "^7.7.3",
"shell-quote": "^1.8.3",
"simple-git": "^3.30.0",
"ssh2": "^1.16.0",
"strip-ansi": "^7.1.2",
"superjson": "^2.2.5",
"tailwind-merge": "^3.4.0",
Expand All @@ -145,6 +146,7 @@
"@types/react-syntax-highlighter": "^15.5.13",
"@types/semver": "^7.7.1",
"@types/shell-quote": "^1.7.5",
"@types/ssh2": "^1.15.4",
"@vitejs/plugin-react": "^5.0.1",
"bun-types": "^1.3.1",
"code-inspector-plugin": "^1.2.2",
Expand Down
8 changes: 6 additions & 2 deletions apps/desktop/scripts/copy-native-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ import { cpSync, existsSync, lstatSync, realpathSync, rmSync } from "node:fs";
import { dirname, join } from "node:path";

// Native modules that must exist for the app to work
const NATIVE_MODULES = ["better-sqlite3", "node-pty"] as const;
const NATIVE_MODULES = ["better-sqlite3", "node-pty", "ssh2"] as const;

// Dependencies of native modules that need to be copied (may be hoisted or symlinked)
const NATIVE_MODULE_DEPS = ["bindings", "file-uri-to-path"] as const;
const NATIVE_MODULE_DEPS = [
"bindings",
"file-uri-to-path",
"cpu-features",
] as const;

function copyModuleIfSymlink(
nodeModulesDir: string,
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop/src/lib/trpc/routers/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { AUTH_PROVIDERS } from "@superset/shared/constants";
import { observable } from "@trpc/server/observable";
import { shell } from "electron";
import { env } from "main/env.main";
import { PROTOCOL_SCHEME } from "shared/constants";
import { z } from "zod";
import { publicProcedure, router } from "../..";
import {
Expand Down Expand Up @@ -72,6 +73,7 @@ export const createAuthRouter = () => {
);
connectUrl.searchParams.set("provider", input.provider);
connectUrl.searchParams.set("state", state);
connectUrl.searchParams.set("protocol", PROTOCOL_SCHEME);
await shell.openExternal(connectUrl.toString());
return { success: true };
} catch (err) {
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop/src/lib/trpc/routers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { createPortsRouter } from "./ports";
import { createProjectsRouter } from "./projects";
import { createRingtoneRouter } from "./ringtone";
import { createSettingsRouter } from "./settings";
import { createSSHRouter } from "./ssh";
import { createTerminalRouter } from "./terminal";
import { createUiStateRouter } from "./ui-state";
import { createWindowRouter } from "./window";
Expand All @@ -39,6 +40,7 @@ export const createAppRouter = (getWindow: () => BrowserWindow | null) => {
config: createConfigRouter(),
uiState: createUiStateRouter(),
ringtone: createRingtoneRouter(),
ssh: createSSHRouter(),
});
};

Expand Down
Loading