fix selfhost

This commit is contained in:
Emily
2025-01-17 17:40:20 +01:00
parent fb89c87489
commit dbcda95823
4 changed files with 11 additions and 3 deletions

View File

@@ -3,5 +3,5 @@
const app = useRuntimeConfig(); const app = useRuntimeConfig();
export function useSelfhosted() { export function useSelfhosted() {
return app.public.SELFHOSTED === 'TRUE' || app.public.SELFHOSTED !== 'true'; return app.public.SELFHOSTED === 'TRUE' || app.public.SELFHOSTED === 'true';
} }

View File

@@ -12,6 +12,8 @@ const modal = useModal();
const selfhosted = useSelfhosted(); const selfhosted = useSelfhosted();
console.log({ selfhosted })
const sections: Section[] = [ const sections: Section[] = [
{ {
title: '', title: '',

View File

@@ -55,8 +55,8 @@ export default defineNuxtConfig({
STRIPE_SECRET_TEST: process.env.STRIPE_SECRET_TEST, STRIPE_SECRET_TEST: process.env.STRIPE_SECRET_TEST,
STRIPE_WH_SECRET_TEST: process.env.STRIPE_WH_SECRET_TEST, STRIPE_WH_SECRET_TEST: process.env.STRIPE_WH_SECRET_TEST,
NOAUTH_USER_EMAIL: process.env.NOAUTH_USER_EMAIL, NOAUTH_USER_EMAIL: process.env.NOAUTH_USER_EMAIL,
NOAUTH_USER_NAME: process.env.NOAUTH_USER_NAME || 'FALSE', NOAUTH_USER_NAME: process.env.NOAUTH_USER_NAME,
SELFHOSTED: process.env.SELFHOSTED, SELFHOSTED: process.env.SELFHOSTED || 'FALSE',
public: { public: {
AUTH_MODE: process.env.AUTH_MODE, AUTH_MODE: process.env.AUTH_MODE,
GITHUB_CLIENT_ID: process.env.GITHUB_AUTH_CLIENT_ID || 'NONE', GITHUB_CLIENT_ID: process.env.GITHUB_AUTH_CLIENT_ID || 'NONE',

View File

@@ -1,11 +1,17 @@
import { OnboardingModel } from '@schema/OnboardingSchema'; import { OnboardingModel } from '@schema/OnboardingSchema';
const { SELFHOSTED } = useRuntimeConfig();
export default defineEventHandler(async event => { export default defineEventHandler(async event => {
const data = await getRequestData(event); const data = await getRequestData(event);
if (!data) return; if (!data) return;
const exist = await OnboardingModel.exists({ user_id: data.user.id }); const exist = await OnboardingModel.exists({ user_id: data.user.id });
if (SELFHOSTED === 'TRUE' || SELFHOSTED === 'true') {
return { exists: true }
}
return { exist: exist != null } return { exist: exist != null }
}); });