17 files changed
+285
-99
No files matched your search
@@ -44,6 +44,7 @@ import type { NacosAdminConfig, NacosApiPlane, NacosAuthConfig, NacosImplementat
|
||||
import { CONNECTION_ATTEMPT_CANCELLED_MESSAGE, useConnectionStore } from "@/stores/connectionStore";
|
||||
import { useTunnelProfileStore } from "@/stores/tunnelProfileStore";
|
||||
import { detachTunnelProfileLayer, tunnelProfileReferenceLayer, tunnelProfileSummary } from "@/lib/connection/tunnelProfiles";
|
||||
import { insertSqliteRemoteTransportLayer, isSqliteRemoteTransportLayerType, sqliteRemoteTransportError } from "@/lib/connection/sqliteRemoteTransport";
|
||||
import { sanitizeConnectionCredentials } from "@/lib/connection/credentialSanitizer";
|
||||
import { applySshAuthMethod, inferSshAuthMethod } from "@/lib/connection/sshAuthMethod";
|
||||
import { applySshConfigHostAliasPrefill as prefillSshConfigHostAlias } from "@/lib/connection/sshConfigHosts";
|
||||
@@ -3301,8 +3302,8 @@ const selectedHttpTunnelLayer = computed(() => (selectedTransportLayer.value?.ty
|
||||
|
||||
const tunnelProfiles = computed(() => {
|
||||
const profiles = tunnelProfileStore.profiles;
|
||||
if (!sqliteSshOnlyTransport.value) return profiles;
|
||||
return profiles.filter((profile) => profile.type === "ssh");
|
||||
if (!sqliteRemoteTransportRestricted.value) return profiles;
|
||||
return profiles.filter((profile) => isSqliteRemoteTransportLayerType(profile.type));
|
||||
});
|
||||
const selectedLayerProfileId = computed(() => selectedTransportLayer.value?.profile_id || "");
|
||||
const selectedLayerProfile = computed(() => tunnelProfileStore.profileById(selectedLayerProfileId.value));
|
||||
@@ -3792,7 +3793,7 @@ const canUseTransportLayers = computed(() => {
|
||||
}
|
||||
return true;
|
||||
});
|
||||
const sqliteSshOnlyTransport = computed(() => form.value.db_type === "sqlite");
|
||||
const sqliteRemoteTransportRestricted = computed(() => form.value.db_type === "sqlite");
|
||||
const sqliteUsesSsh = computed(() => form.value.db_type === "sqlite" && connectionUsesSsh(form.value));
|
||||
const sqliteWorkerPlacement = computed({
|
||||
get: () => getUrlParam(form.value.url_params, "dbx_sqlite_worker") || "session",
|
||||
@@ -6149,10 +6150,10 @@ watch(canUseTransportLayers, (value) => {
|
||||
}
|
||||
});
|
||||
|
||||
watch(sqliteSshOnlyTransport, (sshOnly) => {
|
||||
if (!sshOnly) return;
|
||||
watch(sqliteRemoteTransportRestricted, (restricted) => {
|
||||
if (!restricted) return;
|
||||
const layers = form.value.transport_layers || [];
|
||||
const next = layers.filter((layer) => layer.type === "ssh");
|
||||
const next = layers.filter((layer) => isSqliteRemoteTransportLayerType(layer.type));
|
||||
if (next.length === layers.length) return;
|
||||
form.value.transport_layers = next;
|
||||
selectedTransportLayerId.value = next[0]?.id || null;
|
||||
@@ -6179,16 +6180,15 @@ function addSshTunnel() {
|
||||
}
|
||||
|
||||
function addProxyTunnel() {
|
||||
if (sqliteSshOnlyTransport.value) return;
|
||||
const next: TransportLayerConfig = { type: "proxy", ...defaultProxyTunnel() };
|
||||
next.name = `Proxy ${transportLayers.value.length + 1}`;
|
||||
form.value.transport_layers = [...transportLayers.value, next];
|
||||
form.value.transport_layers = sqliteRemoteTransportRestricted.value ? insertSqliteRemoteTransportLayer(transportLayers.value, next) : [...transportLayers.value, next];
|
||||
selectedTransportLayerId.value = next.id;
|
||||
resetTestState();
|
||||
}
|
||||
|
||||
function addHttpTunnel() {
|
||||
if (sqliteSshOnlyTransport.value) return;
|
||||
if (sqliteRemoteTransportRestricted.value) return;
|
||||
const next: TransportLayerConfig = { type: "http_tunnel", ...defaultHttpTunnel() };
|
||||
next.name = t("connection.httpTunnelDefaultName", { index: 1 });
|
||||
form.value.transport_layers = [next, ...transportLayers.value];
|
||||
@@ -6197,9 +6197,9 @@ function addHttpTunnel() {
|
||||
}
|
||||
|
||||
function duplicateTransportLayer(layer: TransportLayerConfig) {
|
||||
if (sqliteSshOnlyTransport.value && layer.type !== "ssh") return;
|
||||
if (sqliteRemoteTransportRestricted.value && !isSqliteRemoteTransportLayerType(layer.type)) return;
|
||||
const next = normalizeTransportLayer({ ...layer, id: uuid(), name: layer.name ? `${layer.name} copy` : "" });
|
||||
form.value.transport_layers = [...transportLayers.value, next];
|
||||
form.value.transport_layers = sqliteRemoteTransportRestricted.value ? insertSqliteRemoteTransportLayer(transportLayers.value, next) : [...transportLayers.value, next];
|
||||
selectedTransportLayerId.value = next.id;
|
||||
resetTestState();
|
||||
}
|
||||
@@ -6237,7 +6237,7 @@ function dropTransportLayer(targetId: string) {
|
||||
function changeSelectedTransportLayerType(type: "ssh" | "proxy" | "http_tunnel") {
|
||||
const selected = selectedTransportLayer.value;
|
||||
if (!selected || selected.type === type) return;
|
||||
if (sqliteSshOnlyTransport.value && type !== "ssh") return;
|
||||
if (sqliteRemoteTransportRestricted.value && !isSqliteRemoteTransportLayerType(type)) return;
|
||||
const replacement: TransportLayerConfig =
|
||||
type === "proxy" ? { type: "proxy", ...defaultProxyTunnel(), id: selected.id, name: selected.name } : type === "http_tunnel" ? { type: "http_tunnel", ...defaultHttpTunnel(), id: selected.id, name: selected.name } : { type: "ssh", ...defaultSshTunnel(), id: selected.id, name: selected.name };
|
||||
form.value.transport_layers = transportLayers.value.map((layer) => (layer.id === selected.id ? replacement : layer));
|
||||
@@ -6260,7 +6260,7 @@ function updateSelectedSshAuthMethod(value: unknown) {
|
||||
|
||||
function validateTransportLayers(config: LegacyConnectionConfig) {
|
||||
const layers = config.transport_layers || [];
|
||||
if (config.db_type === "sqlite" && layers.some((layer) => layer.enabled !== false && layer.type !== "ssh")) {
|
||||
if (config.db_type === "sqlite" && sqliteRemoteTransportError(layers)) {
|
||||
throw new Error(t("connection.sqliteTransportSshOnly"));
|
||||
}
|
||||
layers.forEach((layer, index) => {
|
||||
@@ -9994,11 +9994,11 @@ function openExternalUrl(url: string) {
|
||||
<Plus class="mr-1.5 h-3.5 w-3.5" />
|
||||
{{ t("connection.sshHopAdd") }}
|
||||
</Button>
|
||||
<Button v-if="!sqliteSshOnlyTransport" type="button" variant="outline" size="sm" @click="addProxyTunnel">
|
||||
<Button type="button" variant="outline" size="sm" @click="addProxyTunnel">
|
||||
<Plus class="mr-1.5 h-3.5 w-3.5" />
|
||||
{{ t("connection.proxy") }}
|
||||
</Button>
|
||||
<Button v-if="!sqliteSshOnlyTransport" type="button" variant="outline" size="sm" @click="addHttpTunnel">
|
||||
<Button v-if="!sqliteRemoteTransportRestricted" type="button" variant="outline" size="sm" @click="addHttpTunnel">
|
||||
<Plus class="mr-1.5 h-3.5 w-3.5" />
|
||||
{{ t("connection.httpTunnelAdd") }}
|
||||
</Button>
|
||||
@@ -10047,7 +10047,7 @@ function openExternalUrl(url: string) {
|
||||
<span v-else class="text-red-500">{{ t("connection.tunnelProfileMissing") }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!selectedLayerProfileId && !sqliteSshOnlyTransport" class="grid grid-cols-4 items-center gap-4">
|
||||
<div v-if="!selectedLayerProfileId" class="grid grid-cols-4 items-center gap-4">
|
||||
<Label :class="connectionLabelSmallClass">Type</Label>
|
||||
<Select :model-value="selectedTransportLayer.type" @update:model-value="(value: any) => changeSelectedTransportLayerType(value)">
|
||||
<SelectTrigger class="col-span-3 h-9">
|
||||
@@ -10056,7 +10056,7 @@ function openExternalUrl(url: string) {
|
||||
<SelectContent>
|
||||
<SelectItem value="ssh">SSH</SelectItem>
|
||||
<SelectItem value="proxy">Proxy</SelectItem>
|
||||
<SelectItem value="http_tunnel">{{ t("connection.httpTunnel") }}</SelectItem>
|
||||
<SelectItem v-if="!sqliteRemoteTransportRestricted" value="http_tunnel">{{ t("connection.httpTunnel") }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user