Fixed the problem that Wake On Lan does not work when BASE_PATH is set.
Fix time display issue in iOS WebKit.
This commit is contained in:
		
							parent
							
								
									efbc36d61f
								
							
						
					
					
						commit
						b6c33b5aa8
					
				|  | @ -1,3 +1,8 @@ | ||||||
|  | var base_url = jQuery(".brand-link").attr('href'); | ||||||
|  | if (base_url.substring(base_url.length - 1, base_url.length) != "/") | ||||||
|  |     base_url = base_url + "/"; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| const wake_on_lan_new_template = '<div class="col-sm-4" id="{{ .Id }}">\n' + | const wake_on_lan_new_template = '<div class="col-sm-4" id="{{ .Id }}">\n' + | ||||||
|     '\t<div class="info-box">\n' + |     '\t<div class="info-box">\n' + | ||||||
|     '\t\t<div class="info-box-content">\n' + |     '\t\t<div class="info-box-content">\n' + | ||||||
|  | @ -42,7 +47,8 @@ jQuery.each(["put", "delete"], function (i, method) { | ||||||
|             type: method, |             type: method, | ||||||
|             dataType: type, |             dataType: type, | ||||||
|             data: data, |             data: data, | ||||||
|             success: callback |             success: callback, | ||||||
|  |             contentType: 'application/json' | ||||||
|         }); |         }); | ||||||
|     }; |     }; | ||||||
| }); | }); | ||||||
|  | @ -55,7 +61,7 @@ jQuery(function ($) { | ||||||
| jQuery(function ($) { | jQuery(function ($) { | ||||||
|     $('.btn-outline-success').click(function () { |     $('.btn-outline-success').click(function () { | ||||||
|         const $this = $(this); |         const $this = $(this); | ||||||
|         $.put('/wake_on_lan_host/' + $this.data('mac-address'), function (result) { |         $.put(base_url + 'wake_on_lan_host/' + $this.data('mac-address'), function (result) { | ||||||
|             $this.parents('.info-box').find('.latest-used').text(prettyDateTime(result)); |             $this.parents('.info-box').find('.latest-used').text(prettyDateTime(result)); | ||||||
|         }); |         }); | ||||||
|     }); |     }); | ||||||
|  | @ -76,7 +82,7 @@ jQuery(function ($) { | ||||||
| 
 | 
 | ||||||
|     $remove_client_confirm.click(function () { |     $remove_client_confirm.click(function () { | ||||||
|         const macAddress = $remove_client_confirm.val().replaceAll(":", "-"); |         const macAddress = $remove_client_confirm.val().replaceAll(":", "-"); | ||||||
|         $.delete('/wake_on_lan_host/' + macAddress); |         $.delete(base_url + 'wake_on_lan_host/' + macAddress); | ||||||
|         $('#' + macAddress).remove(); |         $('#' + macAddress).remove(); | ||||||
| 
 | 
 | ||||||
|         $modal_remove_wake_on_lan_host.modal('hide'); |         $modal_remove_wake_on_lan_host.modal('hide'); | ||||||
|  | @ -86,7 +92,15 @@ jQuery(function ($) { | ||||||
| jQuery(function ($) { | jQuery(function ($) { | ||||||
|     $('.latest-used').each(function () { |     $('.latest-used').each(function () { | ||||||
|         const $this = $(this); |         const $this = $(this); | ||||||
|        $this.text(prettyDateTime($this.text().trim())); |         const timeText = $this.text().trim(); | ||||||
|  |         try { | ||||||
|  |             if (timeText != "Unused") { | ||||||
|  |                 $this.text(prettyDateTime(timeText)); | ||||||
|  |             } | ||||||
|  |         } catch (ex) { | ||||||
|  |             console.log(timeText); | ||||||
|  |             throw ex; | ||||||
|  |         } | ||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
|  | @ -109,7 +123,7 @@ jQuery(function ($) { | ||||||
|             $.ajax({ |             $.ajax({ | ||||||
|                 cache: false, |                 cache: false, | ||||||
|                 method: 'POST', |                 method: 'POST', | ||||||
|                 url: '/wake_on_lan_host', |                 url: base_url + 'wake_on_lan_host', | ||||||
|                 dataType: 'json', |                 dataType: 'json', | ||||||
|                 contentType: "application/json", |                 contentType: "application/json", | ||||||
|                 data: JSON.stringify(data), |                 data: JSON.stringify(data), | ||||||
|  |  | ||||||
|  | @ -103,7 +103,7 @@ | ||||||
|                                 <span class="info-box-text"><i class="fas fa-clock"></i> |                                 <span class="info-box-text"><i class="fas fa-clock"></i> | ||||||
|                                     <span class="latest-used"> |                                     <span class="latest-used"> | ||||||
|                                         {{ if .LatestUsed }} |                                         {{ if .LatestUsed }} | ||||||
|                                             {{ .LatestUsed }} |                                             {{ .LatestUsed.Format "2006-01-02T15:04:05Z07:00"}} | ||||||
|                                         {{ else }} |                                         {{ else }} | ||||||
|                                             Unused |                                             Unused | ||||||
|                                         {{ end }} |                                         {{ end }} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue