Append random query to ensure the avatar is refetched
This commit is contained in:
@@ -34,6 +34,10 @@
|
||||
app.controller('Controller', ['$scope', '$http', function ($scope, $http) {
|
||||
$scope.errorMessage = '';
|
||||
$scope.statusOk = false;
|
||||
$scope.avatarUrl = '/api/v1/cloudron/avatar?' + Math.random();
|
||||
|
||||
var favicon = $('#favicon');
|
||||
if (favicon) favicon.attr('href', $scope.avatarUrl);
|
||||
|
||||
// try to fetch the cloudron status
|
||||
$http.get('/api/v1/cloudron/status').success(function(data, status) {
|
||||
@@ -58,7 +62,7 @@
|
||||
|
||||
<div class="wrapper">
|
||||
<div class="content">
|
||||
<img src="/api/v1/cloudron/avatar" onerror="this.src = '/img/logo_inverted_192.png'"/>
|
||||
<img ng-src="avatarUrl" onerror="this.src = '/img/logo_inverted_192.png'"/>
|
||||
<h1> Cloudron </h1>
|
||||
|
||||
<div ng-show="errorCode == 0">
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<div class="wrapper">
|
||||
<div class="content">
|
||||
<h1>
|
||||
<img width="48" height="48" src="/api/v1/cloudron/avatar" onerror="this.src = '/img/logo_inverted_192.png'"/>
|
||||
<img id="avatar" width="48" height="48" src="/api/v1/cloudron/avatar" onerror="this.src = '/img/logo_inverted_192.png'"/>
|
||||
<span style="padding-left:10px">Cloudron</span>
|
||||
</h1>
|
||||
<br/>
|
||||
@@ -42,5 +42,16 @@
|
||||
<span class="text-muted"><a href="https://chat.cloudron.io" target="_blank">Chat <i class="fa fa-comments"></i></a></span>
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
|
||||
$(function() {
|
||||
var avatarUrl = '/api/v1/cloudron/avatar?' + Math.random();
|
||||
|
||||
$('#favicon').attr('href', avatarUrl);
|
||||
$('#avatar').attr('src', avatarUrl);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user