fix selfhost

This commit is contained in:
Emily
2025-01-17 16:44:22 +01:00
parent b59eea47e9
commit fb89c87489
7 changed files with 27 additions and 8 deletions

View File

@@ -195,6 +195,9 @@ function getPricingsData() {
<div class="flex justify-between items-center mt-10 flex-col xl:flex-row"> <div class="flex justify-between items-center mt-10 flex-col xl:flex-row">
<div class="flex flex-col gap-2"> <div class="flex flex-col gap-2">
<div class="poppins text-[1.1rem] text-lyx-lightmode-text dark:text-yellow-400 mb-2">
*Plan upgrades are applicable exclusively to this project(workspace).
</div>
<div class="poppins text-[2rem] font-semibold"> <div class="poppins text-[2rem] font-semibold">
Do you need help ? Do you need help ?
</div> </div>

View File

@@ -53,6 +53,9 @@ async function redeemCode() {
<div class="text-lyx-text-darker mt-1 text-[.9rem] poppins"> <div class="text-lyx-text-darker mt-1 text-[.9rem] poppins">
Redeemed codes: {{ valid_codes.data.value?.count || '0' }} Redeemed codes: {{ valid_codes.data.value?.count || '0' }}
</div> </div>
<div class="poppins text-[1.1rem] text-lyx-lightmode-text dark:text-yellow-400 mb-2">
*Plan upgrades are applicable exclusively to this project(workspace).
</div>
</template> </template>
</SettingsTemplate> </SettingsTemplate>
</template> </template>

View File

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

View File

@@ -32,6 +32,7 @@ const sections: Section[] = [
action() { action() {
modal.open(DialogFeedback, {}); modal.open(DialogFeedback, {});
}, },
disabled: selfhosted
}, },
{ {
label: 'Documentation', to: 'https://docs.litlyx.com', icon: 'fal fa-book', external: true, label: 'Documentation', to: 'https://docs.litlyx.com', icon: 'fal fa-book', external: true,

View File

@@ -4,6 +4,7 @@ import VueMarkdown from 'vue-markdown-render';
definePageMeta({ layout: 'dashboard' }); definePageMeta({ layout: 'dashboard' });
const selfhosted = useSelfhosted();
const debugModeAi = ref<boolean>(false); const debugModeAi = ref<boolean>(false);
@@ -87,6 +88,7 @@ async function pollSendMessageStatus(chat_id: string, times: number, updateStatu
currentChatMessages.value = messages.map(e => ({ ...e, charts: e.charts.map(k => JSON.parse(k)) })) as any; currentChatMessages.value = messages.map(e => ({ ...e, charts: e.charts.map(k => JSON.parse(k)) })) as any;
currentChatMessageDelta.value = ''; currentChatMessageDelta.value = '';
loading.value = false;
} }
} }
@@ -366,7 +368,8 @@ async function clearAllChats() {
<div class="flex gap-2 items-center md:absolute fixed bottom-8 left-0 w-full px-10 xl:px-28"> <div class="flex gap-2 items-center md:absolute fixed bottom-8 left-0 w-full px-10 xl:px-28">
<input @keydown="onKeyDown" v-model="currentText" <input @keydown="onKeyDown" v-model="currentText"
class="bg-lyx-lightmode-widget-light dark:bg-lyx-widget-light w-full dark:focus:outline-none px-4 py-2 rounded-lg outline-[1px] outline outline-lyx-lightmode-widget dark:outline-none" type="text"> class="bg-lyx-lightmode-widget-light dark:bg-lyx-widget-light w-full dark:focus:outline-none px-4 py-2 rounded-lg outline-[1px] outline outline-lyx-lightmode-widget dark:outline-none"
type="text">
<div @click="sendMessage()" <div @click="sendMessage()"
class="bg-lyx-lightmode-widget-light hover:bg-lyx-lightmode-widget dark:bg-lyx-widget-light dark:hover:bg-lyx-widget-light cursor-pointer px-4 py-2 rounded-full"> class="bg-lyx-lightmode-widget-light hover:bg-lyx-lightmode-widget dark:bg-lyx-widget-light dark:hover:bg-lyx-widget-light cursor-pointer px-4 py-2 rounded-full">
<i class="far fa-arrow-up"></i> <i class="far fa-arrow-up"></i>
@@ -384,7 +387,7 @@ async function clearAllChats() {
'absolute top-0 left-0 w-full': menuOpen, 'absolute top-0 left-0 w-full': menuOpen,
'hidden xl:flex': !menuOpen 'hidden xl:flex': !menuOpen
}" }"
class="flex-[2] bg-lyx-lightmode-background border-l-[1px] dark:bg-lyx-background-light p-6 flex flex-col gap-4 h-full overflow-hidden"> class="flex-[2] bg-lyx-lightmode-background border-l-[1px] dark:border-l-0 dark:bg-lyx-background-light p-6 flex flex-col gap-4 h-full overflow-hidden">
<div class="gap-2 flex flex-col"> <div class="gap-2 flex flex-col">
<div class="xl:hidden absolute right-6 top-2 text-[1.5rem]"> <div class="xl:hidden absolute right-6 top-2 text-[1.5rem]">
@@ -403,7 +406,7 @@ async function clearAllChats() {
chatsRemaining }} remaining requests chatsRemaining }} remaining requests
</div> </div>
</div> </div>
<LyxUiButton type="primary" class="text-[.9rem] text-center " @click="showDrawer('PRICING')"> <LyxUiButton v-if="!selfhosted" type="primary" class="text-[.9rem] text-center " @click="showDrawer('PRICING')">
Upgrade Upgrade
</LyxUiButton> </LyxUiButton>
</div> </div>

View File

@@ -2,6 +2,7 @@
definePageMeta({ layout: 'dashboard' }); definePageMeta({ layout: 'dashboard' });
const selfhosted = useSelfhosted();
const items = [ const items = [
{ label: 'General', slot: 'general' }, { label: 'General', slot: 'general' },
@@ -16,7 +17,7 @@ const items = [
<template> <template>
<div class="lg:px-10 lg:py-8 h-dvh overflow-y-auto overflow-x-hidden hide-scrollbars"> <div class="lg:px-10 lg:py-8 h-dvh overflow-y-auto overflow-x-hidden hide-scrollbars">
<div class="poppins font-semibold text-[1.3rem] lg:px-0 px-4 lg:py-0 py-4"> Settings </div> <div class="poppins font-semibold text-[1.3rem] lg:px-0 px-4 lg:py-0 py-4"> Settings </div>
<CustomTab :items="items" class="mt-8"> <CustomTab :items="items" class="mt-8">
@@ -30,10 +31,18 @@ const items = [
<SettingsMembers :key="refreshKey"></SettingsMembers> <SettingsMembers :key="refreshKey"></SettingsMembers>
</template> </template>
<template #billing> <template #billing>
<SettingsBilling :key="refreshKey"></SettingsBilling> <SettingsBilling v-if="!selfhosted" :key="refreshKey"></SettingsBilling>
<div class="flex popping text-[1.2rem] font-semibold justify-center mt-[20vh] text-lyx-lightmode-text dark:text-lyx-text"
v-if="selfhosted">
Billing disabled in self-host mode
</div>
</template> </template>
<template #codes> <template #codes>
<SettingsCodes :key="refreshKey"></SettingsCodes> <SettingsCodes v-if="!selfhosted" :key="refreshKey"></SettingsCodes>
<div class="flex popping text-[1.2rem] font-semibold justify-center mt-[20vh] text-lyx-lightmode-text dark:text-lyx-text"
v-if="selfhosted">
Codes disabled in self-host mode
</div>
</template> </template>
<template #account> <template #account>
<SettingsAccount :key="refreshKey"></SettingsAccount> <SettingsAccount :key="refreshKey"></SettingsAccount>

View File

@@ -66,7 +66,7 @@ export default defineEventHandler(async event => {
const { project, project_id, user } = data; const { project, project_id, user } = data;
if (SELFHOSTED !== 'TRUE') { if (SELFHOSTED !== 'TRUE' && SELFHOSTED !== 'true') {
const PREMIUM_TYPE = project.premium_type; const PREMIUM_TYPE = project.premium_type;
if (PREMIUM_TYPE === 0) return setResponseStatus(event, 400, 'Project not premium'); if (PREMIUM_TYPE === 0) return setResponseStatus(event, 400, 'Project not premium');
} }