fixes here and there

This commit is contained in:
Andras Bacsai
2022-08-11 08:18:17 +00:00
parent 0c4203a351
commit 34ad5bc86b
7 changed files with 122 additions and 75 deletions

View File

@@ -38,14 +38,21 @@ export function getAPIUrl() {
const newURL = href.replace('https://', 'https://3001-').replace(/\/$/, '')
return newURL
}
if (process.env.CODESANDBOX_HOST) {
return `https://${process.env.CODESANDBOX_HOST.replace(/\$PORT/,'3001')}`
}
return isDev ? 'http://localhost:3001' : 'http://localhost:3000';
}
export function getUIUrl() {
if (process.env.GITPOD_WORKSPACE_URL) {
const { href } = new URL(process.env.GITPOD_WORKSPACE_URL)
const newURL = href.replace('https://', 'https://3000-').replace(/\/$/, '')
return newURL
}
if (process.env.CODESANDBOX_HOST) {
return `https://${process.env.CODESANDBOX_HOST.replace(/\$PORT/,'3000')}`
}
return 'http://localhost:3000';
}
@@ -1454,7 +1461,7 @@ export async function removeService({ id }: { id: string }): Promise<void> {
}
export function saveUpdateableFields(type: string, data: any) {
let update = {};
const update = {};
if (type && serviceFields[type]) {
serviceFields[type].map((k) => {
let temp = data[k.name]
@@ -1479,7 +1486,7 @@ export function saveUpdateableFields(type: string, data: any) {
}
export function getUpdateableFields(type: string, data: any) {
let update = {};
const update = {};
if (type && serviceFields[type]) {
serviceFields[type].map((k) => {
let temp = data[k.name]
@@ -1543,7 +1550,7 @@ export async function stopBuild(buildId, applicationId) {
await new Promise<void>(async (resolve, reject) => {
const { destinationDockerId, status } = await prisma.build.findFirst({ where: { id: buildId } });
const { engine, id: dockerId } = await prisma.destinationDocker.findFirst({ where: { id: destinationDockerId } });
let interval = setInterval(async () => {
const interval = setInterval(async () => {
try {
if (status === 'failed') {
clearInterval(interval);

View File

@@ -1,4 +1,5 @@
import { dev } from '$app/env';
import { CODESANDBOX_HOST } from '$env/static/private';
import Cookies from 'js-cookie';
export function getAPIUrl() {
@@ -7,10 +8,12 @@ export function getAPIUrl() {
const newURL = href.replace('https://', 'https://3001-').replace(/\/$/, '')
return newURL
}
if (CODESANDBOX_HOST) {
return `https://${CODESANDBOX_HOST.replace(/\$PORT/,'3001')}`
}
return dev ? 'http://localhost:3001' : 'http://localhost:3000';
}
export function getWebhookUrl(type: string) {
console.log(GITPOD_WORKSPACE_URL)
if (GITPOD_WORKSPACE_URL) {
const { href } = new URL(GITPOD_WORKSPACE_URL)
const newURL = href.replace('https://', 'https://3001-').replace(/\/$/, '')
@@ -21,6 +24,15 @@ export function getWebhookUrl(type: string) {
return `${newURL}/webhooks/gitlab/events`
}
}
if (CODESANDBOX_HOST) {
const newURL = CODESANDBOX_HOST.replace(/\$PORT/,'3001')
if (type === 'github') {
return `${newURL}/webhooks/github/events`
}
if (type === 'gitlab') {
return `${newURL}/webhooks/gitlab/events`
}
}
return `https://webhook.site/0e5beb2c-4e9b-40e2-a89e-32295e570c21/events`;
}
async function send({

View File

@@ -1,3 +1,4 @@
import { CODESANDBOX_HOST } from '$env/static/private';
import { writable, readable, type Writable, type Readable } from 'svelte/store';
interface AppSession {
@@ -75,10 +76,12 @@ export const setLocation = (resource: any) => {
const newURL = href
.replace('https://', `https://${resource.exposePort}-`)
.replace(/\/$/, '');
location.set(newURL)
} else {
location.set(resource.fqdn)
return location.set(newURL)
} else if (CODESANDBOX_HOST){
const newURL = `https://${CODESANDBOX_HOST.replace(/\$PORT/,resource.exposePort)}`
return location.set(newURL)
}
return location.set(resource.fqdn)
}
export const toasts: any = writable([])

View File

@@ -31,7 +31,9 @@
<div class="text-center flex justify-center">
<Explainer
customClass="max-w-[32rem]"
text="Remote Docker Engines are using <span class='text-white font-bold'>SSH connection</span> to initiate connection. You need to setup an <span class='text-white font-bold'>SSH key</span> in advance on the server and install Docker. <br>See <a class='text-white' href='https://docs.coollabs.io'>docs</a> for more details."
text="Remote Docker Engines are using <span class='text-white font-bold'>SSH</span> to communicate with the remote docker engine.
You need to setup an <span class='text-white font-bold'>SSH key</span> in advance on the server and install Docker.
<br>See <a class='text-white' href='https://docs.coollabs.io/coolify/destinations/remote.html'>docs</a> for more details."
/>
</div>
<div class="flex justify-center px-6 pb-8">

View File

@@ -7,6 +7,7 @@ export default {
'GITPOD_WORKSPACE_URL': JSON.stringify(process.env.GITPOD_WORKSPACE_URL)
},
server: {
host: '0.0.0.0',
port: 3000,
hmr: process.env.GITPOD_WORKSPACE_URL
? {