File tree 1 file changed +18
-0
lines changed
Filter options
1 file changed +18
-0
lines changed
Original file line number Diff line number Diff line change @@ -67,6 +67,24 @@ func (s *arduinoCoreServerImpl) Create(ctx context.Context, req *rpc.CreateReque
67
67
var userAgent string
68
68
if md , ok := metadata .FromIncomingContext (ctx ); ok {
69
69
userAgent = strings .Join (md .Get ("user-agent" ), " " )
70
+ if userAgent != "" {
71
+ // s.SettingsGetValue() returns an error if the key does not exist and for this reason we are accessing
72
+ // network.user_agent_ext directly from s.settings.ExtraUserAgent() to set it
73
+ if s .settings .ExtraUserAgent () == "" {
74
+ if strings .Contains (userAgent , "arduino-ide/2" ) {
75
+ // needed for analytics purposes
76
+ userAgent = userAgent + " daemon"
77
+ }
78
+ _ , err := s .SettingsSetValue (ctx , & rpc.SettingsSetValueRequest {
79
+ Key : "network.user_agent_ext" ,
80
+ ValueFormat : "cli" ,
81
+ EncodedValue : userAgent ,
82
+ })
83
+ if err != nil {
84
+ return nil , err
85
+ }
86
+ }
87
+ }
70
88
}
71
89
72
90
// Setup downloads directory
You can’t perform that action at this time.
0 commit comments