Skip to content

Commit

Permalink
improve console
Browse files Browse the repository at this point in the history
  • Loading branch information
keengo99 committed Jan 4, 2025
1 parent 017ae33 commit da5d696
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 6 deletions.
2 changes: 1 addition & 1 deletion console/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { RouterLink, RouterView } from 'vue-router'
</tr>
<tr>
<td>
<a href="/">旧版</a>
<a href="/old">旧版</a>
</td>
</tr>
</table>
Expand Down
25 changes: 25 additions & 0 deletions console/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,31 @@ const router = createRouter({
path: 'cache',
name: 'cache',
component: ()=>import('../views/config/CacheView.vue'),
},
{
path: 'log',
name: 'log',
component: ()=>import('../views/config/LogView.vue'),
},
{
path: 'io',
name: 'io',
component: ()=>import('../views/config/IoView.vue'),
},
{
path: 'other',
name: 'other',
component: ()=>import('../views/config/OtherView.vue'),
},
{
path: 'manage',
name: 'manage',
component: ()=>import('../views/config/ManageView.vue'),
},
{
path: 'resource',
name: 'resource',
component: ()=>import('../views/config/ResourceView.vue'),
}
]
},
Expand Down
5 changes: 1 addition & 4 deletions console/src/views/ConnectPerIpView.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<script lang="ts" setup>
</script>
<template>
<table class="table table-bordered" width="90%">
<tr><td>ddd</td><td>kkk</td></tr>
<tr><td>ddd</td><td>kkk</td></tr>
</table>
connect_per_ip
</template>
5 changes: 5 additions & 0 deletions console/src/views/config/IoView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script lang="ts" setup>
</script>
<template>
io
</template>
5 changes: 5 additions & 0 deletions console/src/views/config/LogView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script lang="ts" setup>
</script>
<template>
log
</template>
5 changes: 5 additions & 0 deletions console/src/views/config/ManageView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script lang="ts" setup>
</script>
<template>
manage
</template>
5 changes: 5 additions & 0 deletions console/src/views/config/OtherView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script lang="ts" setup>
</script>
<template>
other
</template>
5 changes: 5 additions & 0 deletions console/src/views/config/ResourceView.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script lang="ts" setup>
</script>
<template>
resource
</template>
2 changes: 1 addition & 1 deletion src/KHttpManage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1920,7 +1920,7 @@ function sortrq(index)\
void init_manager_handler() {
KHttpManage::handler.add(_KS("/*"), [](kgl_str_t* path, void* data, KHttpRequest* rq, kgl_input_stream* in, kgl_output_stream* out) -> KGL_RESULT {
KHttpManage* hm = (KHttpManage*)data;
if (path->len == 1 && *path->data == '/') {
if (strcmp(path->data,"/")==0 || strcmp(path->data,"old")==0) {
hm->sendMainPage();
return KGL_OK;
}
Expand Down
10 changes: 10 additions & 0 deletions src/work.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,13 @@ KGL_RESULT stageHttpManage(KHttpRequest* rq) {
klog(KLOG_NOTICE, "[ADMIN_SUCCESS]%s %s%s%s\n",
ips, rq->sink->data.raw_url.path,
(rq->sink->data.raw_url.param ? "?" : ""), (rq->sink->data.raw_url.param ? rq->sink->data.raw_url.param : ""));
bool is_static = false;
if (strcmp(rq->sink->data.url->path, "/") == 0) {
KFileName file;
if (file.setName(conf.sysHost->doc_root.c_str(), "/index.html", FOLLOW_LINK_ALL)) {
is_static = true;
}
}
char* ext_file = strrchr(rq->sink->data.url->path, '.');
if (ext_file &&
(strcmp(ext_file, ".whm") == 0 ||
Expand All @@ -459,6 +466,9 @@ KGL_RESULT stageHttpManage(KHttpRequest* rq) {
strcmp(ext_file, ".gif") == 0 ||
strcmp(ext_file, ".css") == 0)
) {
is_static = true;
}
if (is_static) {
KBIT_CLR(rq->sink->data.flags, RQ_HAS_AUTHORIZATION);
assert(rq->is_source_empty());
auto svh = conf.sysHost->getFirstSubVirtualHost();
Expand Down

0 comments on commit da5d696

Please sign in to comment.