add version

This commit is contained in:
john 2025-05-20 10:44:37 +02:00
parent ff44a2f69f
commit 248f382276
6 changed files with 37 additions and 9 deletions

View file

@ -1,23 +1,16 @@
import { BrowserRouter, Route, Routes } from 'react-router-dom'
import HomePage from './app/feed/pages/HomePage.tsx'
import { PostsService } from './app/feed/posts/postsService.ts'
import AuthorPage from './app/feed/pages/AuthorPage.tsx'
import { MediaService } from './app/media/mediaService.ts'
import SignupPage from './app/auth/pages/SignupPage.tsx'
import LoginPage from './app/auth/pages/LoginPage.tsx'
import { AuthService } from './app/auth/authService.ts'
import LogoutPage from './app/auth/pages/LogoutPage.tsx'
import UnauthorizedHandler from './app/auth/components/UnauthorizedHandler.tsx'
import AdminPage from './app/admin/pages/AdminPage.tsx'
import SignupCodesManagementPage from './app/admin/pages/subpages/SignupCodesManagementPage.tsx'
import { initUser } from './app/user/user.ts'
import { useRefreshSessionLoop } from './useRefreshSessionLoop.ts'
import { initApp } from './initApp.ts'
const postService = new PostsService()
const mediaService = new MediaService()
const authService = new AuthService()
initUser()
const { postService, mediaService, authService } = initApp()
export default function App() {
useRefreshSessionLoop(authService)

16
src/initApp.ts Normal file
View file

@ -0,0 +1,16 @@
import { initUser } from './app/user/user.ts'
import { setGlobal } from './app/femtoApp.ts'
import { PostsService } from './app/feed/posts/postsService.ts'
import { MediaService } from './app/media/mediaService.ts'
import { AuthService } from './app/auth/authService.ts'
export function initApp() {
setGlobal('version', import.meta.env.VITE_FEMTO_VERSION)
initUser()
const postService = new PostsService()
const mediaService = new MediaService()
const authService = new AuthService()
return { postService, mediaService, authService }
}

1
src/types.d.ts vendored
View file

@ -15,5 +15,6 @@ declare global {
}
export interface FemtoApp {
version: string
user: User | null
}