fix: Always use IP address for webhooks

This commit is contained in:
Andras Bacsai
2022-04-29 23:02:58 +02:00
parent 8e42203b89
commit 880865f1f2
6 changed files with 39 additions and 16 deletions

View File

@@ -11,6 +11,7 @@
import { toast } from '@zerodevx/svelte-toast';
import { t } from '$lib/translations';
import { getIP } from '$lib/components/common';
const { id } = $page.params;
let url = browser ? (settings.fqdn ? settings.fqdn : window.location.origin) : '';
@@ -26,7 +27,8 @@
appSecret: null
};
}
onMount(() => {
onMount(async () => {
url = await getIP();
oauthIdEl && oauthIdEl.focus();
});

View File

@@ -30,21 +30,21 @@
<script>
import { dev } from '$app/env';
import { getDomain, dashify } from '$lib/components/common';
import { getDomain, dashify, getIP } from '$lib/components/common';
import { t } from '$lib/translations';
export let source;
export let settings;
onMount(() => {
onMount(async () => {
const { organization, id, htmlUrl } = source;
const { fqdn } = settings;
const host = dev
? 'http://localhost:3000'
: fqdn
? fqdn
: `http://${window.location.host}` || '';
const ip = await getIP();
let host = `http://${ip}`;
if (fqdn && fqdn.startsWith('https')) {
host = `https://${ip}`;
}
console.log(ip, host);
const domain = getDomain(fqdn);
let url = 'settings/apps/new';
if (organization) url = `organizations/${organization}/settings/apps/new`;
const name = dashify(domain) || 'app';