mirror of
https://github.com/podman-desktop/podman-desktop
synced 2026-05-23 09:48:59 +00:00
fix: avoid leakage of internal interface in the extension API for pods
related to https://github.com/containers/podman-desktop/pull/5880 Signed-off-by: Florent Benoit <fbenoit@redhat.com>
This commit is contained in:
parent
3dde9a77ef
commit
99bc29491e
4 changed files with 15 additions and 5 deletions
|
|
@ -277,7 +277,7 @@ declare module '@podman-desktop/api' {
|
|||
portmappings?: PodCreatePortOptions[];
|
||||
labels?: { [key: string]: string };
|
||||
// Set the provider to use, if not we will try select the first one available (sorted in favor of Podman).
|
||||
provider?: ProviderContainerConnectionInfo | ContainerProviderConnection;
|
||||
provider?: ContainerProviderConnection;
|
||||
}
|
||||
|
||||
export interface KubernetesProviderConnectionEndpoint {
|
||||
|
|
|
|||
|
|
@ -16,10 +16,12 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
***********************************************************************/
|
||||
|
||||
import type { ContainerProviderConnection, PodCreatePortOptions } from '@podman-desktop/api';
|
||||
import type {
|
||||
PodInfo as LibPodPodInfo,
|
||||
PodInspectInfo as LibPodPodInspectInfo,
|
||||
} from '../dockerode/libpod-dockerode.js';
|
||||
import type { ProviderContainerConnectionInfo } from './provider-info.js';
|
||||
|
||||
export interface PodInfo extends LibPodPodInfo {
|
||||
engineId: string;
|
||||
|
|
@ -31,3 +33,11 @@ export interface PodInspectInfo extends LibPodPodInspectInfo {
|
|||
engineId: string;
|
||||
engineName: string;
|
||||
}
|
||||
|
||||
export interface PodCreateOptions {
|
||||
name: string;
|
||||
portmappings?: PodCreatePortOptions[];
|
||||
labels?: { [key: string]: string };
|
||||
// Set the provider to use, if not we will try select the first one available (sorted in favor of Podman).
|
||||
provider?: ProviderContainerConnectionInfo | ContainerProviderConnection;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import type {
|
|||
VolumeCreateResponseInfo,
|
||||
} from './api/container-info.js';
|
||||
import type { ImageInfo } from './api/image-info.js';
|
||||
import type { PodInfo, PodInspectInfo } from './api/pod-info.js';
|
||||
import type { PodCreateOptions, PodInfo, PodInspectInfo } from './api/pod-info.js';
|
||||
import type { ImageInspectInfo } from './api/image-inspect-info.js';
|
||||
import type { ProviderContainerConnectionInfo } from './api/provider-info.js';
|
||||
import type { ImageRegistry } from './image-registry.js';
|
||||
|
|
@ -1168,7 +1168,7 @@ export class ContainerProviderRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
async createPod(podOptions: containerDesktopAPI.PodCreateOptions): Promise<{ engineId: string; Id: string }> {
|
||||
async createPod(podOptions: PodCreateOptions): Promise<{ engineId: string; Id: string }> {
|
||||
let telemetryOptions = {};
|
||||
try {
|
||||
let internalContainerProvider: InternalContainerProvider;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import type {
|
|||
import type { ContributionInfo } from '../../main/src/plugin/api/contribution-info';
|
||||
import type { ImageInfo } from '../../main/src/plugin/api/image-info';
|
||||
import type { VolumeInspectInfo, VolumeListInfo } from '../../main/src/plugin/api/volume-info';
|
||||
import type { PodInfo, PodInspectInfo } from '../../main/src/plugin/api/pod-info';
|
||||
import type { PodCreateOptions, PodInfo, PodInspectInfo } from '../../main/src/plugin/api/pod-info';
|
||||
import type { NetworkInspectInfo } from '../../main/src/plugin/api/network-info';
|
||||
import type { ImageInspectInfo } from '../../main/src/plugin/api/image-inspect-info';
|
||||
import type { HistoryInfo } from '../../main/src/plugin/api/history-info';
|
||||
|
|
@ -268,7 +268,7 @@ export function initExposure(): void {
|
|||
);
|
||||
contextBridge.exposeInMainWorld(
|
||||
'createPod',
|
||||
async (podCreateOptions: containerDesktopAPI.PodCreateOptions): Promise<{ engineId: string; Id: string }> => {
|
||||
async (podCreateOptions: PodCreateOptions): Promise<{ engineId: string; Id: string }> => {
|
||||
return ipcInvoke('container-provider-registry:createPod', podCreateOptions);
|
||||
},
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue