X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalytics%2FPlausible.java;h=ab2de77c24fcbc4c2aabf026a6633011980530d7;hb=refs%2Fheads%2Ffeature%2FJAL-4274_configurable_bitmap_export_preferences;hp=b703c6931e2aaea1f13b978cb3e8dbc95f8e0c1d;hpb=1f9ca4896d57bfb16a25c87cfc0b8cd19fcdf148;p=jalview.git diff --git a/src/jalview/analytics/Plausible.java b/src/jalview/analytics/Plausible.java index b703c69..ab2de77 100644 --- a/src/jalview/analytics/Plausible.java +++ b/src/jalview/analytics/Plausible.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.analytics; import java.io.BufferedReader; @@ -19,6 +39,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Random; import jalview.bin.Cache; import jalview.bin.Console; @@ -27,19 +48,20 @@ import jalview.util.HttpUtils; public class Plausible { - private static final String USER_AGENT = HttpUtils.getUserAgent( - MethodHandles.lookup().lookupClass().getCanonicalName()); + private static final String USER_AGENT; private static final String JALVIEW_ID = "Jalview Desktop"; private static final String DOMAIN = "jalview.org"; - private static final String CONFIG_API_BASE_URL = "https://www.jalview.org/services/analytics/config/url"; + private static final String CONFIG_API_BASE_URL = "https://www.jalview.org/services/config/analytics/url"; - private static final String DEFAULT_API_BASE_URL = "https://plausible.io/api/event"; + private static final String DEFAULT_API_BASE_URL = "https://analytics.jalview.org/api/event"; private static final String API_BASE_URL; + private static final String clientId; + public static final String APPLICATION_BASE_URL = "desktop://localhost"; private List> queryStringValues; @@ -96,6 +118,13 @@ public class Plausible // ascertain the API_BASE_URL API_BASE_URL = getAPIBaseURL(); + + // random clientId to make User-Agent unique (to register analytic) + clientId = String.format("%08x", new Random().nextInt()); + + USER_AGENT = HttpUtils.getUserAgent( + MethodHandles.lookup().lookupClass().getCanonicalName() + " " + + clientId); } private Plausible()