Explorar el Código

Merge pull request #2137 from calmh/caching

Enable browser caching of static resources
Audrius Butkevicius hace 10 años
padre
commit
9eb4089710

+ 6 - 0
cmd/syncthing/gui.go

@@ -955,6 +955,11 @@ func (s embeddedStatic) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
+	if r.Header.Get("If-Modified-Since") == auto.AssetsBuildDate {
+		w.WriteHeader(http.StatusNotModified)
+		return
+	}
+
 	mtype := s.mimeTypeForFile(file)
 	if len(mtype) != 0 {
 		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("Last-Modified", auto.AssetsBuildDate)
+	w.Header().Set("Cache-Control", "public")
 
 	w.Write(bs)
 }

+ 1 - 1
gui/syncthing/core/httpErrorDialogDirective.js

@@ -2,6 +2,6 @@ angular.module('syncthing.core')
     .directive('httpErrorDialog', function () {
         return {
             restrict: 'A',
-            templateUrl: 'syncthing/core//httpErrorDialogView.html'
+            templateUrl: 'syncthing/core/httpErrorDialogView.html'
         };
 });

+ 1 - 1
gui/syncthing/core/majorUpgradeModalDirective.js

@@ -2,6 +2,6 @@ angular.module('syncthing.core')
     .directive('majorUpgradeModal', function () {
         return {
             restrict: 'A',
-            templateUrl: 'syncthing/core//majorUpgradeModalView.html'
+            templateUrl: 'syncthing/core/majorUpgradeModalView.html'
         };
 });

+ 1 - 1
gui/syncthing/core/networkErrorDialogDirective.js

@@ -2,6 +2,6 @@ angular.module('syncthing.core')
     .directive('networkErrorDialog', function () {
         return {
             restrict: 'A',
-            templateUrl: 'syncthing/core//networkErrorDialogView.html'
+            templateUrl: 'syncthing/core/networkErrorDialogView.html'
         };
 });

+ 1 - 1
gui/syncthing/core/restartingDialogDirective.js

@@ -2,6 +2,6 @@ angular.module('syncthing.core')
     .directive('restartingDialog', function () {
         return {
             restrict: 'A',
-            templateUrl: 'syncthing/core//restartingDialogView.html'
+            templateUrl: 'syncthing/core/restartingDialogView.html'
         };
 });

+ 1 - 1
gui/syncthing/core/shutdownDialogDirective.js

@@ -2,6 +2,6 @@ angular.module('syncthing.core')
     .directive('shutdownDialog', function () {
         return {
             restrict: 'A',
-            templateUrl: 'syncthing/core//shutdownDialogView.html'
+            templateUrl: 'syncthing/core/shutdownDialogView.html'
         };
 });

+ 1 - 1
gui/syncthing/core/upgradingDialogDirective.js

@@ -2,6 +2,6 @@ angular.module('syncthing.core')
     .directive('upgradingDialog', function () {
         return {
             restrict: 'A',
-            templateUrl: 'syncthing/core//upgradingDialogView.html'
+            templateUrl: 'syncthing/core/upgradingDialogView.html'
         };
 });

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 1 - 1
internal/auto/gui.files.go


Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio