diff options
-rw-r--r-- | src/org/traccar/MainEventHandler.java | 4 | ||||
-rw-r--r-- | src/org/traccar/api/BaseResource.java | 6 | ||||
-rw-r--r-- | src/org/traccar/api/CorsResponseFilter.java | 4 | ||||
-rw-r--r-- | src/org/traccar/api/SecurityRequestFilter.java | 5 | ||||
-rw-r--r-- | web/app/view/Devices.js | 3 | ||||
-rw-r--r-- | web/app/view/DevicesController.js | 7 |
6 files changed, 17 insertions, 12 deletions
diff --git a/src/org/traccar/MainEventHandler.java b/src/org/traccar/MainEventHandler.java index f99765de4..1be20c291 100644 --- a/src/org/traccar/MainEventHandler.java +++ b/src/org/traccar/MainEventHandler.java @@ -36,10 +36,12 @@ public class MainEventHandler extends IdleStateAwareChannelHandler { Position position = (Position) e.getMessage(); + String uniqueId = Context.getDataManager().getDeviceById(position.getDeviceId()).getUniqueId(); + // Log position StringBuilder s = new StringBuilder(); s.append(formatChannel(e.getChannel())).append(" "); - s.append("id: ").append(position.getDeviceId()).append(", "); + s.append("id: ").append(uniqueId).append(", "); s.append("time: ").append( new SimpleDateFormat(Log.DATE_FORMAT).format(position.getFixTime())).append(", "); s.append("lat: ").append(String.format("%.5f", position.getLatitude())).append(", "); diff --git a/src/org/traccar/api/BaseResource.java b/src/org/traccar/api/BaseResource.java index ab891b832..4dafc084c 100644 --- a/src/org/traccar/api/BaseResource.java +++ b/src/org/traccar/api/BaseResource.java @@ -33,10 +33,4 @@ public class BaseResource { return 0; } - @PermitAll - @OPTIONS - public Response options() { - return Response.noContent().build(); - } - } diff --git a/src/org/traccar/api/CorsResponseFilter.java b/src/org/traccar/api/CorsResponseFilter.java index 349580e2f..67d312504 100644 --- a/src/org/traccar/api/CorsResponseFilter.java +++ b/src/org/traccar/api/CorsResponseFilter.java @@ -47,9 +47,9 @@ public class CorsResponseFilter implements ContainerResponseFilter { String origin = request.getHeaderString(HttpHeaders.Names.ORIGIN); String allowed = Context.getConfig().getString("web.origin"); - if (allowed == null || origin == null) { + if (origin == null) { response.getHeaders().add(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN, ORIGIN_ALL); - } else if (allowed.equals(ORIGIN_ALL) || allowed.contains(origin)) { + } else if (allowed == null || allowed.equals(ORIGIN_ALL) || allowed.contains(origin)) { response.getHeaders().add(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN, origin); } } diff --git a/src/org/traccar/api/SecurityRequestFilter.java b/src/org/traccar/api/SecurityRequestFilter.java index 4c6137ede..0f0de2dec 100644 --- a/src/org/traccar/api/SecurityRequestFilter.java +++ b/src/org/traccar/api/SecurityRequestFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * Copyright 2015 - 2016 Anton Tananaev (anton.tananaev@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ public class SecurityRequestFilter implements ContainerRequestFilter { public void filter(ContainerRequestContext requestContext) { if (requestContext.getMethod().equals("OPTIONS")) { - throw new WebApplicationException(Response.status(Response.Status.OK).build()); + return; } SecurityContext securityContext = null; @@ -93,6 +93,7 @@ public class SecurityRequestFilter implements ContainerRequestFilter { Response.status(Response.Status.UNAUTHORIZED).header(WWW_AUTHENTICATE, BASIC_REALM).build()); } } + } } diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js index 4131ba6f9..f06c2658b 100644 --- a/web/app/view/Devices.js +++ b/web/app/view/Devices.js @@ -54,7 +54,8 @@ Ext.define('Traccar.view.Devices', { glyph: 'xf05b@FontAwesome', tooltip: Strings.deviceFollow, tooltipType: 'title', - enableToggle: true + enableToggle: true, + toggleHandler: 'onFollowClick' }, { xtype: 'settingsMenu' }] diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js index e9a075ffc..10918c13a 100644 --- a/web/app/view/DevicesController.js +++ b/web/app/view/DevicesController.js @@ -89,6 +89,13 @@ Ext.define('Traccar.view.DevicesController', { dialog.show(); }, + onFollowClick: function (button, pressed) { + if (pressed) { + var device = this.getView().getSelectionModel().getSelection()[0]; + this.fireEvent('selectDevice', device, true); + } + }, + onSelectionChange: function (selected) { var empty = selected.getCount() === 0; this.lookupReference('toolbarEditButton').setDisabled(empty); |