feat: import to docker form board, docker button on boards (#1714)

This commit is contained in:
Thomas Camlong
2023-12-30 20:11:38 +01:00
committed by GitHub
parent e13a4afdde
commit 082077ec9d
16 changed files with 234 additions and 138 deletions

View File

@@ -1,7 +1,6 @@
import { TRPCError } from '@trpc/server';
import axios, { AxiosError } from 'axios';
import { AxiosError } from 'axios';
import Consola from 'consola';
import https from 'https';
import { z } from 'zod';
import { isStatusOk } from '~/components/Dashboard/Tiles/Apps/AppPing';
import { getConfig } from '~/tools/config/getConfig';
@@ -18,7 +17,6 @@ export const appRouter = createTRPCRouter({
})
)
.query(async ({ input }) => {
const agent = new https.Agent({ rejectUnauthorized: false });
const config = getConfig(input.configName);
const app = config.apps.find((app) => app.id === input.id);
@@ -30,8 +28,16 @@ export const appRouter = createTRPCRouter({
message: `App ${input.id} was not found`,
});
}
const res = await axios
.get(app.url, { httpsAgent: agent, timeout: 10000 })
const res = await fetch(app.url, {
method: 'GET',
cache: 'force-cache',
headers: {
// Cache for 5 minutes
'Cache-Control': 'max-age=300',
'Content-Type': 'application/json',
},
})
.then((response) => ({
status: response.status,
statusText: response.statusText,