mirror of
https://github.com/shadow1ng/fscan.git
synced 2026-09-22 03:10:42 +08:00
feat: Web 版独立入口 + SQLite 持久化存储
- 拆分 main.go 为 main_cli.go 和 main_web.go,Web 版不再包含 CLI 参数解析 - Web 版直接启动 HTTP 服务,通过 -port/-lang 控制,无需 -web flag - 结果存储从内存 map 替换为 SQLite(modernc.org/sqlite,纯 Go 零 CGO) - 数据库文件 ~/.fscan/results.db,进程重启后结果不丢失 - 修复结果分布面板跟随 tab 筛选联动的问题
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
||||
//go:build web
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/shadow1ng/fscan/common"
|
||||
"github.com/shadow1ng/fscan/common/i18n"
|
||||
"github.com/shadow1ng/fscan/web"
|
||||
|
||||
// 导入统一插件系统
|
||||
_ "github.com/shadow1ng/fscan/plugins/local"
|
||||
_ "github.com/shadow1ng/fscan/plugins/services"
|
||||
_ "github.com/shadow1ng/fscan/plugins/web"
|
||||
)
|
||||
|
||||
func main() {
|
||||
port := flag.Int("port", 10240, "Web server listen port")
|
||||
lang := flag.String("lang", "zh", "Language (zh/en)")
|
||||
flag.Parse()
|
||||
|
||||
i18n.SetLanguage(*lang)
|
||||
|
||||
fmt.Printf("fscan web v%s\n", common.GetVersion())
|
||||
|
||||
if err := web.StartServer(*port); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user