Skip to content

Commit

Permalink
Merge branch 'traccar:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-wolf-gb authored Apr 8, 2024
2 parents 80e4c30 + 569bb18 commit 908271c
Show file tree
Hide file tree
Showing 39 changed files with 261 additions and 159 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: zulu
distribution: temurin
java-version: 11
cache: gradle
- run: ./gradlew build --no-daemon --warning-mode=fail
29 changes: 11 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,25 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- run: git checkout ${{ github.ref_name }}
working-directory: ./traccar-web
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
java-version: 21
cache: gradle
- run: ./gradlew build
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 21
cache: npm
cache-dependency-path: |
traccar-web/package-lock.json
traccar-web/modern/package-lock.json
- run: |
wget -q https://traccar.nyc3.digitaloceanspaces.com/download/SenchaCmd-7.6.0.87-linux-amd64.sh.zip
unzip SenchaCmd-*.zip
./SenchaCmd-*.sh -q
echo "$HOME/bin/Sencha/Cmd/" >> $GITHUB_PATH
- run: ./traccar-web/tools/package.sh
cache-dependency-path: traccar-web/package-lock.json
- run: npm ci && npm run build
working-directory: ./traccar-web
- run: |
sudo dpkg --add-architecture i386
sudo apt-get update
Expand All @@ -48,10 +42,9 @@ jobs:
working-directory: ./setup
run: |
wget -q http://files.jrsoftware.org/is/5/isetup-5.5.6.exe
wget -q https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6+10/OpenJDK17U-jdk_x64_windows_hotspot_17.0.6_10.zip
wget -q https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6+10/OpenJDK17U-jdk_x64_linux_hotspot_17.0.6_10.tar.gz
wget -q https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6+10/OpenJDK17U-jdk_arm_linux_hotspot_17.0.6_10.tar.gz
wget -q https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.6+10/OpenJDK17U-jdk_aarch64_linux_hotspot_17.0.6_10.tar.gz
wget -q https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2+13/OpenJDK21U-jdk_x64_windows_hotspot_21.0.2_13.zip
wget -q https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2+13/OpenJDK21U-jdk_x64_linux_hotspot_21.0.2_13.tar.gz
wget -q https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2+13/OpenJDK21U-jdk_aarch64_linux_hotspot_21.0.2_13.tar.gz
./package.sh ${{ github.event.inputs.version }}
- name: Upload installers
working-directory: ./setup
Expand Down
43 changes: 22 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ compileJava.options.encoding = "UTF-8"
jar.destinationDirectory = file("$projectDir/target")

checkstyle {
toolVersion = "10.12.5"
toolVersion = "10.15.0"
configFile = "gradle/checkstyle.xml" as File
checkstyleTest.enabled = false
}
Expand All @@ -27,12 +27,12 @@ enforce {

ext {
guiceVersion = "7.0.0"
jettyVersion = "11.0.19"
jettyVersion = "11.0.20"
jerseyVersion = "3.1.5"
jacksonVersion = "2.15.3" // same version as jersey-media-json-jackson dependency
protobufVersion = "3.25.2"
jxlsVersion = "2.14.0"
junitVersion = "5.10.1"
protobufVersion = "4.26.1"
jxlsVersion = "2.14.0" // version 3 requires java 17
junitVersion = "5.10.2"
}

protobuf {
Expand All @@ -42,15 +42,15 @@ protobuf {
}

dependencies {
implementation "commons-codec:commons-codec:1.16.0"
implementation "commons-codec:commons-codec:1.16.1"
implementation "com.h2database:h2:2.2.224"
implementation "com.mysql:mysql-connector-j:8.2.0"
implementation "org.mariadb.jdbc:mariadb-java-client:3.3.2"
implementation "org.postgresql:postgresql:42.7.1"
implementation "com.microsoft.sqlserver:mssql-jdbc:12.4.2.jre11"
implementation "com.mysql:mysql-connector-j:8.3.0"
implementation "org.mariadb.jdbc:mariadb-java-client:3.3.3"
implementation "org.postgresql:postgresql:42.7.3"
implementation "com.microsoft.sqlserver:mssql-jdbc:12.6.1.jre11"
implementation "com.zaxxer:HikariCP:5.1.0"
implementation "io.netty:netty-all:4.1.104.Final"
implementation "org.slf4j:slf4j-jdk14:2.0.11"
implementation "io.netty:netty-all:4.1.108.Final"
implementation "org.slf4j:slf4j-jdk14:2.0.12"
implementation "com.google.inject:guice:$guiceVersion"
implementation "com.google.inject.extensions:guice-servlet:$guiceVersion"
implementation "org.owasp.encoder:encoder:1.2.3"
Expand All @@ -76,30 +76,31 @@ dependencies {
implementation "org.apache.velocity:velocity-engine-core:2.3"
implementation "org.apache.velocity.tools:velocity-tools-generic:3.1"
implementation "org.apache.commons:commons-collections4:4.4"
implementation "org.mnode.ical4j:ical4j:3.2.14"
implementation "org.mnode.ical4j:ical4j:3.2.17"
implementation "org.locationtech.spatial4j:spatial4j:0.8"
implementation "org.locationtech.jts:jts-core:1.19.0"
implementation "net.java.dev.jna:jna-platform:5.14.0"
implementation "com.github.jnr:jnr-posix:3.1.18"
implementation "com.github.jnr:jnr-posix:3.1.19"
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "com.amazonaws:aws-java-sdk-sns:1.12.636"
implementation "org.apache.kafka:kafka-clients:3.6.1"
implementation "com.amazonaws:aws-java-sdk-sns:1.12.694"
implementation "org.apache.kafka:kafka-clients:3.7.0"
implementation "com.hivemq:hivemq-mqtt-client:1.3.3"
implementation "redis.clients:jedis:5.1.0"
implementation "redis.clients:jedis:5.1.2"
implementation "com.google.firebase:firebase-admin:9.2.0"
implementation "com.nimbusds:oauth2-oidc-sdk:11.9.1"
implementation "com.nimbusds:oauth2-oidc-sdk:11.10.1"
implementation "com.rabbitmq:amqp-client:5.20.0"
implementation "com.warrenstrange:googleauth:1.5.0"
implementation 'com.google.openlocationcode:openlocationcode:1.0.4'
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testImplementation "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
testImplementation "org.mockito:mockito-core:5.8.0"
testImplementation "org.mockito:mockito-core:5.11.0"
}

test {
useJUnitPlatform()
}

task copyDependencies(type: Copy) {
tasks.register('copyDependencies', Copy) {
into "$projectDir/target/lib"
from configurations.runtimeClasspath
}
Expand All @@ -109,7 +110,7 @@ jar {
manifest {
attributes(
"Main-Class": "org.traccar.Main",
"Implementation-Version": "5.12",
"Implementation-Version": "6.0",
"Class-Path": configurations.runtimeClasspath.files.collect { "lib/$it.name" }.join(" "))
}
}
4 changes: 2 additions & 2 deletions debug.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

<entry key='config.default'>./setup/default.xml</entry>

<entry key='web.path'>./traccar-web/web</entry>
<entry key='web.path'>./traccar-web/simple</entry>
<entry key='web.debug'>true</entry>
<entry key='web.console'>true</entry>

<entry key='geocoder.type'>test</entry>
<entry key='geocoder.type'>pluscodes</entry>

<entry key='media.path'>./target/media</entry>

Expand Down
4 changes: 2 additions & 2 deletions schema/changelog-4.0-clean.xml
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@
<column name="id" type="INT" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="registration" type="BOOLEAN" defaultValueBoolean="true">
<column name="registration" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false" />
</column>
<column name="latitude" type="DOUBLE" defaultValueNumeric="0">
Expand Down Expand Up @@ -614,7 +614,7 @@
<addForeignKeyConstraint baseTableName="tc_user_user" baseColumnNames="userid" constraintName="fk_user_user_userid" onDelete="CASCADE" referencedColumnNames="id" referencedTableName="tc_users" />

<insert tableName="tc_servers">
<column name="registration" valueBoolean="true" />
<column name="registration" valueBoolean="false" />
<column name="latitude" valueNumeric="0" />
<column name="longitude" valueNumeric="0" />
<column name="zoom" valueNumeric="0" />
Expand Down
2 changes: 1 addition & 1 deletion setup/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
-->

<entry key='web.port'>8082</entry>
<entry key='web.path'>./modern</entry>
<entry key='web.path'>./web</entry>
<entry key='web.sanitize'>false</entry>
<entry key='web.persistSession'>false</entry>
<entry key='web.showUnknownDevices'>true</entry>
Expand Down
26 changes: 5 additions & 21 deletions setup/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ usage () {
echo "Available platforms:"
echo " * linux-64"
echo " * linux-arm"
echo " * linux-arm64"
echo " * windows-64"
echo " * other"
exit 1
Expand Down Expand Up @@ -65,17 +64,14 @@ if [ $PLATFORM = "all" -o $PLATFORM = "windows-64" ]; then
check_requirement "Windows 64 Java" "ls OpenJDK*64_windows*.zip" "Missing Windows 64 JDK (https://adoptium.net/)"
check_requirement "Wine" "which wine" "Missing wine binary"
fi
if [ $PLATFORM = "all" -o $PLATFORM = "linux-64" -o $PLATFORM = "linux-arm" -o $PLATFORM = "linux-arm64" ]; then
if [ $PLATFORM = "all" -o $PLATFORM = "linux-64" -o $PLATFORM = "linux-arm" ]; then
check_requirement "Makeself" "which makeself" "Missing makeself binary"
fi
if [ $PLATFORM = "all" -o $PLATFORM = "linux-64" ]; then
check_requirement "Linux 64 Java" "ls OpenJDK*x64_linux*.tar.gz" "Missing Linux 64 JDK (https://adoptium.net/)"
fi
if [ $PLATFORM = "all" -o $PLATFORM = "linux-arm" ]; then
check_requirement "Linux ARM Java" "ls OpenJDK*arm_linux*.tar.gz" "Missing Linux ARM JDK (https://adoptium.net/)"
fi
if [ $PLATFORM = "all" -o $PLATFORM = "linux-arm64" ]; then
check_requirement "Linux ARM 64 Java" "ls OpenJDK*aarch64_linux*.tar.gz" "Missing Linux ARM 64 JDK (https://adoptium.net/)"
check_requirement "Linux ARM Java" "ls OpenJDK*aarch64_linux*.tar.gz" "Missing Linux ARM JDK (https://adoptium.net/)"
fi
if [ $PREREQ = false ]; then
info "Missing build requirements, aborting..."
Expand All @@ -85,14 +81,13 @@ else
fi

prepare () {
mkdir -p out/{conf,data,lib,logs,legacy,modern,schema,templates}
mkdir -p out/{conf,data,lib,logs,web,schema,templates}

cp ../target/tracker-server.jar out
cp ../target/lib/* out/lib
cp ../schema/* out/schema
cp -r ../templates/* out/templates
cp -r ../traccar-web/web/* out/legacy
cp -r ../traccar-web/modern/build/* out/modern
cp -r ../traccar-web/build/* out/web
cp default.xml out/conf
cp traccar.xml out/conf

Expand Down Expand Up @@ -158,23 +153,16 @@ package_linux_64 () {

package_linux_arm () {
info "Building Linux ARM installer"
package_linux arm arm
package_linux arm aarch64
ok "Created Linux ARM installer"
}

package_linux_arm64 () {
info "Building Linux ARM 64 installer"
package_linux arm64 aarch64
ok "Created Linux ARM 64 installer"
}

prepare

case $PLATFORM in
all)
package_linux_64
package_linux_arm
package_linux_arm64
package_windows
package_other
;;
Expand All @@ -187,10 +175,6 @@ case $PLATFORM in
package_linux_arm
;;

linux-arm64)
package_linux_arm64
;;

windows-64)
package_windows
;;
Expand Down
2 changes: 1 addition & 1 deletion setup/traccar.iss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Setup]
AppName=Traccar
AppVersion=5.12
AppVersion=6.0
DefaultDirName={pf}\Traccar
OutputBaseFilename=traccar-setup
ArchitecturesInstallIn64BitMode=x64
Expand Down
19 changes: 1 addition & 18 deletions src/main/java/org/traccar/BaseProtocolDecoder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012 - 2022 Anton Tananaev (anton@traccar.org)
* Copyright 2012 - 2024 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -154,25 +154,8 @@ public String getDeviceModel(DeviceSession deviceSession) {
public void getLastLocation(Position position, Date deviceTime) {
if (position.getDeviceId() != 0) {
position.setOutdated(true);

Position last = cacheManager.getPosition(position.getDeviceId());
if (last != null) {
position.setFixTime(last.getFixTime());
position.setValid(last.getValid());
position.setLatitude(last.getLatitude());
position.setLongitude(last.getLongitude());
position.setAltitude(last.getAltitude());
position.setSpeed(last.getSpeed());
position.setCourse(last.getCourse());
position.setAccuracy(last.getAccuracy());
} else {
position.setFixTime(new Date(0));
}

if (deviceTime != null) {
position.setDeviceTime(deviceTime);
} else {
position.setDeviceTime(new Date());
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/traccar/MainModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
import org.traccar.geocoder.NominatimGeocoder;
import org.traccar.geocoder.OpenCageGeocoder;
import org.traccar.geocoder.PositionStackGeocoder;
import org.traccar.geocoder.TestGeocoder;
import org.traccar.geocoder.PlusCodesGeocoder;
import org.traccar.geocoder.TomTomGeocoder;
import org.traccar.geolocation.GeolocationProvider;
import org.traccar.geolocation.GoogleGeolocationProvider;
Expand Down Expand Up @@ -211,8 +211,8 @@ public static Geocoder provideGeocoder(Config config, Client client, StatisticsM
int cacheSize = config.getInteger(Keys.GEOCODER_CACHE_SIZE);
Geocoder geocoder;
switch (type) {
case "test":
geocoder = new TestGeocoder();
case "pluscodes":
geocoder = new PlusCodesGeocoder();
break;
case "nominatim":
geocoder = new NominatimGeocoder(client, url, key, language, cacheSize, addressFormat);
Expand Down
Loading

0 comments on commit 908271c

Please sign in to comment.