coolify integration.

This commit is contained in:
2026-02-27 08:55:41 -06:00
parent fe66be4aad
commit 2fe49b6725
62 changed files with 6366 additions and 129 deletions

View File

@@ -0,0 +1,38 @@
const api = window.api;
export const serverApi = {
getAll: () => api.getServers(),
save: (server) => api.saveServer(server),
delete: (id) => api.deleteServer(id),
};
export const projectApi = {
scanLocal: () => api.scanLocalProjects(),
scanServer: (serverId) => api.scanServer(serverId),
getRunningContainers: (serverId) => api.getRunningContainers(serverId),
compare: (data) => api.compareProject(data),
init: (projectPath) => api.initProject(projectPath),
};
export const deployApi = {
buildTar: (projectPath) => api.buildTar(projectPath),
deploy: (data) => api.deployProject(data),
};
export const syncApi = {
pullFile: (data) => api.pullFile(data),
pullFiles: (data) => api.pullFiles(data),
};
export const logsApi = {
getContainerLogs: (data) => api.getContainerLogs(data),
};
export const configApi = {
get: () => api.getConfig(),
save: (config) => api.saveConfig(config),
};
export const toolsApi = {
openVSCodeDiff: (data) => api.openVSCodeDiff(data),
};

View File

@@ -0,0 +1,21 @@
import { createContext, useContext, useState } from 'react';
const AppContext = createContext(null);
export function AppProvider({ children }) {
const [selectedServerId, setSelectedServerId] = useState(null);
return (
<AppContext.Provider value={{ selectedServerId, setSelectedServerId }}>
{children}
</AppContext.Provider>
);
}
export function useAppContext() {
const context = useContext(AppContext);
if (!context) {
throw new Error('useAppContext must be used within AppProvider');
}
return context;
}

View File

@@ -0,0 +1,16 @@
export const queryKeys = {
servers: {
all: ['servers'],
},
projects: {
local: ['projects', 'local'],
deployed: (serverId) => ['projects', 'deployed', serverId],
containers: (serverId) => ['projects', 'containers', serverId],
},
logs: {
container: (serverId, remotePath) => ['logs', serverId, remotePath],
},
config: {
all: ['config'],
},
};

View File

@@ -0,0 +1,24 @@
import { clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
export function cn(...inputs) {
return twMerge(clsx(inputs));
}
export function escapeHtml(text) {
if (!text) return '';
return text
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#039;');
}
export function maskEnvContent(content) {
if (!content) return null;
return content.replace(
/^([A-Z_]+PASSWORD|[A-Z_]+SECRET|[A-Z_]+KEY|[A-Z_]+TOKEN)=(.+)$/gm,
'$1=****'
);
}