mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 06:35:24 +00:00
chore: lock the plugin boundary and remove 2.9.0 leftovers
This commit is contained in:
1 parent
6489b62ece
commit
2961297989
399 files changed
+3964
-5627
No files matched your search
@@ -17,8 +17,8 @@ import {
|
||||
SelectValue,
|
||||
SettingRow,
|
||||
} from "@termix/plugin-sdk/ui";
|
||||
import { resolveConnectionOrigin } from "@/lib/connection-origin";
|
||||
import { isElectron } from "@/lib/electron";
|
||||
import { resolveConnectionOrigin } from "@termix/plugin-sdk/ui";
|
||||
import { isElectron } from "@termix/plugin-sdk/ui";
|
||||
import {
|
||||
MAX_WEB_ENDPOINTS,
|
||||
MAX_WEB_ENDPOINT_LABEL_LENGTH,
|
||||
|
||||
@@ -14,10 +14,10 @@ import {
|
||||
openWebEndpointTunnel,
|
||||
requireNumericHostId,
|
||||
} from "./web-endpoint-api";
|
||||
import { copyToClipboard } from "@/lib/clipboard";
|
||||
import { isElectron } from "@/lib/electron";
|
||||
import { Button } from "@/components/button";
|
||||
import type { Host } from "@/types/ui-types";
|
||||
import { copyToClipboard } from "@termix/plugin-sdk/ui";
|
||||
import { isElectron } from "@termix/plugin-sdk/ui";
|
||||
import { Button } from "@termix/plugin-sdk/ui";
|
||||
import type { PluginHostRecord as Host } from "@termix/plugin-sdk/frontend";
|
||||
import type { WebEndpoint } from "../shared/web-endpoint-config";
|
||||
|
||||
const REFUSAL_MESSAGES: Record<WebEndpointRefusalReason, string> = {
|
||||
|
||||
@@ -8,7 +8,7 @@ import type {
|
||||
TabProps,
|
||||
TermixApp,
|
||||
} from "@termix/plugin-sdk/frontend";
|
||||
import type { Host } from "@/types/ui-types";
|
||||
import type { PluginHostRecord as Host } from "@termix/plugin-sdk/frontend";
|
||||
import type { WebEndpoint } from "../shared/web-endpoint-config";
|
||||
import { WebEndpointTab } from "./WebEndpointTab";
|
||||
import { HostEditorWebUiSection } from "./HostEditorWebUiSection";
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
import axios from "axios";
|
||||
import type { PluginApiClient } from "@termix/plugin-sdk/frontend";
|
||||
import { handleApiError } from "@/main-axios";
|
||||
import { isElectron } from "@/lib/electron";
|
||||
import { isElectron } from "@termix/plugin-sdk/ui";
|
||||
import type { WebEndpoint } from "../shared/web-endpoint-config";
|
||||
|
||||
let pluginApi: PluginApiClient | null = null;
|
||||
|
||||
function genericFailure(error: unknown, action: string): never {
|
||||
if (!axios.isAxiosError(error) && error instanceof Error) throw error;
|
||||
const status = axios.isAxiosError(error) ? error.response?.status : undefined;
|
||||
throw new WebEndpointTunnelError(`Could not ${action}`, status);
|
||||
}
|
||||
|
||||
/** Set from activate with app.api, cleared on deactivate. */
|
||||
export function setWebEndpointApi(api: PluginApiClient | null): void {
|
||||
pluginApi = api;
|
||||
@@ -15,8 +20,8 @@ export function setWebEndpointApi(api: PluginApiClient | null): void {
|
||||
* Thrown when the backend rejects a web endpoint tunnel open with a specific,
|
||||
* actionable reason -- most commonly a 502 carrying the real cause: SSH auth
|
||||
* rejected, host unreachable, or nothing listening on the target port.
|
||||
* Preserves that reason instead of letting handleApiError collapse three
|
||||
* actionable errors into "Server error occurred. Please try again later."
|
||||
* Preserves that reason instead of collapsing three actionable errors into
|
||||
* one generic failure.
|
||||
*/
|
||||
export class WebEndpointTunnelError extends Error {
|
||||
constructor(
|
||||
@@ -67,7 +72,7 @@ export async function openWebEndpointTunnel(
|
||||
);
|
||||
}
|
||||
}
|
||||
return handleApiError(error, "open web endpoint tunnel");
|
||||
return genericFailure(error, "open web endpoint tunnel");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,6 +150,6 @@ export async function openWebEndpointExternally(
|
||||
);
|
||||
}
|
||||
}
|
||||
return handleApiError(error, "open isolated web endpoint");
|
||||
return genericFailure(error, "open isolated web endpoint");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user