feat: 重构控制面安全机制与分页规范
本次提交包含多项安全加固和体验优化: 1. 分离管理密钥与传输凭证,避免持 API Token 者伪造管理员票据 2. 钉钉回调地址增加白名单校验,防止开放重定向钓鱼 3. 初始管理员密码改为随机生成并日志记录,移除硬编码 123456 4. 新增登录防爆破计数表,支持 MySQL 多 worker 共享 5. 统一分页规范,新增 usePagedList composable 和 PagerBar 组件 6. 控制面 CORS 收敛为白名单,避免公网环境下任意站点跨域 7. 插件管理、凭证管理等列表接口支持分页和搜索 8. 强制初始密码修改,未改密前禁止使用管理功能 9. 定时任务触发被拒日志节流,避免授权失效时刷屏 10. 健康检查接口移除环境信息泄露,返回固定响应
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<p>内网大文件(壳子/Chrome 等)直链登记。中心机只存链接,文件本身走内网文件服务器</p>
|
||||
</div>
|
||||
<div class="head-actions">
|
||||
<el-select v-model="filter" placeholder="按分类过滤" style="width: 150px" clearable @change="refresh">
|
||||
<el-select v-model="filter" placeholder="按分类过滤" style="width: 150px" clearable @change="onFilterChange">
|
||||
<el-option v-for="c in categories" :key="c" :label="c" :value="c" />
|
||||
</el-select>
|
||||
<el-button :loading="busy" :icon="Refresh" @click="refresh">刷新</el-button>
|
||||
@@ -57,6 +57,7 @@
|
||||
<el-empty description="暂无登记的大文件源" :image-size="80" />
|
||||
</template>
|
||||
</el-table>
|
||||
<PagerBar :total="total" :page="page" :page-size="pageSize" @change="onPageChange" />
|
||||
</div>
|
||||
|
||||
<el-dialog v-model="dlg" title="登记内网直链" width="560px">
|
||||
@@ -96,32 +97,30 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { onMounted, ref, watch } from 'vue'
|
||||
import { Refresh, Plus, Delete } from '@element-plus/icons-vue'
|
||||
import { ElMessage as message, ElMessageBox } from 'element-plus'
|
||||
import { adminFileSources, adminFileSourceCreate, adminFileSourcePatch, adminFileSourceDelete } from '../api'
|
||||
import PagerBar from '../components/PagerBar.vue'
|
||||
import { usePagedList } from '../composables/usePagedList'
|
||||
|
||||
const CATS = ['shell', 'chrome']
|
||||
const categories = CATS
|
||||
const busy = ref(false)
|
||||
const rows = ref([])
|
||||
const filter = ref('')
|
||||
const list = usePagedList((p, s) => adminFileSources(filter.value || '', p, s), { onError: e => message.error('读取失败:' + (e.message || e)) })
|
||||
const { items: rows, total, page, size: pageSize, busy, load: refresh, onPageChange, reset } = list
|
||||
const dlg = ref(false)
|
||||
const saving = ref(false)
|
||||
const form = ref({})
|
||||
|
||||
async function refresh() {
|
||||
busy.value = true
|
||||
try {
|
||||
const r = await adminFileSources(filter.value || '')
|
||||
rows.value = r.files || []
|
||||
const seen = new Set(CATS)
|
||||
;(r.files || []).forEach((f) => seen.add(f.category))
|
||||
categories.length = 0
|
||||
;[...seen].sort().forEach((c) => categories.push(c))
|
||||
} catch (e) { message.error('读取失败:' + (e.message || e)) }
|
||||
finally { busy.value = false }
|
||||
}
|
||||
function onFilterChange() { reset() }
|
||||
// 分类下拉:由当前页数据补充实际出现的分类
|
||||
watch(rows, () => {
|
||||
const seen = new Set(CATS)
|
||||
;(rows.value || []).forEach((f) => seen.add(f.category))
|
||||
categories.length = 0
|
||||
;[...seen].sort().forEach((c) => categories.push(c))
|
||||
})
|
||||
|
||||
function catType(c) {
|
||||
return { shell: 'success', chrome: 'warning' }[c] || 'info'
|
||||
|
||||
Reference in New Issue
Block a user