feat: 抖音直播间弹幕监控 - Go+Wails 实现
后端: - SQLite 数据层 (rooms/users/chat_logs/settings/error_logs) - 抖音 WebSocket 抓取器 (proto 解析, 心跳, watchdog) - __ac_signature 算法 (纯 Go 移植) - a_bogus/sign.js 签名 (goja JS 引擎) - Echo HTTP API 服务器 (端口 5000) - SSE 事件广播 - 自动保活 + 授权守护 - PAYS 云授权对接 前端: - 顶栏: 品牌 + 日志/调试/客户名单/授权/文档/房间控制/主题切换 - 添加直播间 (链接解析 + 关键词) - Dashboard (卡片/列表视图, 公开/匿名房筛选, 分页) - 详情页 (多 tab 消息流, 右侧用户面板, 颜色标记, 精准客户, 已看标记) - 精准客户名单 (跨房间汇总) - 订阅授权页面 (登录/注册/购买) - 使用帮助 + 系统调试 - 白昼/黑夜主题切换 (CSS 变量 + iconfont) - 底部版权栏
This commit is contained in:
77
main.go
Normal file
77
main.go
Normal file
@@ -0,0 +1,77 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"embed"
|
||||
"log"
|
||||
"net/http"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/wailsapp/wails/v2"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
||||
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
||||
"github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
|
||||
"github.com/qingwuyingxing/douyin-live-fetcher/internal/api"
|
||||
"github.com/qingwuyingxing/douyin-live-fetcher/internal/broadcaster"
|
||||
"github.com/qingwuyingxing/douyin-live-fetcher/internal/db"
|
||||
)
|
||||
|
||||
//go:embed all:frontend/dist
|
||||
//go:embed assets/icon.png
|
||||
//go:embed build/windows/icon.ico
|
||||
var assets embed.FS
|
||||
|
||||
var (
|
||||
forceQuit atomic.Bool
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := db.InitDB(); err != nil {
|
||||
log.Printf("[main] db init error: %v", err)
|
||||
}
|
||||
|
||||
bc := broadcaster.NewBroadcaster()
|
||||
|
||||
go func() {
|
||||
if err := api.StartServer(bc, http.FS(assets), 5000); err != nil {
|
||||
log.Printf("[main] API server error: %v", err)
|
||||
}
|
||||
}()
|
||||
|
||||
for i := 0; i < 30; i++ {
|
||||
if resp, err := http.Get("http://127.0.0.1:5000/api/status"); err == nil {
|
||||
resp.Body.Close()
|
||||
break
|
||||
}
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
}
|
||||
log.Println("[main] API server ready")
|
||||
|
||||
cfg := &options.App{
|
||||
Title: "青梧映星",
|
||||
Width: 1280,
|
||||
Height: 800,
|
||||
MinWidth: 1024,
|
||||
MinHeight: 600,
|
||||
WindowStartState: options.Normal,
|
||||
AssetServer: &assetserver.Options{Assets: assets},
|
||||
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
|
||||
Windows: &windows.Options{Theme: windows.SystemDefault},
|
||||
OnBeforeClose: func(ctx context.Context) bool {
|
||||
if forceQuit.Load() { return false }
|
||||
runtime.WindowHide(ctx)
|
||||
return true
|
||||
},
|
||||
OnShutdown: func(context.Context) {
|
||||
forceQuit.Store(true)
|
||||
},
|
||||
Bind: []interface{}{&App{}},
|
||||
}
|
||||
|
||||
if err := wails.Run(cfg); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user