Update pnpm and move all prebuilt env into single file
This commit is contained in:
@@ -2,7 +2,13 @@
|
||||
//
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
export const google_auth_enabled = import.meta.env.VITE_GOOGLE_AUTH_ENABLED === 'true';
|
||||
export const github_auth_enabled = import.meta.env.VITE_GITHUB_AUTH_ENABLED === 'true';
|
||||
export const captcha_enabled = import.meta.env.VITE_CAPTCHA_ENABLED === 'true';
|
||||
// the old prefix: import.meta.env.VITE_
|
||||
export const google_auth_enabled = import.meta.env.VITE_GOOGLE_AUTH_ENABLED;
|
||||
export const github_auth_enabled = import.meta.env.VITE_GITHUB_AUTH_ENABLED;
|
||||
export const captcha_enabled = import.meta.env.VITE_CAPTCHA_ENABLED;
|
||||
export const custom_oauth_name = import.meta.env.VITE_CUSTOM_OAUTH_NAME;
|
||||
export const registration_disabled = import.meta.env.VITE_REGISTRATION_DISABLED;
|
||||
export const hcaptcha_site_key = import.meta.env.VITE_HCAPTCHA;
|
||||
export const sentry_dsn = import.meta.env.VITE_SENTRY;
|
||||
export const recaptcha_key = import.meta.env.VITE_RECAPTCHA;
|
||||
export const plausible_data_url = import.meta.env.VITE_PLAUSIBLE_DATA_URL;
|
||||
|
||||
@@ -13,6 +13,7 @@ SPDX-License-Identifier: MPL-2.0
|
||||
import { browser } from '$app/environment';
|
||||
import { beforeNavigate } from '$app/navigation';
|
||||
import { draw, slide } from 'svelte/transition';
|
||||
import { registration_disabled } from './config';
|
||||
|
||||
const tippy = createTippy({
|
||||
arrow: true,
|
||||
@@ -93,7 +94,7 @@ SPDX-License-Identifier: MPL-2.0
|
||||
{#if $signedIn}
|
||||
<a class="btn-nav" href="/api/v1/users/logout">{$t('words.logout')}</a>
|
||||
{:else}
|
||||
{#if !import.meta.env.VITE_REGISTRATION_DISABLED}
|
||||
{#if registration_disabled}
|
||||
<a class="btn-nav" href="/account/register">{$t('words.register')}</a>
|
||||
{/if}
|
||||
|
||||
@@ -322,7 +323,7 @@ SPDX-License-Identifier: MPL-2.0
|
||||
{#if $signedIn}
|
||||
<a class="btn-nav" href="/api/v1/users/logout">{$t('words.logout')}</a>
|
||||
{:else}
|
||||
{#if !import.meta.env.VITE_REGISTRATION_DISABLED}
|
||||
{#if registration_disabled}
|
||||
<a class="btn-nav" href="/account/register">{$t('words.register')}</a>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ SPDX-License-Identifier: MPL-2.0
|
||||
import { getLocalization } from '$lib/i18n';
|
||||
import Cookies from 'js-cookie';
|
||||
import BrownButton from '$lib/components/buttons/brown.svelte';
|
||||
import { hcaptcha_site_key, recaptcha_key, sentry_dsn } from '$lib/config';
|
||||
|
||||
const { t } = getLocalization();
|
||||
|
||||
@@ -30,7 +31,7 @@ SPDX-License-Identifier: MPL-2.0
|
||||
let custom_field_value = $state();
|
||||
let captcha_enabled = $state();
|
||||
|
||||
let hcaptchaSitekey = import.meta.env.VITE_HCAPTCHA;
|
||||
let hcaptchaSitekey = hcaptcha_site_key;
|
||||
|
||||
let hcaptcha = {
|
||||
execute: async (_a, _b) => ({ response: '' }), // eslint-disable-line @typescript-eslint/no-unused-vars
|
||||
@@ -143,7 +144,7 @@ SPDX-License-Identifier: MPL-2.0
|
||||
custom_field: custom_field ? custom_field_value : undefined
|
||||
});
|
||||
} catch (e) {
|
||||
if (import.meta.env.VITE_SENTRY !== null) {
|
||||
if (sentry_dsn !== null) {
|
||||
Sentry.captureException(e);
|
||||
}
|
||||
/* alertModal.set({
|
||||
@@ -154,20 +155,18 @@ SPDX-License-Identifier: MPL-2.0
|
||||
alert('Captcha failed!');
|
||||
window.location.reload();
|
||||
}
|
||||
} else if (import.meta.env.VITE_RECAPTCHA) {
|
||||
} else if (recaptcha_key) {
|
||||
// eslint-disable-next-line no-undef
|
||||
grecaptcha.ready(() => {
|
||||
// eslint-disable-next-line no-undef
|
||||
grecaptcha
|
||||
.execute(import.meta.env.VITE_RECAPTCHA, { action: 'submit' })
|
||||
.then(function (token) {
|
||||
socket.emit('join_game', {
|
||||
username: username,
|
||||
game_pin: game_pin,
|
||||
captcha: token,
|
||||
custom_field: custom_field ? custom_field_value : undefined
|
||||
});
|
||||
grecaptcha.execute(recaptcha_key, { action: 'submit' }).then(function (token) {
|
||||
socket.emit('join_game', {
|
||||
username: username,
|
||||
game_pin: game_pin,
|
||||
captcha: token,
|
||||
custom_field: custom_field ? custom_field_value : undefined
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
@@ -198,10 +197,8 @@ SPDX-License-Identifier: MPL-2.0
|
||||
{#if captcha_enabled && hcaptchaSitekey}
|
||||
<script src="https://js.hcaptcha.com/1/api.js" async defer></script>
|
||||
{/if}
|
||||
{#if import.meta.env.VITE_RECAPTCHA && captcha_enabled}
|
||||
<script
|
||||
src="https://www.google.com/recaptcha/api.js?render={import.meta.env.VITE_RECAPTCHA}"
|
||||
></script>
|
||||
{#if recaptcha_key && captcha_enabled}
|
||||
<script src="https://www.google.com/recaptcha/api.js?render={recaptcha_key}"></script>
|
||||
{/if}
|
||||
</svelte:head>
|
||||
|
||||
|
||||
@@ -13,12 +13,12 @@ SPDX-License-Identifier: MPL-2.0
|
||||
import { initLocalizationContext } from '$lib/i18n';
|
||||
import { browser } from '$app/environment';
|
||||
import CommandPalette from '$lib/components/commandpalette.svelte';
|
||||
import { plausible_data_url } from '$lib/config';
|
||||
interface Props {
|
||||
children?: import('svelte').Snippet;
|
||||
}
|
||||
|
||||
let { children }: Props = $props();
|
||||
const plausible_data_url = import.meta.env.VITE_PLAUSIBLE_DATA_URL;
|
||||
|
||||
if (browser) {
|
||||
pathname.set(window.location.pathname);
|
||||
|
||||
@@ -6,6 +6,7 @@ SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
<script lang="ts">
|
||||
import { github_auth_enabled, google_auth_enabled, custom_oauth_name } from '$lib/config';
|
||||
console.log(github_auth_enabled);
|
||||
</script>
|
||||
|
||||
{#if google_auth_enabled}
|
||||
|
||||
Reference in New Issue
Block a user