mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 14:06:36 +08:00
00593742c3
Add a separate ClickHouse OLAP pipeline with goose/clickhouse DDL as the sole schema source, model/analytics for ORM mapping, and repository/analytics for reads (ChDB/GORM) and batch writes (ChConn). Refactor risk_control and admin/logs to use the repository layer instead of inline SQL. Remove the manual support-files DDL and document the workflow in database-migration skill.
30 lines
696 B
Go
30 lines
696 B
Go
// Copyright 2026 Arctel.net
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package analytics
|
|
|
|
import "strings"
|
|
|
|
// ParseBrowserName performs lightweight User-Agent browser identification.
|
|
func ParseBrowserName(ua string) string {
|
|
uaLower := strings.ToLower(ua)
|
|
if strings.Contains(uaLower, "micromessenger") {
|
|
return "WeChat"
|
|
}
|
|
if strings.Contains(uaLower, "postman") {
|
|
return "Postman"
|
|
}
|
|
if strings.Contains(uaLower, "edg/") || strings.Contains(uaLower, "edge") {
|
|
return "Edge"
|
|
}
|
|
if strings.Contains(uaLower, "firefox") {
|
|
return "Firefox"
|
|
}
|
|
if strings.Contains(uaLower, "chrome") {
|
|
return "Chrome"
|
|
}
|
|
if strings.Contains(uaLower, "safari") {
|
|
return "Safari"
|
|
}
|
|
return "Other"
|
|
} |