@@ -74,29 +74,16 @@ public static function sendUsageData(Config $config): void
74
74
return ;
75
75
}
76
76
77
- $ prefs = Info:: getPrefs ( );
77
+ $ tailscaleInfo = new Info ( new Translator () );
78
78
79
+ $ prefs = Info::getPrefs ();
79
80
if (isset ($ prefs ->LoggedOut ) ? ($ prefs ->LoggedOut ? true : false ) : true ) {
80
81
Utils::logmsg ("Skipping usage data collection; not logged in. " );
81
82
return ;
82
83
}
83
84
84
- $ exit = false ;
85
- $ subnet = false ;
86
85
$ customControl = false ;
87
86
88
- foreach (($ prefs ->AdvertiseRoutes ?? array ()) as $ net ) {
89
- switch ($ net ) {
90
- case "0.0.0.0/0 " :
91
- case "::/0 " :
92
- $ exit = true ;
93
- break ;
94
- default :
95
- $ subnet = true ;
96
- break ;
97
- }
98
- }
99
-
100
87
if ($ prefs ->ControlURL != "https://controlplane.tailscale.com " ) {
101
88
$ customControl = true ;
102
89
}
@@ -107,11 +94,11 @@ public static function sendUsageData(Config $config): void
107
94
'plugin_version ' => $ version ['VERSION ' ],
108
95
'plugin_branch ' => $ version ['BRANCH ' ],
109
96
'unraid_version ' => $ var ['version ' ],
110
- 'bool1 ' => $ config -> AllowDNS ,
111
- 'bool2 ' => $ config -> AllowRoutes ,
97
+ 'bool1 ' => $ tailscaleInfo -> acceptsDNS () ,
98
+ 'bool2 ' => $ tailscaleInfo -> acceptsRoutes () ,
112
99
'bool3 ' => $ config ->IncludeInterface ,
113
- 'bool4 ' => $ subnet ,
114
- 'bool5 ' => $ exit ,
100
+ 'bool4 ' => ( bool ) $ tailscaleInfo -> getAdvertisedRoutes () ,
101
+ 'bool5 ' => $ tailscaleInfo -> advertisesExitNode () ,
115
102
'num1 ' => $ customControl ? 0 : 1
116
103
);
117
104
0 commit comments