Fix terminal connections
This commit is contained in:
@@ -17,6 +17,7 @@ import type {
|
|||||||
import { CONNECTION_STATES } from "../../types/index.js";
|
import { CONNECTION_STATES } from "../../types/index.js";
|
||||||
import { tunnelLogger } from "../utils/logger.js";
|
import { tunnelLogger } from "../utils/logger.js";
|
||||||
import { SystemCrypto } from "../utils/system-crypto.js";
|
import { SystemCrypto } from "../utils/system-crypto.js";
|
||||||
|
import { SimpleDBOps } from "../utils/simple-db-ops.js";
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
app.use(
|
app.use(
|
||||||
@@ -490,7 +491,8 @@ async function connectSSHTunnel(
|
|||||||
|
|
||||||
if (tunnelConfig.sourceCredentialId && tunnelConfig.sourceUserId) {
|
if (tunnelConfig.sourceCredentialId && tunnelConfig.sourceUserId) {
|
||||||
try {
|
try {
|
||||||
const credentials = await getDb()
|
const credentials = await SimpleDBOps.select(
|
||||||
|
getDb()
|
||||||
.select()
|
.select()
|
||||||
.from(sshCredentials)
|
.from(sshCredentials)
|
||||||
.where(
|
.where(
|
||||||
@@ -498,6 +500,9 @@ async function connectSSHTunnel(
|
|||||||
eq(sshCredentials.id, tunnelConfig.sourceCredentialId),
|
eq(sshCredentials.id, tunnelConfig.sourceCredentialId),
|
||||||
eq(sshCredentials.userId, tunnelConfig.sourceUserId),
|
eq(sshCredentials.userId, tunnelConfig.sourceUserId),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
"ssh_credentials",
|
||||||
|
tunnelConfig.sourceUserId,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (credentials.length > 0) {
|
if (credentials.length > 0) {
|
||||||
@@ -564,7 +569,8 @@ async function connectSSHTunnel(
|
|||||||
|
|
||||||
if (tunnelConfig.endpointCredentialId && tunnelConfig.endpointUserId) {
|
if (tunnelConfig.endpointCredentialId && tunnelConfig.endpointUserId) {
|
||||||
try {
|
try {
|
||||||
const credentials = await getDb()
|
const credentials = await SimpleDBOps.select(
|
||||||
|
getDb()
|
||||||
.select()
|
.select()
|
||||||
.from(sshCredentials)
|
.from(sshCredentials)
|
||||||
.where(
|
.where(
|
||||||
@@ -572,6 +578,9 @@ async function connectSSHTunnel(
|
|||||||
eq(sshCredentials.id, tunnelConfig.endpointCredentialId),
|
eq(sshCredentials.id, tunnelConfig.endpointCredentialId),
|
||||||
eq(sshCredentials.userId, tunnelConfig.endpointUserId),
|
eq(sshCredentials.userId, tunnelConfig.endpointUserId),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
"ssh_credentials",
|
||||||
|
tunnelConfig.endpointUserId,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (credentials.length > 0) {
|
if (credentials.length > 0) {
|
||||||
@@ -990,7 +999,8 @@ async function killRemoteTunnelByMarker(
|
|||||||
|
|
||||||
if (tunnelConfig.sourceCredentialId && tunnelConfig.sourceUserId) {
|
if (tunnelConfig.sourceCredentialId && tunnelConfig.sourceUserId) {
|
||||||
try {
|
try {
|
||||||
const credentials = await getDb()
|
const credentials = await SimpleDBOps.select(
|
||||||
|
getDb()
|
||||||
.select()
|
.select()
|
||||||
.from(sshCredentials)
|
.from(sshCredentials)
|
||||||
.where(
|
.where(
|
||||||
@@ -998,6 +1008,9 @@ async function killRemoteTunnelByMarker(
|
|||||||
eq(sshCredentials.id, tunnelConfig.sourceCredentialId),
|
eq(sshCredentials.id, tunnelConfig.sourceCredentialId),
|
||||||
eq(sshCredentials.userId, tunnelConfig.sourceUserId),
|
eq(sshCredentials.userId, tunnelConfig.sourceUserId),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
"ssh_credentials",
|
||||||
|
tunnelConfig.sourceUserId,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (credentials.length > 0) {
|
if (credentials.length > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user