diff --git a/src/main/java/com/nonononoki/alovoa/Tools.java b/src/main/java/com/nonononoki/alovoa/Tools.java index 5d91ff58..028b14a6 100644 --- a/src/main/java/com/nonononoki/alovoa/Tools.java +++ b/src/main/java/com/nonononoki/alovoa/Tools.java @@ -111,7 +111,7 @@ public static boolean binaryStringToBoolean(String b) { public static int getDistanceToUser(User user, User currUser) { try { - return calcDistance(user.getLocationLatitude(), user.getLocationLongitude(), + return calcDistanceKm(user.getLocationLatitude(), user.getLocationLongitude(), currUser.getLocationLatitude(), currUser.getLocationLongitude()); } catch (Exception e) { return 99999; @@ -119,6 +119,7 @@ public static int getDistanceToUser(User user, User currUser) { } // https://stackoverflow.com/a/45732035 + // CC BY-SA 3.0, Pedro Silva public static Double getBase64Size(String base64String) { Double result = -1.0; if (!base64String.isEmpty()) { @@ -135,19 +136,17 @@ public static Double getBase64Size(String base64String) { } // https://stackoverflow.com/questions/3694380/calculating-distance-between-two-points-using-latitude-longitude/20410612#20410612 - // to km - public static int calcDistance(double lat1, double lng1, double lat2, double lng2) { + // CC BY-SA 4.0 Arman Ebrahimpour, CC BY-SA 3.0 zahmde + public static int calcDistanceKm(double lat1, double lng1, double lat2, double lng2) { double a = (lat1 - lat2) * distPerLat(lat1); double b = (lng1 - lng2) * distPerLng(lat1); double dist = Math.sqrt(a * a + b * b); return (int) dist / THOUSAND; } - private static double distPerLng(double lat) { return 0.0003121092 * Math.pow(lat, 4) + 0.0101182384 * Math.pow(lat, 3) - 17.2385140059 * lat * lat + 5.5485277537 * lat + 111301.967182595; } - private static double distPerLat(double lat) { return -0.000000487305676 * Math.pow(lat, 4) - 0.0033668574 * Math.pow(lat, 3) + 0.4601181791 * lat * lat - 1.4558127346 * lat + 110579.25662316; diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 0889ee08..5a05395f 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -186,11 +186,10 @@ bucket4j.filters[14].rate-limits[0].bandwidths[0].time=120 bucket4j.filters[14].rate-limits[0].bandwidths[0].unit=seconds - # custom values app.company.name=Alovoa -app.privacy.update-date=2000-01-01 -app.tos.update-date=2000-01-01 +app.privacy.update-date=2021-06-05 +app.tos.update-date=2021-06-05 app.name=Alovoa app.domain=https://localhost:8443 diff --git a/src/main/resources/templates/imprint.html b/src/main/resources/templates/imprint.html index 91bce356..e2e619bf 100644 --- a/src/main/resources/templates/imprint.html +++ b/src/main/resources/templates/imprint.html @@ -22,9 +22,9 @@

Nho Quy Dinh

-

Impressumsstraße 7, 22222 Impressumsstadt

-

contact@alovoa.com

-

DE 12345678901

+

Neulanderweg 18, 21423 Winsen Luhe

+

Tel: 015678593504

+

info@alovoa.com

diff --git a/src/test/java/com/nonononoki/alovoa/ToolsTest.java b/src/test/java/com/nonononoki/alovoa/ToolsTest.java index 294fe246..4e5996b2 100644 --- a/src/test/java/com/nonononoki/alovoa/ToolsTest.java +++ b/src/test/java/com/nonononoki/alovoa/ToolsTest.java @@ -7,13 +7,13 @@ class ToolsTest { @Test void test() throws Exception { - int dist = (int)Math.round(Tools.calcDistance(0, 0, 0, 0)); + int dist = (int)Math.round(Tools.calcDistanceKm(0, 0, 0, 0)); Assert.assertEquals(0, dist); - int dist2 = (int)Math.round(Tools.calcDistance(0.45, 0, 0, 0)); + int dist2 = (int)Math.round(Tools.calcDistanceKm(0.45, 0, 0, 0)); Assert.assertEquals(49, dist2); - int dist3 = (int)Math.round(Tools.calcDistance(0.46, 0, 0, 0)); + int dist3 = (int)Math.round(Tools.calcDistanceKm(0.46, 0, 0, 0)); Assert.assertEquals(50, dist3); } }