parsav  Check-in [53ef86f7ff]

Overview
Comment:handle (some) deletions in live.js
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 53ef86f7ff464b62ad5c52c499ba9419385aebf5fc0bbc2725e4583375803347
User & Date: lexi on 2021-01-01 16:42:45
Other Links: manifest | tags
Context
2021-01-02
04:47
work on admin ui check-in: 7129658e1d user: lexi tags: trunk
2021-01-01
16:42
handle (some) deletions in live.js check-in: 53ef86f7ff user: lexi tags: trunk
16:24
move from webp to svg except where necessary check-in: aa17a03321 user: lexi tags: trunk
Changes

Modified route.t from [f59188addc] to [35b3cb0b8a].

334
335
336
337
338
339
340
341


342
343
344
345
346
347
348
				}
				goto [send]
			end
		end
	end
	terra http.static_content(co: &lib.srv.convo, [filename], [flen])
		var hdrs = array(
		lib.http.header{'Content-Type',nil})


		var [page] = lib.http.page {
			respcode = 200;
			headers = [lib.mem.ptr(lib.http.header)] {
				ptr = &hdrs[0], ct = 1
			}
		}
		[branches]







|
>
>







334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
				}
				goto [send]
			end
		end
	end
	terra http.static_content(co: &lib.srv.convo, [filename], [flen])
		var hdrs = array(
			lib.http.header{'Content-Type',nil},
			lib.http.header{'Cache-Control','max-age=2592000'} -- TODO immutable?
		)
		var [page] = lib.http.page {
			respcode = 200;
			headers = [lib.mem.ptr(lib.http.header)] {
				ptr = &hdrs[0], ct = 1
			}
		}
		[branches]

Modified srv.t from [b74b4804fc] to [b092edff32].

205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
		lib.http.header { key = 'Cache-Control', value = 'no-store' },
		lib.http.header {
			key = 'X-Live-Newest-Artifact';
			value = lib.math.decstr(lastup, &nbuf[20]);
		},
		lib.http.header { key = 'Content-Length', value = '0' }
	)
	if self.live_last ~= 0 and self.live_last >= lastup then
		lib.net.mg_printf(self.con, 'HTTP/1.1 %s', lib.http.codestr(200))
		for i = 0, [hdrs.type.N] do
			lib.net.mg_printf(self.con, '%s: %s\r\n', hdrs[i].key, hdrs[i].value)
		end
		lib.net.mg_printf(self.con, '\r\n')
	else
		self:rawpage(200, pg, [lib.mem.ptr(lib.http.header)] {







|







205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
		lib.http.header { key = 'Cache-Control', value = 'no-store' },
		lib.http.header {
			key = 'X-Live-Newest-Artifact';
			value = lib.math.decstr(lastup, &nbuf[20]);
		},
		lib.http.header { key = 'Content-Length', value = '0' }
	)
	if self.live_last ~= 0 and self.live_last == lastup then
		lib.net.mg_printf(self.con, 'HTTP/1.1 %s', lib.http.codestr(200))
		for i = 0, [hdrs.type.N] do
			lib.net.mg_printf(self.con, '%s: %s\r\n', hdrs[i].key, hdrs[i].value)
		end
		lib.net.mg_printf(self.con, '\r\n')
	else
		self:rawpage(200, pg, [lib.mem.ptr(lib.http.header)] {

Modified static/live.js from [15d09c6d9b] to [86bdd64b84].

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
					'X-Live-Last-Arrival': container._liveLastArrival
				}
			})
			
			fetch(req).then(function(resp) {
				if (!resp.ok) return;
				let newest = parseInt(resp.headers.get('X-Live-Newest-Artifact'));
				if (newest <= container._liveLastArrival) {
					resp.body.cancel();
					return;
				}
				container._liveLastArrival = newest

				resp.text().then(function(htmlbody) {
					var parser = new DOMParser();







|







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
					'X-Live-Last-Arrival': container._liveLastArrival
				}
			})
			
			fetch(req).then(function(resp) {
				if (!resp.ok) return;
				let newest = parseInt(resp.headers.get('X-Live-Newest-Artifact'));
				if (newest == container._liveLastArrival) { // != also handles some deletions
					resp.body.cancel();
					return;
				}
				container._liveLastArrival = newest

				resp.text().then(function(htmlbody) {
					var parser = new DOMParser();