Browse Source

offlinedetector not needed

forest johnson 2 years ago
parent
commit
f781d21cfa
3 changed files with 1 additions and 17 deletions
  1. 0 3
      index.appcache.gotemplate
  2. 0 10
      server.go
  3. 1 4
      static/application.js

+ 0 - 3
index.appcache.gotemplate

@ -8,6 +8,3 @@ CACHE MANIFEST
8 8
9 9
NETWORK:
10 10
*
11
12
FALLBACK:
13
/offlineDetector /static/application.css?v={{.Version}}

+ 0 - 10
server.go

@ -80,15 +80,6 @@ func storage(response http.ResponseWriter, request *http.Request) {
80 80
	}
81 81
}
82 82
83
func offlineDetector(response http.ResponseWriter, request *http.Request) {
84
	response.Header().Set("Cache-Control", "max-age=0")
85
	response.Header().Set("Cache-Control", "must-revalidate")
86
	response.Header().Set("Cache-Control", "no-cache")
87
	response.Header().Set("Cache-Control", "no-store")
88
	response.WriteHeader(200)
89
	fmt.Fprint(response, "You Are Online")
90
}
91
92 83
func indexHtml(response http.ResponseWriter, request *http.Request) {
93 84
	if request.URL.Path != "/" {
94 85
		response.WriteHeader(404)
@ -162,7 +153,6 @@ func main() {
162 153
163 154
	http.HandleFunc("/", indexHtml)
164 155
	http.HandleFunc("/index.appcache", cacheManifest)
165
	http.HandleFunc("/offlineDetector", offlineDetector)
166 156
167 157
	http.HandleFunc("/storage/", storage)
168 158

+ 1 - 4
static/application.js

@ -119,10 +119,7 @@
119 119
        }
120 120
      });
121 121
122
      var hasNetworkAccess = false;
123
      request("GET", "/offlineDetector").then(x => {
124
        hasNetworkAccess = x == "You Are Online";
125
      })
122
      var s3Request = 
126 123
127 124
    this.get = (id) => request('GET', `${baseUrl}/${id}`);
128 125
    this.put = (id, content) => request('PUT', `${baseUrl}/${id}`, content);