@@ -221,29 +221,11 @@ export class HwidUserDevicesRepository
221
221
const appStats = await this . qb . kysely
222
222
. selectFrom ( 'hwidUserDevices' )
223
223
. select ( [
224
- sql < string > `
225
- CASE
226
- WHEN LOWER("user_agent") ~ '^(flclash|flclash x)' THEN 'FlClashX'
227
- WHEN LOWER("user_agent") ~ '^koala-clash' THEN 'KoalaClash'
228
- WHEN LOWER("user_agent") ~ '^v2raytun' THEN 'v2rayTUN'
229
- WHEN LOWER("user_agent") ~ '^happ' THEN 'Happ'
230
- ELSE 'Unknown'
231
- END
232
- ` . as ( 'app' ) ,
224
+ sql < string > `SPLIT_PART("user_agent", '/', 1)` . as ( 'app' ) ,
233
225
( eb ) => eb . fn . count ( 'hwid' ) . as ( 'count' ) ,
234
226
] )
235
227
. where ( 'userAgent' , 'is not' , null )
236
- . groupBy (
237
- sql `
238
- CASE
239
- WHEN LOWER("user_agent") ~ '^(flclash|flclash x)' THEN 'FlClashX'
240
- WHEN LOWER("user_agent") ~ '^koala-clash' THEN 'KoalaClash'
241
- WHEN LOWER("user_agent") ~ '^v2raytun' THEN 'v2rayTUN'
242
- WHEN LOWER("user_agent") ~ '^happ' THEN 'Happ'
243
- ELSE 'Unknown'
244
- END
245
- ` ,
246
- )
228
+ . groupBy ( sql `SPLIT_PART("user_agent", '/', 1)` )
247
229
. orderBy ( 'count' , 'desc' )
248
230
. execute ( ) ;
249
231
@@ -267,10 +249,12 @@ export class HwidUserDevicesRepository
267
249
platform : stat . platform || 'Unknown' ,
268
250
count : Number ( stat . count ) ,
269
251
} ) ) ,
270
- byApp : appStats . map ( ( stat ) => ( {
271
- app : stat . app ,
272
- count : Number ( stat . count ) ,
273
- } ) ) ,
252
+ byApp : appStats
253
+ . filter ( ( stat ) => ! stat . app . startsWith ( 'https:' ) )
254
+ . map ( ( stat ) => ( {
255
+ app : stat . app ,
256
+ count : Number ( stat . count ) ,
257
+ } ) ) ,
274
258
stats : {
275
259
totalUniqueDevices : Number ( totalStats . totalUniqueDevices ) ,
276
260
totalHwidDevices : Number ( totalStats . totalHwidDevices ) ,
0 commit comments