File tree Expand file tree Collapse file tree 4 files changed +9
-8
lines changed
src/main/java/co/casterlabs/swetrix Expand file tree Collapse file tree 4 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ swetrix.startHeartbeat(); // This updates your "Live visitors" statistic in Swet
3030 <dependency >
3131 <groupId >co.casterlabs</groupId >
3232 <artifactId >swetrix-java</artifactId >
33- <version >1.1.0 </version >
33+ <version >LATEST_VERSION_HERE </version >
3434 <scope >compile</scope >
3535 </dependency >
3636 </dependencies >
Original file line number Diff line number Diff line change 44 <modelVersion >4.0.0</modelVersion >
55 <groupId >co.casterlabs</groupId >
66 <artifactId >swetrix-java</artifactId >
7- <version >1.1.0 </version >
7+ <version >1.1.1 </version >
88
99 <properties >
1010 <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
Original file line number Diff line number Diff line change 1616class HttpUtil {
1717 private static final OkHttpClient client = new OkHttpClient ();
1818 private static final MediaType applicationJson = MediaType .parse ("application/json" );
19- private static final String userAgent ;
19+ static final String userAgent ;
2020
2121 static {
2222 // The following device agents are just here to get Swetrix to count the device
2323 // type properly. They just need to *vaguely* represent the device.
2424 String device = "" ;
2525
2626 if (System .getProperty ("java.specification.vendor" , "" ).equals ("The Android Project" )) {
27- device = "(Linux; U; Android 0.0.0 ) Mobile " ;
27+ device = "(Linux; Android 13 ) Mobile " ;
2828 } else {
2929 String osName = System .getProperty ("os.name" ).toLowerCase ();
3030
31- if (osName .matches ("mac| darwin" )) {
31+ if (osName .contains ("mac" ) || osName . contains ( " darwin" )) {
3232 device = "(Macintosh; Intel Mac OS X 10_15_7) " ;
33- } else if (osName .matches ("nux" )) {
33+ } else if (osName .contains ("nux" )) {
3434 device = "(X11; Linux; Linux x86_64; rv:15.0) " ;
35- } else if (osName .matches ("win" )) {
35+ } else if (osName .contains ("win" )) {
3636 device = "(Windows NT 10.0; Win64; x64) " ;
3737 }
3838 }
3939
40- userAgent = String .format ("%sSwetrix; Casterlabs -SDK 1.0.0 " , device );
40+ userAgent = String .format ("%sCasterlabs -SDK/Swetrix " , device );
4141 }
4242
4343 static @ Nullable JsonObject post (@ NonNull String url , @ NonNull JsonObject body ) throws IOException {
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ private Swetrix(Builder config) {
4747
4848 if (this .config .debugEnabled ) {
4949 this .logger .debug ("Debug mode enabled! Using config: %s" , this .config );
50+ this .logger .debug ("User agent: %s" , HttpUtil .userAgent );
5051 }
5152 }
5253
You can’t perform that action at this time.
0 commit comments