修复前端问题
This commit is contained in:
parent
d064fdc1f9
commit
dd77a24b48
2
.gitignore
vendored
2
.gitignore
vendored
@ -50,7 +50,7 @@ __pycache__/
|
|||||||
# Distribution / packaging
|
# Distribution / packaging
|
||||||
build/
|
build/
|
||||||
develop-eggs/
|
develop-eggs/
|
||||||
dist/
|
|
||||||
downloads/
|
downloads/
|
||||||
eggs/
|
eggs/
|
||||||
.eggs/
|
.eggs/
|
||||||
|
|||||||
@ -45,7 +45,10 @@ class MainApp:
|
|||||||
)
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--crawl", help="采集模式,根据域名批量采集 SURL,多个域名可使用英文逗号分割,也可通过 --crawl-file 传入文件",
|
"--crawl",
|
||||||
|
nargs="?",
|
||||||
|
const="",
|
||||||
|
help="采集模式,根据域名批量采集 SURL,多个域名可使用英文逗号分割,也可通过 --crawl-file 传入文件",
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--crawl-file", help="目标域名文件,批量传入待采集的域名,每行一个"
|
"--crawl-file", help="目标域名文件,批量传入待采集的域名,每行一个"
|
||||||
@ -133,7 +136,7 @@ class MainApp:
|
|||||||
signal.signal(signal.SIGINT, self.exit_handler)
|
signal.signal(signal.SIGINT, self.exit_handler)
|
||||||
|
|
||||||
# 启动所有的 engine
|
# 启动所有的 engine
|
||||||
if self.args.crawl:
|
if self.args.crawl is not None:
|
||||||
self.crawl_engine = CrawlEngine()
|
self.crawl_engine = CrawlEngine()
|
||||||
self.crawl_engine.start()
|
self.crawl_engine.start()
|
||||||
logger.info("crawl 启动")
|
logger.info("crawl 启动")
|
||||||
|
|||||||
@ -1,11 +1,25 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
import uvicorn
|
import uvicorn
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI, HTTPException
|
||||||
|
from fastapi.responses import FileResponse, Response
|
||||||
|
from loguru import logger
|
||||||
|
from starlette.staticfiles import StaticFiles
|
||||||
|
from starlette.types import Scope
|
||||||
|
|
||||||
from .controller.domain import router as domain_router
|
from .controller.domain import router as domain_router
|
||||||
from .controller.report import router as report_router
|
from .controller.report import router as report_router
|
||||||
from .controller.status import router as status_router
|
from .controller.status import router as status_router
|
||||||
|
|
||||||
|
|
||||||
|
class SPAStaticFiles(StaticFiles):
|
||||||
|
async def get_response(self, path: str, scope: Scope) -> Response:
|
||||||
|
# 如果是前端路由,直接返回 index.html,否则直接访问的时候会404
|
||||||
|
if path in ("domain", "url"):
|
||||||
|
return FileResponse(os.path.join(self.directory, "index.html"))
|
||||||
|
return await super().get_response(path, scope)
|
||||||
|
|
||||||
|
|
||||||
class WebApp:
|
class WebApp:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -20,6 +34,9 @@ class WebApp:
|
|||||||
app.include_router(report_router)
|
app.include_router(report_router)
|
||||||
app.include_router(domain_router)
|
app.include_router(domain_router)
|
||||||
|
|
||||||
|
# 挂载前端文件
|
||||||
|
app.mount("/", SPAStaticFiles(directory="fe/dist", html=True), name="static")
|
||||||
|
|
||||||
# TODO 先写死,后面从配置文件里取
|
# TODO 先写死,后面从配置文件里取
|
||||||
cfg = uvicorn.Config(app, host="127.0.0.1", port=3000)
|
cfg = uvicorn.Config(app, host="127.0.0.1", port=3000)
|
||||||
server = uvicorn.Server(cfg)
|
server = uvicorn.Server(cfg)
|
||||||
|
|||||||
2
fe/.gitignore
vendored
2
fe/.gitignore
vendored
@ -9,7 +9,7 @@ lerna-debug.log*
|
|||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
.DS_Store
|
.DS_Store
|
||||||
dist
|
|
||||||
dist-ssr
|
dist-ssr
|
||||||
coverage
|
coverage
|
||||||
*.local
|
*.local
|
||||||
|
|||||||
2
fe/components.d.ts
vendored
2
fe/components.d.ts
vendored
@ -14,7 +14,6 @@ declare module 'vue' {
|
|||||||
NButton: typeof import('naive-ui')['NButton']
|
NButton: typeof import('naive-ui')['NButton']
|
||||||
NCard: typeof import('naive-ui')['NCard']
|
NCard: typeof import('naive-ui')['NCard']
|
||||||
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
NCheckbox: typeof import('naive-ui')['NCheckbox']
|
||||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
|
||||||
NDataTable: typeof import('naive-ui')['NDataTable']
|
NDataTable: typeof import('naive-ui')['NDataTable']
|
||||||
NDialogProvider: typeof import('naive-ui')['NDialogProvider']
|
NDialogProvider: typeof import('naive-ui')['NDialogProvider']
|
||||||
NDropdown: typeof import('naive-ui')['NDropdown']
|
NDropdown: typeof import('naive-ui')['NDropdown']
|
||||||
@ -28,7 +27,6 @@ declare module 'vue' {
|
|||||||
NPagination: typeof import('naive-ui')['NPagination']
|
NPagination: typeof import('naive-ui')['NPagination']
|
||||||
NSelect: typeof import('naive-ui')['NSelect']
|
NSelect: typeof import('naive-ui')['NSelect']
|
||||||
NSpace: typeof import('naive-ui')['NSpace']
|
NSpace: typeof import('naive-ui')['NSpace']
|
||||||
NSwitch: typeof import('naive-ui')['NSwitch']
|
|
||||||
NTag: typeof import('naive-ui')['NTag']
|
NTag: typeof import('naive-ui')['NTag']
|
||||||
NTooltip: typeof import('naive-ui')['NTooltip']
|
NTooltip: typeof import('naive-ui')['NTooltip']
|
||||||
RouterLink: typeof import('vue-router')['RouterLink']
|
RouterLink: typeof import('vue-router')['RouterLink']
|
||||||
|
|||||||
483
fe/dist/assets/DomainManager-2SUOMVR8.js
vendored
Normal file
483
fe/dist/assets/DomainManager-2SUOMVR8.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1525
fe/dist/assets/FormItem-DHmVxm6n.js
vendored
Normal file
1525
fe/dist/assets/FormItem-DHmVxm6n.js
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
fe/dist/assets/IBMPlexMono-Regular-CAJ2AE84.ttf
vendored
Normal file
BIN
fe/dist/assets/IBMPlexMono-Regular-CAJ2AE84.ttf
vendored
Normal file
Binary file not shown.
BIN
fe/dist/assets/LatoLatin-Regular-Dmlz1U0B.woff2
vendored
Normal file
BIN
fe/dist/assets/LatoLatin-Regular-Dmlz1U0B.woff2
vendored
Normal file
Binary file not shown.
BIN
fe/dist/assets/LatoLatin-Semibold-Dbk81p2D.woff2
vendored
Normal file
BIN
fe/dist/assets/LatoLatin-Semibold-Dbk81p2D.woff2
vendored
Normal file
Binary file not shown.
1
fe/dist/assets/UrlManager-DG8i4_QJ.js
vendored
Normal file
1
fe/dist/assets/UrlManager-DG8i4_QJ.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
fe/dist/assets/index-Ca0u0JBQ.css
vendored
Normal file
1
fe/dist/assets/index-Ca0u0JBQ.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1161
fe/dist/assets/index-DnpM0Ntg.js
vendored
Normal file
1161
fe/dist/assets/index-DnpM0Ntg.js
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
fe/dist/favicon.ico
vendored
Normal file
BIN
fe/dist/favicon.ico
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
14
fe/dist/index.html
vendored
Normal file
14
fe/dist/index.html
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<link rel="icon" href="/favicon.ico">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Baidu Reporter</title>
|
||||||
|
<script type="module" crossorigin src="/assets/index-DnpM0Ntg.js"></script>
|
||||||
|
<link rel="stylesheet" crossorigin href="/assets/index-Ca0u0JBQ.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user