fixes here and there
This commit is contained in:
		@@ -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({
 | 
			
		||||
 
 | 
			
		||||
@@ -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([])
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user