generated from kevisual/vite-react-template
update
This commit is contained in:
@@ -1,3 +1,43 @@
|
||||
import { QueryRouterServer } from "@kevisual/router/browser"
|
||||
import { QueryRouterServer } from '@kevisual/router/browser'
|
||||
|
||||
import { useContextKey } from '@kevisual/context'
|
||||
export const app = useContextKey('app', new QueryRouterServer())
|
||||
import { useConfigStore } from '@/pages/config/store'
|
||||
import { useGiteaConfigStore } from '@/pages/config/gitea/store'
|
||||
import { CNB } from '@kevisual/cnb'
|
||||
import { Gitea } from '@kevisual/gitea';
|
||||
export const app = useContextKey('app', new QueryRouterServer())
|
||||
|
||||
export const cnb: CNB = useContextKey('cnb', () => {
|
||||
const state = useConfigStore.getState()
|
||||
const config = state.config || {}
|
||||
const cors: any = {}
|
||||
if (config.ENABLE_CORS) {
|
||||
cors.baseUrl = config.CNB_CORS_URL || 'https://cors.kevisual.cn'
|
||||
}
|
||||
console.log('state', state)
|
||||
// if(state.config.)
|
||||
return new CNB({
|
||||
token: config.CNB_API_KEY,
|
||||
cookie: config.CNB_COOKIE,
|
||||
cors
|
||||
})
|
||||
})
|
||||
|
||||
// import '@kevisual/cnb-ai'
|
||||
|
||||
const url = 'https://kevisual.cn/root/cnb-ai/dist/app.js'
|
||||
setTimeout(() => {
|
||||
import(/* @vite-ignore */url)
|
||||
}, 2000)
|
||||
|
||||
export const gitea = useContextKey('gitea', () => {
|
||||
const state = useGiteaConfigStore.getState()
|
||||
const config = state.config || {}
|
||||
return new Gitea({
|
||||
token: config.GITEA_TOKEN,
|
||||
baseURL: config.GITEA_URL,
|
||||
cors: {
|
||||
baseUrl: 'https://cors.kevisual.cn'
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -1,5 +1,2 @@
|
||||
const Home = () => {
|
||||
return <div>Home Page</div>
|
||||
}
|
||||
|
||||
export default Home;
|
||||
import App from './repos/page'
|
||||
export default App
|
||||
@@ -12,6 +12,10 @@ import { Route as rootRouteImport } from './routes/__root'
|
||||
import { Route as LoginRouteImport } from './routes/login'
|
||||
import { Route as DemoRouteImport } from './routes/demo'
|
||||
import { Route as IndexRouteImport } from './routes/index'
|
||||
import { Route as WorkspacesIndexRouteImport } from './routes/workspaces/index'
|
||||
import { Route as RepoIndexRouteImport } from './routes/repo/index'
|
||||
import { Route as ConfigIndexRouteImport } from './routes/config/index'
|
||||
import { Route as ConfigGiteaRouteImport } from './routes/config/gitea'
|
||||
|
||||
const LoginRoute = LoginRouteImport.update({
|
||||
id: '/login',
|
||||
@@ -28,35 +32,93 @@ const IndexRoute = IndexRouteImport.update({
|
||||
path: '/',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const WorkspacesIndexRoute = WorkspacesIndexRouteImport.update({
|
||||
id: '/workspaces/',
|
||||
path: '/workspaces/',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const RepoIndexRoute = RepoIndexRouteImport.update({
|
||||
id: '/repo/',
|
||||
path: '/repo/',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const ConfigIndexRoute = ConfigIndexRouteImport.update({
|
||||
id: '/config/',
|
||||
path: '/config/',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const ConfigGiteaRoute = ConfigGiteaRouteImport.update({
|
||||
id: '/config/gitea',
|
||||
path: '/config/gitea',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
|
||||
export interface FileRoutesByFullPath {
|
||||
'/': typeof IndexRoute
|
||||
'/demo': typeof DemoRoute
|
||||
'/login': typeof LoginRoute
|
||||
'/config/gitea': typeof ConfigGiteaRoute
|
||||
'/config/': typeof ConfigIndexRoute
|
||||
'/repo/': typeof RepoIndexRoute
|
||||
'/workspaces/': typeof WorkspacesIndexRoute
|
||||
}
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
'/demo': typeof DemoRoute
|
||||
'/login': typeof LoginRoute
|
||||
'/config/gitea': typeof ConfigGiteaRoute
|
||||
'/config': typeof ConfigIndexRoute
|
||||
'/repo': typeof RepoIndexRoute
|
||||
'/workspaces': typeof WorkspacesIndexRoute
|
||||
}
|
||||
export interface FileRoutesById {
|
||||
__root__: typeof rootRouteImport
|
||||
'/': typeof IndexRoute
|
||||
'/demo': typeof DemoRoute
|
||||
'/login': typeof LoginRoute
|
||||
'/config/gitea': typeof ConfigGiteaRoute
|
||||
'/config/': typeof ConfigIndexRoute
|
||||
'/repo/': typeof RepoIndexRoute
|
||||
'/workspaces/': typeof WorkspacesIndexRoute
|
||||
}
|
||||
export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: FileRoutesByFullPath
|
||||
fullPaths: '/' | '/demo' | '/login'
|
||||
fullPaths:
|
||||
| '/'
|
||||
| '/demo'
|
||||
| '/login'
|
||||
| '/config/gitea'
|
||||
| '/config/'
|
||||
| '/repo/'
|
||||
| '/workspaces/'
|
||||
fileRoutesByTo: FileRoutesByTo
|
||||
to: '/' | '/demo' | '/login'
|
||||
id: '__root__' | '/' | '/demo' | '/login'
|
||||
to:
|
||||
| '/'
|
||||
| '/demo'
|
||||
| '/login'
|
||||
| '/config/gitea'
|
||||
| '/config'
|
||||
| '/repo'
|
||||
| '/workspaces'
|
||||
id:
|
||||
| '__root__'
|
||||
| '/'
|
||||
| '/demo'
|
||||
| '/login'
|
||||
| '/config/gitea'
|
||||
| '/config/'
|
||||
| '/repo/'
|
||||
| '/workspaces/'
|
||||
fileRoutesById: FileRoutesById
|
||||
}
|
||||
export interface RootRouteChildren {
|
||||
IndexRoute: typeof IndexRoute
|
||||
DemoRoute: typeof DemoRoute
|
||||
LoginRoute: typeof LoginRoute
|
||||
ConfigGiteaRoute: typeof ConfigGiteaRoute
|
||||
ConfigIndexRoute: typeof ConfigIndexRoute
|
||||
RepoIndexRoute: typeof RepoIndexRoute
|
||||
WorkspacesIndexRoute: typeof WorkspacesIndexRoute
|
||||
}
|
||||
|
||||
declare module '@tanstack/react-router' {
|
||||
@@ -82,6 +144,34 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof IndexRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/workspaces/': {
|
||||
id: '/workspaces/'
|
||||
path: '/workspaces'
|
||||
fullPath: '/workspaces/'
|
||||
preLoaderRoute: typeof WorkspacesIndexRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/repo/': {
|
||||
id: '/repo/'
|
||||
path: '/repo'
|
||||
fullPath: '/repo/'
|
||||
preLoaderRoute: typeof RepoIndexRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/config/': {
|
||||
id: '/config/'
|
||||
path: '/config'
|
||||
fullPath: '/config/'
|
||||
preLoaderRoute: typeof ConfigIndexRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/config/gitea': {
|
||||
id: '/config/gitea'
|
||||
path: '/config/gitea'
|
||||
fullPath: '/config/gitea'
|
||||
preLoaderRoute: typeof ConfigGiteaRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +179,10 @@ const rootRouteChildren: RootRouteChildren = {
|
||||
IndexRoute: IndexRoute,
|
||||
DemoRoute: DemoRoute,
|
||||
LoginRoute: LoginRoute,
|
||||
ConfigGiteaRoute: ConfigGiteaRoute,
|
||||
ConfigIndexRoute: ConfigIndexRoute,
|
||||
RepoIndexRoute: RepoIndexRoute,
|
||||
WorkspacesIndexRoute: WorkspacesIndexRoute,
|
||||
}
|
||||
export const routeTree = rootRouteImport
|
||||
._addFileChildren(rootRouteChildren)
|
||||
|
||||
Reference in New Issue
Block a user