diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7dc92c6..8eae80b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,9 +43,7 @@ jobs: run: pnpm install - name: build for gh-pages - env: - PUBLIC_PATH: '/metacubexd' - run: pnpm build + run: pnpm build --base /metacubexd - name: publish github pages uses: peaceiris/actions-gh-pages@v3 diff --git a/src/App.tsx b/src/App.tsx index 7e9f31d..1f133f9 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,15 +1,16 @@ import { Route, Routes, useNavigate } from '@solidjs/router' -import { Show, onMount } from 'solid-js' +import { Show, lazy, onMount } from 'solid-js' import { Header } from '~/components/Header' -import { Config } from '~/pages/Config' -import { Connections } from '~/pages/Connections' -import { Logs } from '~/pages/Logs' -import { Overview } from '~/pages/Overview' -import { Proxies } from '~/pages/Proxies' -import { Rules } from '~/pages/Rules' -import { Setup } from '~/pages/Setup' import { curTheme, selectedEndpoint } from '~/signals' +const Setup = lazy(() => import('~/pages/Setup')) +const Overview = lazy(() => import('~/pages/Overview')) +const Connections = lazy(() => import('~/pages/Connections')) +const Logs = lazy(() => import('~/pages/Logs')) +const Proxies = lazy(() => import('~/pages/Proxies')) +const Rules = lazy(() => import('~/pages/Rules')) +const Config = lazy(() => import('~/pages/Config')) + export const App = () => { const navigate = useNavigate() diff --git a/src/pages/Config.tsx b/src/pages/Config.tsx index 89b7c78..a773cf6 100644 --- a/src/pages/Config.tsx +++ b/src/pages/Config.tsx @@ -13,7 +13,7 @@ const schema = z.object({ 'mixed-port': z.number(), }) -export const Config = () => { +export default () => { const request = useRequest() const formItemList = [ { diff --git a/src/pages/Connections.tsx b/src/pages/Connections.tsx index e209058..6517ff7 100644 --- a/src/pages/Connections.tsx +++ b/src/pages/Connections.tsx @@ -20,7 +20,7 @@ import { twMerge } from 'tailwind-merge' import { secret, useRequest, wsEndpointURL } from '~/signals' import type { Connection } from '~/types' -export const Connections = () => { +export default () => { const request = useRequest() const [search, setSearch] = createSignal('') diff --git a/src/pages/Logs.tsx b/src/pages/Logs.tsx index 7e59a58..1afd832 100644 --- a/src/pages/Logs.tsx +++ b/src/pages/Logs.tsx @@ -3,7 +3,7 @@ import { createReconnectingWS } from '@solid-primitives/websocket' import { For, createEffect, createSignal } from 'solid-js' import { secret, wsEndpointURL } from '~/signals' -export const Logs = () => { +export default () => { const [search, setSearch] = createSignal('') const [logs, setLogs] = createSignal([]) diff --git a/src/pages/Overview.tsx b/src/pages/Overview.tsx index fc229ce..856cf96 100644 --- a/src/pages/Overview.tsx +++ b/src/pages/Overview.tsx @@ -1,6 +1,6 @@ import { createEventSignal } from '@solid-primitives/event-listener' import { createReconnectingWS } from '@solid-primitives/websocket' -import { ApexOptions } from 'apexcharts' +import type { ApexOptions } from 'apexcharts' import byteSize from 'byte-size' import { SolidApexCharts } from 'solid-apexcharts' import { @@ -18,7 +18,7 @@ const defaultChartOptions: ApexOptions = { chart: { toolbar: { show: false }, zoom: { enabled: false }, - animations: { easing: 'linear', dynamicAnimation: { speed: 1000 } }, + animations: { easing: 'linear' }, }, noData: { text: 'Loading...' }, legend: { @@ -50,7 +50,7 @@ const TrafficWidget: ParentComponent<{ label: JSX.Element }> = (props) => ( ) -export const Overview = () => { +export default () => { const [traffics, setTraffics] = createSignal<{ down: number; up: number }[]>( [], ) @@ -74,7 +74,7 @@ export const Overview = () => { const t = traffic() if (t) { - setTraffics((traffics) => [...traffics, t].slice(-100)) + setTraffics((traffics) => [...traffics, t].slice(-10)) } }) @@ -112,7 +112,7 @@ export const Overview = () => { const m = memory() if (m) { - setMemories((memories) => [...memories, m].slice(-100)) + setMemories((memories) => [...memories, m].slice(-10)) } }) diff --git a/src/pages/Proxies.tsx b/src/pages/Proxies.tsx index 90a37c9..0977f38 100644 --- a/src/pages/Proxies.tsx +++ b/src/pages/Proxies.tsx @@ -3,7 +3,7 @@ import { twMerge } from 'tailwind-merge' import { useRequest } from '~/signals' import type { Proxy, ProxyProvider } from '~/types' -export const Proxies = () => { +export default () => { const request = useRequest() const [proxies, setProxies] = createSignal([]) const [delayMap, setDelayMap] = createSignal>({}) @@ -15,6 +15,7 @@ export const Proxies = () => { if (typeof delay !== 'number' || delay === 0) { return '' } + return {delay}ms } @@ -53,7 +54,7 @@ export const Proxies = () => {
{proxy.name} {proxy.type}
-
+
{(proxyPoint) => (
{
{proxy.name}
-
+
{(proxyPoint) => ( -
+
{proxyPoint.name} {renderDelay(proxyPoint.name)}
)} diff --git a/src/pages/Rules.tsx b/src/pages/Rules.tsx index fe83dd0..9c2d1d0 100644 --- a/src/pages/Rules.tsx +++ b/src/pages/Rules.tsx @@ -2,7 +2,7 @@ import { For, createSignal, onMount } from 'solid-js' import { useRequest } from '~/signals' import type { Rule, RuleProvider } from '~/types' -export const Rules = () => { +export default () => { const request = useRequest() const [rules, setRules] = createSignal([]) const [rulesProviders, setRulesProviders] = createSignal([]) diff --git a/src/pages/Setup.tsx b/src/pages/Setup.tsx index 902bfcc..6a5defe 100644 --- a/src/pages/Setup.tsx +++ b/src/pages/Setup.tsx @@ -13,7 +13,7 @@ const schema = z.object({ secret: z.string(), }) -export const Setup = () => { +export default () => { const navigate = useNavigate() const { form } = createForm>({ diff --git a/vite.config.ts b/vite.config.ts index 6023df9..142d276 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,13 +1,9 @@ import devtools from 'solid-devtools/vite' -import { defineConfig } from 'vite' +import { defineConfig, splitVendorChunkPlugin } from 'vite' import solidPlugin from 'vite-plugin-solid' export default defineConfig({ - base: process.env.PUBLIC_PATH || '/', - resolve: { - alias: { - '~': '/src', - }, - }, - plugins: [devtools(), solidPlugin()], + build: { chunkSizeWarningLimit: 1000 }, + resolve: { alias: { '~': '/src' } }, + plugins: [devtools(), solidPlugin(), splitVendorChunkPlugin()], })