MCPcopy Index your code
hub / github.com/dnote/dnote / getClientType

Function getClientType

pkg/server/controllers/helpers.go:304–321  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

302}
303
304func getClientType(r *http.Request) string {
305 origin := r.Header.Get("Origin")
306
307 if strings.HasPrefix(origin, "moz-extension://") {
308 return "firefox-extension"
309 }
310
311 if strings.HasPrefix(origin, "chrome-extension://") {
312 return "chrome-extension"
313 }
314
315 userAgent := r.Header.Get("User-Agent")
316 if strings.HasPrefix(userAgent, "Go-http-client") {
317 return "cli"
318 }
319
320 return "web"
321}

Callers 1

createMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected