Merge pull request #2137 from calmh/caching
Enable browser caching of static resources
This commit is contained in:
commit
9eb4089710
@ -955,6 +955,11 @@ func (s embeddedStatic) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if r.Header.Get("If-Modified-Since") == auto.AssetsBuildDate {
|
||||||
|
w.WriteHeader(http.StatusNotModified)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
mtype := s.mimeTypeForFile(file)
|
mtype := s.mimeTypeForFile(file)
|
||||||
if len(mtype) != 0 {
|
if len(mtype) != 0 {
|
||||||
w.Header().Set("Content-Type", mtype)
|
w.Header().Set("Content-Type", mtype)
|
||||||
@ -970,6 +975,7 @@ func (s embeddedStatic) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
w.Header().Set("Content-Length", fmt.Sprintf("%d", len(bs)))
|
w.Header().Set("Content-Length", fmt.Sprintf("%d", len(bs)))
|
||||||
w.Header().Set("Last-Modified", auto.AssetsBuildDate)
|
w.Header().Set("Last-Modified", auto.AssetsBuildDate)
|
||||||
|
w.Header().Set("Cache-Control", "public")
|
||||||
|
|
||||||
w.Write(bs)
|
w.Write(bs)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,6 @@ angular.module('syncthing.core')
|
|||||||
.directive('httpErrorDialog', function () {
|
.directive('httpErrorDialog', function () {
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
templateUrl: 'syncthing/core//httpErrorDialogView.html'
|
templateUrl: 'syncthing/core/httpErrorDialogView.html'
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,6 +2,6 @@ angular.module('syncthing.core')
|
|||||||
.directive('majorUpgradeModal', function () {
|
.directive('majorUpgradeModal', function () {
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
templateUrl: 'syncthing/core//majorUpgradeModalView.html'
|
templateUrl: 'syncthing/core/majorUpgradeModalView.html'
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,6 +2,6 @@ angular.module('syncthing.core')
|
|||||||
.directive('networkErrorDialog', function () {
|
.directive('networkErrorDialog', function () {
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
templateUrl: 'syncthing/core//networkErrorDialogView.html'
|
templateUrl: 'syncthing/core/networkErrorDialogView.html'
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,6 +2,6 @@ angular.module('syncthing.core')
|
|||||||
.directive('restartingDialog', function () {
|
.directive('restartingDialog', function () {
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
templateUrl: 'syncthing/core//restartingDialogView.html'
|
templateUrl: 'syncthing/core/restartingDialogView.html'
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,6 +2,6 @@ angular.module('syncthing.core')
|
|||||||
.directive('shutdownDialog', function () {
|
.directive('shutdownDialog', function () {
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
templateUrl: 'syncthing/core//shutdownDialogView.html'
|
templateUrl: 'syncthing/core/shutdownDialogView.html'
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,6 +2,6 @@ angular.module('syncthing.core')
|
|||||||
.directive('upgradingDialog', function () {
|
.directive('upgradingDialog', function () {
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
templateUrl: 'syncthing/core//upgradingDialogView.html'
|
templateUrl: 'syncthing/core/upgradingDialogView.html'
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user