@@ -12,7 +12,7 @@ class apps {
1212 public static function get () : array {
1313 $ fn = [
1414 'appslash ' => function (string $ value , int $ i , array $ tokens , string $ match ) : array {
15- if (\mb_stripos ($ value , 'AppleWebKit ' ) === false && !\str_contains ($ value , ':// ' )) {
15+ if (\mb_stripos ($ value , 'AppleWebKit ' ) === false && !\str_contains ($ value , ':// ' ) && ! \str_starts_with ( $ value , ' appid/ ' ) ) {
1616 $ parts = \explode ('/ ' , $ value , 4 );
1717 $ offset = isset ($ parts [2 ]) && !\is_numeric ($ parts [1 ]) ? 1 : 0 ;
1818 $ app = \str_replace ('GooglePlayStore ' , '' , $ parts [0 + $ offset ]);
@@ -212,6 +212,11 @@ public static function get() : array {
212212 'appname ' => 'nu.nl ' ,
213213 'appversion ' => \mb_substr ($ value , 6 )
214214 ]),
215+ 'Sanoma/app ' => new props ('exact ' , fn () : array => [
216+ 'type ' => 'human ' ,
217+ 'app ' => 'Sanoma ' ,
218+ 'appname ' => 'Sanoma '
219+ ]),
215220 'Google Web Preview ' => new props ('start ' , $ fn ['appslash ' ]),
216221 'MicroMessenger/ ' => new props ('start ' , $ fn ['appslash ' ]),
217222 'MicroMessenger Weixin QQ ' => new props ('start ' , fn () : array => [
@@ -220,15 +225,26 @@ public static function get() : array {
220225 ]),
221226 'weibo ' => new props ('any ' , function (string $ value ) : array {
222227 $ data = [
228+ 'type ' => 'human ' ,
223229 'app ' => 'Weibo ' ,
224230 'appname ' => 'Weibo '
225231 ];
226- $ parts = \explode ('_ ' , $ value );
227- foreach ($ parts AS $ i => $ item ) {
228- if (\mb_stripos ($ item , 'Weibo ' ) !== false ) {
229- $ data ['appname ' ] = $ item ;
230- $ data ['appversion ' ] = $ parts [$ i + (\strspn ($ parts [$ i + 1 ] ?? '' , '0123456789 ' , 0 , 1 ) === 1 ? 1 : 2 )] ?? null ;
231- break ;
232+ if (\str_contains ($ value , '__ ' )) {
233+ $ parts = \explode ('__ ' , $ value );
234+ $ data = \array_merge ($ data , devices::getDevice ($ parts [0 ]), [
235+ 'appname ' => $ parts [1 ],
236+ 'appversion ' => $ parts [2 ] ?? null ,
237+ 'platform ' => isset ($ parts [3 ]) ? platforms::getPlatform ($ parts [3 ]) : null ,
238+ 'platformversion ' => isset ($ parts [4 ]) ? \substr ($ parts [4 ], \strcspn ($ parts [4 ], '0123456789. ' )) : null
239+ ]);
240+ } else {
241+ $ parts = \explode ('_ ' , $ value );
242+ foreach ($ parts AS $ i => $ item ) {
243+ if (\mb_stripos ($ item , 'Weibo ' ) !== false ) {
244+ $ data ['appname ' ] = $ item ;
245+ $ data ['appversion ' ] = $ parts [$ i + (\strspn ($ parts [$ i + 1 ] ?? '' , '0123456789 ' , 0 , 1 ) === 1 ? 1 : 2 )] ?? null ;
246+ break ;
247+ }
232248 }
233249 }
234250 return $ data ;
@@ -240,34 +256,40 @@ public static function get() : array {
240256 'FBAN/MessengerLiteForiOS ' => [
241257 'type ' => 'human ' ,
242258 'app ' => 'Facebook Messenger ' ,
259+ 'appname ' => 'MessengerLiteForiOS ' ,
243260 'platform ' => 'iOS '
244261 ],
245262 'FBAN/FB4A ' => [
246263 'type ' => 'human ' ,
247264 'app ' => 'Facebook ' ,
265+ 'appname ' => 'FB4A ' ,
248266 'platform ' => 'Android '
249267 ],
250268 'FBAN/FBIOS ' => [
251269 'type ' => 'human ' ,
252270 'app ' => 'Facebook ' ,
271+ 'appname ' => 'FBIOS ' ,
253272 'platform ' => 'iOS '
254273 ],
255274 'FBAN/FB4FireTV ' => [
256275 'type ' => 'human ' ,
257276 'category ' => 'tv ' ,
258277 'app ' => 'Facebook ' ,
278+ 'appname ' => 'FB4FireTV ' ,
259279 'platform ' => 'Android '
260280 ],
261281 'FBAN/MessengerDesktop ' => [
262282 'type ' => 'human ' ,
263283 'category ' => 'desktop ' ,
264- 'app ' => 'Facebook Messenger '
284+ 'app ' => 'Facebook Messenger ' ,
285+ 'appname ' => 'MessengerDesktop '
265286 ],
266287 'FacebookCanvasDesktop FBAN/GamesWindowsDesktopApp ' => [
267288 'type ' => 'human ' ,
268289 'platform ' => 'Windows ' ,
269290 'category ' => 'desktop ' ,
270- 'app ' => 'Facebook Gamesroom '
291+ 'app ' => 'Facebook Gamesroom ' ,
292+ 'appname ' => 'GamesWindowsDesktopApp '
271293 ]
272294 ];
273295 return \array_merge ([
@@ -277,21 +299,47 @@ public static function get() : array {
277299 ], $ map [$ value ] ?? []);
278300 }),
279301 'FB_IAB/ ' => new props ('start ' , fn (string $ value ) : array => [
302+ 'type ' => 'human ' ,
280303 'app ' => 'Facebook ' ,
281304 'appname ' => \mb_substr ($ value , 7 )
282305 ]),
306+ 'FBPN/ ' => new props ('start ' , fn (string $ value ) : array => [
307+ 'type ' => 'human ' ,
308+ 'app ' => 'Facebook ' ,
309+ 'appname ' => \mb_substr ($ value , 5 )
310+ ]),
283311 'FBAV/ ' => new props ('start ' , fn (string $ value ) : array => [
312+ 'type ' => 'human ' ,
313+ 'app ' => 'Facebook ' ,
314+ 'appname ' => 'Facebook ' ,
284315 'appversion ' => \mb_substr ($ value , 5 )
285316 ]),
286317 'FBMF/ ' => new props ('start ' , fn (string $ value ) : array => [
318+ 'type ' => 'human ' ,
319+ 'app ' => 'Facebook ' ,
320+ 'appname ' => 'Facebook ' ,
287321 'vendor ' => devices::getVendor (\mb_substr ($ value , 5 ))
288322 ]),
289- 'FBDV/ ' => new props ('start ' , fn (string $ value ) : array => devices::getDevice (\mb_substr ($ value , 5 ))),
323+ 'FBDV/ ' => new props ('start ' , fn (string $ value ) : array => \array_merge (
324+ devices::getDevice (\mb_substr ($ value , 5 ))),
325+ [
326+ 'type ' => 'human ' ,
327+ 'app ' => 'Facebook ' ,
328+ 'appname ' => 'Facebook '
329+ ]
330+ ),
290331 'FBMD/ ' => new props ('start ' , fn (string $ value ) : array => [
332+ 'type ' => 'human ' ,
333+ 'app ' => 'Facebook ' ,
334+ 'appname ' => 'Facebook ' ,
291335 'model ' => \mb_substr ($ value , 5 )
292336 ]),
293337 'FBDM/ ' => new props ('start ' , function (string $ value ) : array {
294- $ data = [];
338+ $ data = [
339+ 'type ' => 'human ' ,
340+ 'app ' => 'Facebook ' ,
341+ 'appname ' => 'Facebook '
342+ ];
295343 foreach (\explode (', ' , \trim (\mb_substr ($ value , 5 ), '{} ' )) AS $ item ) {
296344 $ parts = \explode ('= ' , $ item );
297345 if (!empty ($ parts [1 ])) {
@@ -303,19 +351,16 @@ public static function get() : array {
303351 }
304352 return $ data ;
305353 }),
306- 'width= ' => new props ('start ' , fn (string $ value ) : array => [
307- 'width ' => \intval (\mb_substr ($ value , 6 ))
308- ]),
309- 'height= ' => new props ('start ' , fn (string $ value ) : array => [
310- 'height ' => \intval (\mb_substr ($ value , 7 ))
311- ]),
312- 'dpi= ' => new props ('start ' , fn (string $ value ) : array => [
313- 'dpi ' => \mb_substr ($ value , 4 )
314- ]),
315354 'FBSN/ ' => new props ('start ' , fn (string $ value ) : array => [
355+ 'type ' => 'human ' ,
356+ 'app ' => 'Facebook ' ,
357+ 'appname ' => 'Facebook ' ,
316358 'platform ' => \mb_substr ($ value , 5 )
317359 ]),
318360 'FBSV ' => new props ('start ' , fn (string $ value ) : array => [
361+ 'type ' => 'human ' ,
362+ 'app ' => 'Facebook ' ,
363+ 'appname ' => 'Facebook ' ,
319364 'platformversion ' => \mb_substr ($ value , 5 )
320365 ]),
321366 'isDarkMode/ ' => new props ('start ' , function (string $ value ) : array {
@@ -324,12 +369,10 @@ public static function get() : array {
324369 'darkmode ' => \in_array ($ mode , ['0 ' , '1 ' ], true ) ? \boolval ($ mode ) : null
325370 ];
326371 }),
372+ 'dark-mode ' => new props ('exact ' , ['darkmode ' => true ]),
327373 'AppTheme/ ' => new props ('start ' , fn (string $ value ) : array => [
328374 'darkmode ' => \mb_substr ($ value , 9 ) === 'dark '
329375 ]),
330- 'NetType/ ' => new props ('start ' , fn (string $ value ) : array => [
331- 'nettype ' => \mb_convert_case (\mb_substr ($ value , 8 ), MB_CASE_UPPER )
332- ]),
333376 'Microsoft Office ' => new props ('start ' , function (string $ value , int $ i , array $ tokens ) : array {
334377 $ data = [
335378 'type ' => 'human '
0 commit comments