Commit 3578c1c0403a0455fca0fd46101b2cedd42a5a5a
1 parent
792c9369
优化登录体验。修复因为流地址导致的录像服务无法识别
Showing
9 changed files
with
38 additions
and
9 deletions
src/main/java/com/genersoft/iot/vmp/conf/security/AnonymousAuthenticationEntryPoint.java
| @@ -30,6 +30,9 @@ public class AnonymousAuthenticationEntryPoint implements AuthenticationEntryPoi | @@ -30,6 +30,9 @@ public class AnonymousAuthenticationEntryPoint implements AuthenticationEntryPoi | ||
| 30 | JSONObject jsonObject = new JSONObject(); | 30 | JSONObject jsonObject = new JSONObject(); |
| 31 | jsonObject.put("code", "-1"); | 31 | jsonObject.put("code", "-1"); |
| 32 | jsonObject.put("msg", "请登录后重新请求"); | 32 | jsonObject.put("msg", "请登录后重新请求"); |
| 33 | + if (request.getRequestURI().contains("api/user/login")){ | ||
| 34 | + jsonObject.put("msg", e.getMessage()); | ||
| 35 | + } | ||
| 33 | response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); | 36 | response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); |
| 34 | try { | 37 | try { |
| 35 | response.getWriter().print(jsonObject.toJSONString()); | 38 | response.getWriter().print(jsonObject.toJSONString()); |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| @@ -376,7 +376,7 @@ public class ZLMHttpHookListener { | @@ -376,7 +376,7 @@ public class ZLMHttpHookListener { | ||
| 376 | String app = json.getString("app"); | 376 | String app = json.getString("app"); |
| 377 | String streamId = json.getString("stream"); | 377 | String streamId = json.getString("stream"); |
| 378 | if ("rtp".equals(app)) { | 378 | if ("rtp".equals(app)) { |
| 379 | - String[] s = streamId.split("/"); | 379 | + String[] s = streamId.split("_"); |
| 380 | if (s.length == 2) { | 380 | if (s.length == 2) { |
| 381 | String deviceId = s[0]; | 381 | String deviceId = s[0]; |
| 382 | String channelId = s[1]; | 382 | String channelId = s[1]; |
| @@ -386,7 +386,7 @@ public class ZLMHttpHookListener { | @@ -386,7 +386,7 @@ public class ZLMHttpHookListener { | ||
| 386 | SSRCInfo ssrcInfo; | 386 | SSRCInfo ssrcInfo; |
| 387 | String streamId2 = null; | 387 | String streamId2 = null; |
| 388 | if (mediaInfo.isRtpEnable()) { | 388 | if (mediaInfo.isRtpEnable()) { |
| 389 | - streamId2 = String.format("%s/%s", device.getDeviceId(), channelId); | 389 | + streamId2 = String.format("%s_%s", device.getDeviceId(), channelId); |
| 390 | } | 390 | } |
| 391 | ssrcInfo = mediaServerService.openRTPServer(mediaInfo, streamId2); | 391 | ssrcInfo = mediaServerService.openRTPServer(mediaInfo, streamId2); |
| 392 | cmder.playStreamCmd(mediaInfo, ssrcInfo, device, channelId, (MediaServerItem mediaServerItemInuse, JSONObject response) -> { | 392 | cmder.playStreamCmd(mediaInfo, ssrcInfo, device, channelId, (MediaServerItem mediaServerItemInuse, JSONObject response) -> { |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
| @@ -122,7 +122,7 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR | @@ -122,7 +122,7 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR | ||
| 122 | String mediaServerId = streamSession.getMediaServerId(device.getDeviceId(), channelId); | 122 | String mediaServerId = streamSession.getMediaServerId(device.getDeviceId(), channelId); |
| 123 | MediaServerItem mediaServerItem = this.getOne(mediaServerId); | 123 | MediaServerItem mediaServerItem = this.getOne(mediaServerId); |
| 124 | if (mediaServerItem != null) { | 124 | if (mediaServerItem != null) { |
| 125 | - String streamId = String.format("%s/%s", device.getDeviceId(), channelId); | 125 | + String streamId = String.format("%s_%s", device.getDeviceId(), channelId); |
| 126 | zlmrtpServerFactory.closeRTPServer(mediaServerItem, streamId); | 126 | zlmrtpServerFactory.closeRTPServer(mediaServerItem, streamId); |
| 127 | releaseSsrc(mediaServerItem, streamSession.getSSRC(device.getDeviceId(), channelId)); | 127 | releaseSsrc(mediaServerItem, streamSession.getSSRC(device.getDeviceId(), channelId)); |
| 128 | } | 128 | } |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| @@ -155,7 +155,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -155,7 +155,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 155 | SSRCInfo ssrcInfo; | 155 | SSRCInfo ssrcInfo; |
| 156 | String streamId = null; | 156 | String streamId = null; |
| 157 | if (mediaServerItem.isRtpEnable()) { | 157 | if (mediaServerItem.isRtpEnable()) { |
| 158 | - streamId = String.format("%s/%s", device.getDeviceId(), channelId); | 158 | + streamId = String.format("%s_%s", device.getDeviceId(), channelId); |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId); | 161 | ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId); |
| @@ -220,7 +220,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -220,7 +220,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 220 | SSRCInfo ssrcInfo; | 220 | SSRCInfo ssrcInfo; |
| 221 | String streamId2 = null; | 221 | String streamId2 = null; |
| 222 | if (mediaServerItem.isRtpEnable()) { | 222 | if (mediaServerItem.isRtpEnable()) { |
| 223 | - streamId2 = String.format("%s/%s", device.getDeviceId(), channelId); | 223 | + streamId2 = String.format("%s_%s", device.getDeviceId(), channelId); |
| 224 | } | 224 | } |
| 225 | ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId2); | 225 | ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId2); |
| 226 | 226 |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
| @@ -101,7 +101,7 @@ public class PlayController { | @@ -101,7 +101,7 @@ public class PlayController { | ||
| 101 | @GetMapping("/stop/{deviceId}/{channelId}") | 101 | @GetMapping("/stop/{deviceId}/{channelId}") |
| 102 | public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String deviceId, @PathVariable String channelId) { | 102 | public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String deviceId, @PathVariable String channelId) { |
| 103 | 103 | ||
| 104 | - logger.debug(String.format("设备预览/回放停止API调用,streamId:%s/%s", deviceId, channelId )); | 104 | + logger.debug(String.format("设备预览/回放停止API调用,streamId:%s_%s", deviceId, channelId )); |
| 105 | 105 | ||
| 106 | UUID uuid = UUID.randomUUID(); | 106 | UUID uuid = UUID.randomUUID(); |
| 107 | DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>(); | 107 | DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>(); |
| @@ -147,7 +147,7 @@ public class PlayController { | @@ -147,7 +147,7 @@ public class PlayController { | ||
| 147 | 147 | ||
| 148 | // 超时处理 | 148 | // 超时处理 |
| 149 | result.onTimeout(()->{ | 149 | result.onTimeout(()->{ |
| 150 | - logger.warn(String.format("设备预览/回放停止超时,deviceId/channelId:%s/%s ", deviceId, channelId)); | 150 | + logger.warn(String.format("设备预览/回放停止超时,deviceId/channelId:%s_%s ", deviceId, channelId)); |
| 151 | RequestMessage msg = new RequestMessage(); | 151 | RequestMessage msg = new RequestMessage(); |
| 152 | msg.setId(DeferredResultHolder.CALLBACK_CMD_STOP + uuid); | 152 | msg.setId(DeferredResultHolder.CALLBACK_CMD_STOP + uuid); |
| 153 | msg.setData("Timeout"); | 153 | msg.setData("Timeout"); |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/DownloadController.java
| @@ -130,7 +130,7 @@ public class DownloadController { | @@ -130,7 +130,7 @@ public class DownloadController { | ||
| 130 | cmder.streamByeCmd(deviceId, channelId); | 130 | cmder.streamByeCmd(deviceId, channelId); |
| 131 | 131 | ||
| 132 | if (logger.isDebugEnabled()) { | 132 | if (logger.isDebugEnabled()) { |
| 133 | - logger.debug(String.format("设备历史媒体下载停止 API调用,deviceId/channelId:%s/%s", deviceId, channelId)); | 133 | + logger.debug(String.format("设备历史媒体下载停止 API调用,deviceId/channelId:%s_%s", deviceId, channelId)); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | if (deviceId != null && channelId != null) { | 136 | if (deviceId != null && channelId != null) { |
web_src/src/assets/logo.png
web_src/src/components/Login.vue
| @@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
| 22 | </div> | 22 | </div> |
| 23 | 23 | ||
| 24 | <div class="container-login100-form-btn"> | 24 | <div class="container-login100-form-btn"> |
| 25 | - <div class="wrap-login100-form-btn"> | 25 | + <div class="wrap-login100-form-btn" :class="{'login-loading': isLoging}" v-loading="isLoging" element-loading-background="rgb(0 0 0 / 0%);" element-loading-custom-class="login-loading-class"> |
| 26 | <div class="login100-form-bgbtn"></div> | 26 | <div class="login100-form-bgbtn"></div> |
| 27 | <button class="login100-form-btn" @click="login">登录</button> | 27 | <button class="login100-form-btn" @click="login">登录</button> |
| 28 | </div> | 28 | </div> |
| @@ -41,6 +41,7 @@ export default { | @@ -41,6 +41,7 @@ export default { | ||
| 41 | return { | 41 | return { |
| 42 | isLoging: false, | 42 | isLoging: false, |
| 43 | showPassword: false, | 43 | showPassword: false, |
| 44 | + loginLoading: false, | ||
| 44 | username: '', | 45 | username: '', |
| 45 | password: '' | 46 | password: '' |
| 46 | } | 47 | } |
web_src/static/css/login.css
| @@ -376,6 +376,31 @@ | @@ -376,6 +376,31 @@ | ||
| 376 | .p-b-48 {padding-bottom: 48px;} | 376 | .p-b-48 {padding-bottom: 48px;} |
| 377 | .p-t-115 {padding-top: 115px;} | 377 | .p-t-115 {padding-top: 115px;} |
| 378 | 378 | ||
| 379 | +@keyframes login { | ||
| 380 | + from {width: 100%} | ||
| 381 | + to {width: 50px} | ||
| 382 | +} | ||
| 383 | + | ||
| 384 | +.login-loading{ | ||
| 385 | + width: 50px; | ||
| 386 | + animation-name: login; | ||
| 387 | + animation-duration: 0.5s; | ||
| 388 | +} | ||
| 389 | +.login-loading > .login100-form-btn { | ||
| 390 | + visibility: hidden !important; | ||
| 391 | +} | ||
| 392 | +.login-loading-class{ | ||
| 393 | + stroke: rgb(255, 255, 255) !important; | ||
| 394 | + background-color: transparent !important; | ||
| 395 | +} | ||
| 396 | + | ||
| 397 | +.login-loading-class > .el-loading-spinner .path { | ||
| 398 | + stroke: rgb(255, 255, 255) !important; | ||
| 399 | +} | ||
| 400 | + | ||
| 401 | + | ||
| 402 | + | ||
| 403 | + | ||
| 379 | /**font**/ | 404 | /**font**/ |
| 380 | /* .zmdi { | 405 | /* .zmdi { |
| 381 | display: inline-block; | 406 | display: inline-block; |