Overview
| Comment: | move from webp to svg except where necessary |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
aa17a033218589d685cb7e420c45a4b5 |
| User & Date: | lexi on 2021-01-01 16:24:44 |
| Other Links: | manifest | tags |
Context
|
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 | |
| 04:33 | add live updates, system to only update when necessary almost works check-in: 24ec409083 user: lexi tags: trunk | |
Changes
Modified backend/pgsql.t from [3e99c3d4ab] to [30375d8380].
758 758 subject = { `subj, `sblen }; 759 759 acl = {`r:string(row,4), `r:len(row,4)+1}; 760 760 body = {`r:string(row,5), `r:len(row,5)+1}; 761 761 convoheaduri = { `cvhu, `cvhlen }; --FIXME 762 762 }) ] 763 763 p.ptr.id = r:int(uint64,row,1) 764 764 p.ptr.author = r:int(uint64,row,2) 765 - p.ptr.posted = r:int(uint64,row,6) 766 - p.ptr.discovered = r:int(uint64,row,7) 767 - p.ptr.edited = r:int(uint64,row,8) 768 - if r:null(row,9) 769 - then p.ptr.parent = 0 770 - else p.ptr.parent = r:int(uint64,row,9) 771 - end 765 + if r:null(row,6) 766 + then p.ptr.posted = 0 767 + else p.ptr.posted = r:int(uint64,row,6) 768 + end 769 + if r:null(row,7) 770 + then p.ptr.discovered = 0 771 + else p.ptr.discovered = r:int(uint64,row,7) 772 + end 773 + if r:null(row,8) 774 + then p.ptr.edited = 0 775 + else p.ptr.edited = r:int(uint64,row,8) 776 + end 777 + p.ptr.parent = r:int(uint64,row,9) 772 778 if r:null(row,11) 773 779 then p.ptr.chgcount = 0 774 780 else p.ptr.chgcount = r:int(uint32,row,11) 775 781 end 776 782 p.ptr.accent = r:int(int16,row,12) 777 783 p.ptr.localpost = r:bool(row,0) 778 784
Modified config.lua from [cd48dd2db6] to [6a4b9180fe].
45 45 }; 46 46 feat = {}; 47 47 debug = u.tobool(default('parsav_enable_debug',true)); 48 48 backends = defaultlist('parsav_backends', 'pgsql'); 49 49 braingeniousmode = false; 50 50 embeds = { 51 51 -- TODO with gzip compression, svg is dramatically superior to webp 52 - -- we should have a build-time option to serve svg so instances 53 - -- proxied behind nginx can serve svgz, or possibly just straight-up 54 - -- add support for content-encoding headers and pre-compress the 55 - -- damn things before compiling 52 + -- we should add support for content-encoding headers and pre-compress 53 + -- the damn things before compiling (also making the binary smaller) 56 54 {'style.css', 'text/css'}; 57 55 {'live.js', 'text/javascript'}; -- rrrrrrrr 58 - {'default-avatar.webp', 'image/webp'}; 59 - {'padlock.webp', 'image/webp'}; 60 - {'warn.webp', 'image/webp'}; 61 - {'query.webp', 'image/webp'}; 56 + {'default-avatar.webp', 'image/webp'}; -- needs inkscape-exclusive svg features 57 + {'padlock.svg', 'image/svg+xml'}; 58 + {'warn.svg', 'image/svg+xml'}; 59 + {'query.svg', 'image/svg+xml'}; 62 60 }; 63 61 default_ui_accent = tonumber(default('parsav_ui_default_accent',323)); 64 62 } 65 63 if os.getenv('parsav_let_me_be_an_idiot') == "i know what i'm doing" then 66 64 conf.braingeniousmode = true -- SOUND GENERAL QUARTERS 67 65 end 68 66 if u.ping '.fslckout' or u.ping '_FOSSIL_' then
Modified makefile from [8946539e56] to [e6a5371547].
1 1 dl = git 2 2 dbg-flags = $(if $(dbg),-g) 3 3 4 -images = $(addsuffix .webp, $(basename $(wildcard static/*.svg))) 4 +images = static/default-avatar.webp 5 +#$(addsuffix .webp, $(basename $(wildcard static/*.svg))) 5 6 styles = $(addsuffix .css, $(basename $(wildcard static/*.scss))) 6 7 7 8 parsav parsavd: parsav.t config.lua pkgdata.lua $(images) $(styles) 8 9 terra $(dbg-flags) $< 9 10 parsav.o parsavd.o: parsav.t config.lua pkgdata.lua $(images) $(styles) 10 11 env parsav_link=no terra $(dbg-flags) $< 11 12 parsav.ll parsavd.ll: parsav.t config.lua pkgdata.lua $(images) $(styles) ................................................................................ 17 18 cwebp -q 90 $< -o $@ 18 19 static/%.png: static/%.svg 19 20 inkscape -f $< -C -d 180 -e $@ 20 21 static/%.css: static/%.scss 21 22 sassc -t compressed $< $@ 22 23 23 24 clean: 24 - rm parsav parsav.o 25 + rm parsav parsav.o $(images) $(styles) 25 26 26 27 install: parsav 27 28 mkdir $(prefix)/bin 28 29 cp $< $(prefix)/bin/ 29 30 30 31 dep: dep.mbedtls dep.mongoose dep.json-c 31 32 dep.mbedtls: lib/mbedtls/library/libmbedtls.a \
Modified parsav.md from [bfa0a26bd5] to [bd4297f1d2].
17 17 * postgresql-libs 18 18 * compile-time 19 19 * cmark (commonmark implementation), for transformation of the help files, whose source is in commonmark. online documentation transforms these into html and embeds them in the binary; cmark is also used to to produce the troff source which is used to build the offline documentation. disable with `parsav_online_documentation=no parsav_offline_documentation=no` 20 20 * troff implementation (tested with groff but as far as i know we don't need any groff-specific extensions) to produce PDFs and manpages from the cmark-generated intermediate forms. disable with `parsav_offline_documentation=no` 21 21 22 22 additional preconfigure dependencies are necessary if you are building directly from trunk, rather than from a release tarball that includes certain build artifacts which need to be embedded in the binary: 23 23 24 -* inkscape, for rendering out UI graphics 24 +* inkscape, for rendering out some of the UI graphics that can't be represented with standard svg 25 25 * cwebp (libwebp package), for transforming inkscape PNGs to webp 26 26 * sassc, for compiling the SCSS stylesheet into its final CSS 27 27 28 28 all builds require terra, which, unfortunately, requires installing an older version of llvm, v9 at the latest (which i develop parsav under). with any luck, your distro will be clever enough to package terra and its dependencies properly (it's trivial on nix, tho you'll need to tweak the terra expression to select a more recent llvm package); Arch Linux is one of those distros which is not so clever, and whose (AUR) terra package is totally broken. due to these unfortunate circumstances, terra is distributed not just in source form, but also in the the form of LLVM IR. distributions will also be made in the form of tarballed object code and assembly listings for various common platforms, currently including x86-32/64, arm7hf, aarch64, riscv, mips32/64, and ppc64/64le. 29 29 30 30 i've noticed that terra (at least with llvm9) seems to get a bit cantankerous and trigger llvm to fail with bizarre errors when you try to cross-compile parsav from x86-64 to any other platform, even x86-32. i don't know if this problem exists on other architectures or in what form, but as a workaround, the current cross-compile process consists of generating LLVM IR (ostensibly for x86-64, though this is in reality an architecture-independent language), and then compiling that down to an object file with llc. this is an enormous hassle; hopefully the terra (or llvm?) people will fix this eventually. 31 31
Modified render/profile.t from [ae13f6f2b7] to [5ac1497f7a].
41 41 end 42 42 var fullname = lib.render.nym(actor,0) defer fullname:free() 43 43 var profile = data.view.profile { 44 44 nym = fullname; 45 45 bio = bio; 46 46 xid = cs(actor.xid); 47 47 avatar = lib.trn(actor.origin == 0, pstr{ptr=avistr.buf,ct=avistr.sz}, 48 - cs(lib.coalesce(actor.avatar, '/s/default-avatar.webp'))); 48 + cs(lib.coalesce(actor.avatar, '/s/default-avatar.svg'))); 49 49 50 50 nposts = sn_posts, nfollows = sn_follows; 51 51 nfollowers = sn_followers, nmutuals = sn_mutuals; 52 52 tweetday = cs(timestr); 53 53 timephrase = lib.trn(actor.origin == 0, lib.str.plit'joined', lib.str.plit'known since'); 54 54 55 55 auxbtn = auxp;
Modified render/tweet.t from [77ab77b2db] to [2b64155fcc].
29 29 var fullname = lib.render.nym(author,0) defer fullname:free() 30 30 var tpl = data.view.tweet { 31 31 text = bhtml; 32 32 subject = cs(lib.coalesce(p.subject,'')); 33 33 nym = fullname; 34 34 when = cs(×tr[0]); 35 35 avatar = cs(lib.trn(author.origin == 0, avistr.buf, 36 - lib.coalesce(author.avatar, '/s/default-avatar.webp'))); 36 + lib.coalesce(author.avatar, '/s/default-avatar.svg'))); 37 37 acctlink = cs(author.xid); 38 38 permalink = permalink:finalize(); 39 39 attr = '' 40 40 } 41 41 42 42 var attrbuf: int8[32] 43 43 if p.accent ~= -1 and p.accent ~= co.ui_hue then
Modified srv.t from [675eda18a7] to [b74b4804fc].
205 205 lib.http.header { key = 'Cache-Control', value = 'no-store' }, 206 206 lib.http.header { 207 207 key = 'X-Live-Newest-Artifact'; 208 208 value = lib.math.decstr(lastup, &nbuf[20]); 209 209 }, 210 210 lib.http.header { key = 'Content-Length', value = '0' } 211 211 ) 212 - if self.live_last ~= 0 and self.live_last <= lastup then 212 + if self.live_last ~= 0 and self.live_last >= lastup then 213 213 lib.net.mg_printf(self.con, 'HTTP/1.1 %s', lib.http.codestr(200)) 214 214 for i = 0, [hdrs.type.N] do 215 215 lib.net.mg_printf(self.con, '%s: %s\r\n', hdrs[i].key, hdrs[i].value) 216 216 end 217 217 lib.net.mg_printf(self.con, '\r\n') 218 218 else 219 219 self:rawpage(200, pg, [lib.mem.ptr(lib.http.header)] { ................................................................................ 258 258 self:reroute_cookie(dest, &sesskey[0]) 259 259 end 260 260 261 261 terra convo:complain(code: uint16, title: rawstring, msg: rawstring) 262 262 if msg == nil then msg = "i'm sorry, dave. i can't let you do that" end 263 263 264 264 var ti: lib.str.acc ti:compose('error :: ', title) 265 - var bo: lib.str.acc bo:compose('<div class="message"><img class="icon" src="/s/warn.webp"><h1>',title,'</h1><p>',msg,'</p></div>') 265 + var bo: lib.str.acc bo:compose('<div class="message"><img class="icon" src="/s/warn.svg"><h1>',title,'</h1><p>',msg,'</p></div>') 266 266 var body = [convo.page] { 267 267 title = ti:finalize(); 268 268 body = bo:finalize(); 269 269 class = lib.str.plit 'error'; 270 270 cache = false; 271 271 } 272 272
Modified static/live.js from [6fb4c9ec70] to [15d09c6d9b].
16 16 * data-live property, an html element registers itself for live 17 17 * updates from the server. this is pretty straightforward: we 18 18 * retrieve this url from the server as a get request, create a 19 19 * tree from its html, find the element in question, ferret out 20 20 * any deltas, and apply them. */ 21 21 document.querySelectorAll('*[data-live]').forEach(function(container) { 22 22 let interv = parseFloat(container.attributes.getNamedItem('data-live').nodeValue) * 1000; 23 - container._liveLastArrival = '0'; /* TODO include header for this */ 23 + container._liveLastArrival = 0; /* TODO include initial value in document */ 24 24 25 25 window.setInterval(function() { 26 26 var req = new Request(window.location, { 27 27 method: 'GET', 28 28 headers: { 29 29 'X-Live-Last-Arrival': container._liveLastArrival 30 30 } 31 31 }) 32 32 33 33 fetch(req).then(function(resp) { 34 34 if (!resp.ok) return; 35 - let newest = resp.headers.get('X-Live-Newest-Artifact'); 35 + let newest = parseInt(resp.headers.get('X-Live-Newest-Artifact')); 36 36 if (newest <= container._liveLastArrival) { 37 37 resp.body.cancel(); 38 38 return; 39 39 } 40 40 container._liveLastArrival = newest 41 41 42 42 resp.text().then(function(htmlbody) { 43 43 var parser = new DOMParser(); 44 44 var newdoc = parser.parseFromString(htmlbody,'text/html') 45 - // console.log(newdoc.getElementById(container.id).innerHTML) 46 45 container.innerHTML = newdoc.getElementById(container.id).innerHTML 47 46 }) 48 47 }) 49 48 }, interv) 50 49 }); 51 50 });
Modified static/style.scss from [0e6b10a9e2] to [a256539ae3].
414 414 font-weight: bold; 415 415 text-decoration: none; 416 416 cursor: help; 417 417 } 418 418 419 419 input.acl { 420 420 @extend %teletype; 421 - background: url(/s/padlock.webp) no-repeat; 421 + background: url(/s/padlock.svg) no-repeat; 422 422 background-size: 20pt; 423 423 background-position: 0.05in 50%; 424 424 &:focus { 425 - background: url(/s/padlock.webp) no-repeat, $grad-ui-focus; 425 + background: url(/s/padlock.svg) no-repeat, $grad-ui-focus; 426 426 background-size: 20pt; 427 427 background-position: 0.05in 50%; 428 428 }; 429 429 padding-left: 0.40in; 430 430 } 431 431 432 432 div.modal {
Modified view/confirm.tpl from [0d2952df9c] to [3b921f59eb].
1 1 <form class="message" method="post"> 2 - <img class="icon" src="/s/query.webp"> 2 + <img class="icon" src="/s/query.svg"> 3 3 <h1>@title</h1> 4 4 <p>@query</p> 5 5 <menu class="horizontal choice"> 6 6 <a class="button" href="@:cancel">cancel</a> 7 7 <button name="act" value="confirm">confirm</button> 8 8 </menu> 9 9 </form>