Skip to content

Commit

Permalink
refactor: 重命名文件
Browse files Browse the repository at this point in the history
  • Loading branch information
ikxin committed Aug 10, 2023
1 parent c38f895 commit b5312d6
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 78 deletions.
6 changes: 3 additions & 3 deletions service/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ const getData = formData => {
`./service/vlmcs/vlmcs-${platform()}`,
[`${domain}:${port}`, `-${protocol}`, `-l ${software}`],
{ timeout: 5 * 1000 },
(error, stdout, stderr) => resolve({ error, stdout, stderr })
(error, stdout, stderr) => resolve({ error, stdout, stderr }),
)
})
}

const server = Bun.serve({
async fetch(req) {
const url = new URL(req.url)
if (url.pathname === '/api/kms/detection') {
if (url.pathname === '/api/kms/check') {
const formData = Object.fromEntries(await req.formData())
const { error, stdout, stderr } = await getData(formData)
if (error === null) {
Expand All @@ -29,7 +29,7 @@ const server = Bun.serve({
return new Response(JSON.stringify({ type: 'error', message: stderr || stdout }))
}
}
}
},
})

console.log(`Server running at http://localhost:${server.port}`)
24 changes: 12 additions & 12 deletions src/components/custom-header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ const appStore = useAppStore()
const navItems = computed(() => [
{
name: 'activation',
name: 'activate',
label: t('main.module.activate'),
icon: 'i-mdi:microsoft-windows'
icon: 'i-mdi:microsoft-windows',
},
{
name: 'detection',
name: 'tools',
label: t('main.module.tools'),
icon: 'i-mdi:check-network'
}
icon: 'i-mdi:check-network',
},
])
const router = useRouter()
Expand All @@ -32,18 +32,18 @@ const themeItems = computed(() => [
{
lable: t('main.theme.auto'),
value: 'auto',
icon: 'i-ic:round-brightness-auto'
icon: 'i-ic:round-brightness-auto',
},
{
lable: t('main.theme.dark'),
value: 'dark',
icon: 'i-ic:round-dark-mode'
icon: 'i-ic:round-dark-mode',
},
{
lable: t('main.theme.light'),
value: 'light',
icon: 'i-ic:round-light-mode'
}
icon: 'i-ic:round-light-mode',
},
])
const themeIcon = computed(() => {
Expand All @@ -56,13 +56,13 @@ const languagesItems = computed(() => [
{
lable: t('main.languages.zh-cn'),
value: 'zh-cn',
icon: 'i-flag:cn-4x3'
icon: 'i-flag:cn-4x3',
},
{
lable: t('main.languages.en-us'),
value: 'en-us',
icon: 'i-flag:us-4x3'
}
icon: 'i-flag:us-4x3',
},
])
const languagesChange = val => (appStore.languages = val)
Expand Down
57 changes: 3 additions & 54 deletions src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,62 +1,11 @@
// import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'

// const routes: Array<RouteRecordRaw> = [
// {
// name: 'home',
// path: '/',
// component: () => import('@/views/home/index.vue')
// },
// {
// name: 'activate',
// path: '/activate',
// redirect: '/activate/windows',
// component: () => import('@/views/activate/index.vue'),
// children: [
// {
// name: 'windows',
// path: 'windows',
// component: () => import('@/views/activate/windows.vue')
// },
// {
// name: 'office',
// path: 'office',
// component: () => import('@/views/activate/office.vue')
// }
// ]
// },
// {
// name: 'check',
// path: '/check',
// component: () => import('@/views/check/index.vue')
// },
// {
// name: 'download',
// path: '/download',
// component: () => import('@/views/download/index.vue')
// },
// {
// name: 'guide',
// path: '/guide',
// component: () => import('@/views/guide/index.vue')
// },
// {
// name: 'monitor',
// path: '/monitor',
// component: () => import('@/views/monitor/index.vue')
// }
// ]

// export const router = createRouter({ history: createWebHistory(), routes })

import { createRouter, createWebHistory } from 'vue-router/auto'

export const router = createRouter({
history: createWebHistory(),
extendRoutes: routes => {
routes.find(route => {
return route.name === '/activation'
}).redirect = '/activation/windows'

return route.name === '/activate'
}).redirect = '/activate/windows'
return routes
}
},
})
10 changes: 5 additions & 5 deletions src/typings/router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ import type {
declare module 'vue-router/auto/routes' {
export interface RouteNamedMap {
'/': RouteRecordInfo<'/', '/', Record<never, never>, Record<never, never>>,
'/activation': RouteRecordInfo<'/activation', '/activation', Record<never, never>, Record<never, never>>,
'/activation/office': RouteRecordInfo<'/activation/office', '/activation/office', Record<never, never>, Record<never, never>>,
'/activation/windows': RouteRecordInfo<'/activation/windows', '/activation/windows', Record<never, never>, Record<never, never>>,
'/activation/windows-server': RouteRecordInfo<'/activation/windows-server', '/activation/windows-server', Record<never, never>, Record<never, never>>,
'/detection': RouteRecordInfo<'/detection', '/detection', Record<never, never>, Record<never, never>>,
'/activate': RouteRecordInfo<'/activate', '/activate', Record<never, never>, Record<never, never>>,
'/activate/office': RouteRecordInfo<'/activate/office', '/activate/office', Record<never, never>, Record<never, never>>,
'/activate/windows': RouteRecordInfo<'/activate/windows', '/activate/windows', Record<never, never>, Record<never, never>>,
'/activate/windows-server': RouteRecordInfo<'/activate/windows-server', '/activate/windows-server', Record<never, never>, Record<never, never>>,
'/download/': RouteRecordInfo<'/download/', '/download', Record<never, never>, Record<never, never>>,
'/guide/': RouteRecordInfo<'/guide/', '/guide', Record<never, never>, Record<never, never>>,
'/monitor/': RouteRecordInfo<'/monitor/', '/monitor', Record<never, never>, Record<never, never>>,
'/tools': RouteRecordInfo<'/tools', '/tools', Record<never, never>, Record<never, never>>,
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/views/activation.vue → src/views/activate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ const selectedKeys = ref(pathName)
</template>
<template #icon><i class="i-icons:system text-base" /></template>
<template #title>{{ t('activate.sider.system') }}</template>
<AMenuItem key="windows" @click="router.push({ path: '/activation/windows' })">
<AMenuItem key="windows" @click="router.push({ path: '/activate/windows' })">
<template #icon><i class="i-icons:windows" /></template>
<span>Windows</span>
</AMenuItem>
<AMenuItem key="windows-server" @click="router.push({ path: '/activation/windows-server' })">
<AMenuItem key="windows-server" @click="router.push({ path: '/activate/windows-server' })">
<template #icon><i class="i-icons:windows-server" /></template>
<span>Windows Server</span>
</AMenuItem>
Expand All @@ -37,7 +37,7 @@ const selectedKeys = ref(pathName)
</template>
<template #icon><i class="i-icons:software text-base" /></template>
<template #title>{{ t('activate.sider.software') }}</template>
<AMenuItem key="office" @click="router.push({ path: '/activation/office' })">
<AMenuItem key="office" @click="router.push({ path: '/activate/office' })">
<template #icon><i class="i-icons:office" /></template>
<span>Office</span>
</AMenuItem>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/views/detection.vue → src/views/tools.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const resultInfo = reactive<{
const handleSubmit = async data => {
if (data.errors === undefined) {
resultInfo.loading = true
const { data } = await useAxios('/api/kms/detection', {
const { data } = await useAxios('/api/kms/check', {
method: 'post',
data: formData.value,
headers: { 'Content-Type': 'multipart/form-data' },
Expand Down

0 comments on commit b5312d6

Please sign in to comment.