Chat Logs

  1. * nevet joined #primate
  2. * blue!~blue@user/blue changed the topic to: https://primate.run | this channel is mirrored to the Primate discord, channel #irc
  3. * phaleth joined #primate
  4. phaleththere's gonna be a police lurking and banning startups for life in the cyberspace https://freebsdfoundation.org/blog/getting-ready-for-the-cyber-resilience-act/
  5. blueheh
  6. bluethe biggest security risk for freebsd is probably having been infiltrated by woke activists
  7. bluebtw phaleth
  8. bluehttps://nevet.repopack.app/features
  9. blueI got it working
  10. phalethcool, it responds with a json, no clue what the data is about
  11. phalethfreebsd foundation is just posting about that on their blog
  12. phaleththe message is that companies will be required to make their SBOM public, but still, might wanna read that blogpost anyway
  13. blueyeah
  14. blueisn't publishing SBOM good though?
  15. bluelike, it shows you're up to date on your supply chain
  16. phalethnot sure, possibly it could required also for websites
  17. blueis that bad?
  18. blueanyway I always try to use as few deps as possible, I doubt that's gonna affect us greatly
  19. blueit's only gonna affect the deps-narcos :P
  20. phalethme too, but the thing is that software still decays
  21. bluetrue
  22. phalethmaybe a good time to start thinking about SSG for primate? at least for Svelte so that primate website can be processed
  23. phalethand markdown and the other few deps
  24. bluewhat's your understanding of SSG? producing only HTML at build time, instead of a .js bundle?
  25. blueit's probably better from a security POV...
  26. phalethproducing a jamstack site, where html, css and js are separate
  27. phalethjs should still leverage the dynamic import trickery client side and also fetch APIs and all the other relevant browser APIs
  28. blueyeah but what's the advantage of that versus the default monothilic build target?
  29. bluemonolithic*
  30. phaleththe advantage is that everything happens client side and all responses from APIs and other resources are merely static and always predictable, there is no database, no session, no anything on a remote place
  31. phalethand so there is no possibility to compromise the remote site
  32. phalethcause you know the remote site has dependencies to do all of it's dynamic processing
  33. bluebut the current primate website doesn't have any session/database anyway
  34. phalethand those can decay and so become compromised
  35. bluehm, fair
  36. phalethwell, but it still requires a server side runtime for dynamic processing
  37. blueyeah, I agree, the only thing here is that the server side runtime is basically almost an nginx replacement at this stage
  38. bluethere's almost no dynamism happening
  39. phalethif the website was static and ran only on say caddy then there are two deps, caddy and golang
  40. bluemhm, true
  41. blueso you want a --target=static for primate that generates an HTML file for every route?
  42. bluethese HTML files all embed the same JS and CSS
  43. phalethdon't remember how the primate cli works, but yeah
  44. bluethe only real question is how fetch-browsing then works. currently when you click a link in primate, it'll get you JSON for the next page
  45. phalethhtml should not embed anything if possible, it's a waste of cache opportunites for browsers
  46. bluewhat if we generated *one* html file, but that would contain embedded json?
  47. bluehm, still wouldn't work for search engines
  48. phalethsince the json is static it's fine and json should not be cached anyway, but js and css and images are different story and should be separate
  49. blueso what about this
  50. bluewe generate many html files, one per page. they contain all the HTML needed to show the page + js (for example, for switching between light/dark scheme)
  51. phalethbut consider adding content hashes to json filenames as well and then it makes sense to cache those
  52. bluebut in addition, we generate a content.json containing all the content, again
  53. blueso that when you click, it can replace it
  54. phalethcontent-1489g47sdf8.json
  55. blueonly problem is that json file would be huge
  56. bluesince we don't have svelte anymore in this scenario, we have no way of saying "this is the dynamic part"
  57. phalethwell, I'd say smaller than html
  58. phalethby about 30%
  59. bluehow? it would contain the HTML for every page
  60. phalethah, I thought it'd only have the data, but that's fine too
  61. phaleththen it's equal to the size of current html
  62. blueso my question is how do you do fetch browsing in this scenario. or well in this case client-based browsing, no additional requests after the first one
  63. phalethhmm, nope
  64. phalethjamstack is about making aditional request for anything via say fetch API, but only as long as that anything is not dynamically processed
  65. phalethit can be a static pre-rendered json file
  66. phalethwith response headers so the browser can aggresively cache it: content-4gf59d4sg8.json
  67. blueyeah but how do you see this working. I access primate.run/docs, I get the full HTML. then I click on /docs/quickstart, what happens?
  68. phalethhtml loads js file in the header and js fetches json
  69. phalethin the header to avoid layout shifting
  70. blueso the js fetches content-quickstart-somehash.json?
  71. blueand what does that contain?
  72. phalethyup, only when on that page
  73. phalethcould be html
  74. phalethmight as well ditch svelte and use htmx at this point
  75. blueindeed
  76. blueif you're getting the whole HTML, you'll lose things like scrolling state on the left bar
  77. blueI'm not sure SSGs have thought this through properly
  78. blueif you collapse the svelte world into a dumb html world, you can't replace custom nodes anymore
  79. bluewell you could, but you'd again need some js logic for that
  80. phalethcan manage the state client side using other means than just js if needed
  81. blueso you're building a UI again
  82. phalethI think htmx has that figured out too
  83. bluehm, I have a different proposition. we keep svelte, but it's running only on the client
  84. phalethbut anyway, it's not a problem of svelte, cause originally svelte was a client side only framework
  85. phalethyeah, svelte is fine
  86. blueand instead of fetching JSON for every click, it fetches a combined all-data.json on the first request. after that there is no subsequent request to the server, at all
  87. phalethmight as well ditch it and use poly again, cause of svelte 5's server side stuff
  88. bluethis combined json contains per data for the list of components and their data
  89. blueper page*
  90. phalethyeah, but that's a lot of data and you'll see SEO penalties
  91. bluewhy? the SEO doesn't need the JSON file
  92. bluethe SEO sees the html, the json can be loaded lazily
  93. blueand primate.run can work completely offline, too
  94. phaleththose tricks you describe used to work in the past, but not anymore, bots are way more clever nowadays
  95. blueyou just need the original request, then you're done
  96. phalethand of course any documentation site should work completely online and be servable using: python -m http.server
  97. phalethoriginal request?
  98. blueyes
  99. blueI do GET /docs, I get the HTML for docs, and also the /data.json which contains all component data I need for every other page
  100. blueso the website can work completely offline after the first request
  101. phalethyeah, but again that data.json combined is huge
  102. phalethah, you mean if the server goes down
  103. phaleththat scenario is not possible
  104. blueI mean if I'm offline
  105. blueI can also literally save the HTML file and it works
  106. phalethwell then get better interwebz and do not browser primate.run when going through the tunnel or something
  107. blueheh
  108. phalethalso if you go offline
  109. blueI wonder how big that data.json would get: you know, it only references a list of components and their data. it just contains the inner HTML for docs, and the data for the navbar
  110. bluemaybe 1-2 MB?
  111. phalethand the site is properly split as I described above, and you have visited the page you navigate previously, you will get a cache hit
  112. phalethso the page should load for you
  113. blueyes, that would work under the scenario I'm proposing jsut the same
  114. phalethand if you are in doubt you can always employ what some jamstack sites do, that is a service worker
  115. blueyes
  116. phaleththe bigger the site grows the bigger the data will get
  117. bluelet me ask chatccp
  118. phalethclanker will tell you to use hugo
  119. blueI'm not using hugo, hugo is dumb
  120. blueall SSGs are total garbage. there's no way to edit posts in an editor in the browser and they all expect you to have nvim
  121. bluethat's why I'm building priss, so I can edit primate blog posts in the browser and get direct feedback on how it looks
  122. bluethose SSGs aren't able to separate mentally the build phase from the run phase
  123. bluewhat I want is wordpress comfort during/before build phase, and SSGs comfort during run phase
  124. bluesomehow nobody had that idea until now
  125. phalethheh, yeah, hugo is just re-doing everything and depends on many things so it has to be run from within docker build
  126. phalethI think only the zig SSG framework checks if a page is already rendered using some sort of hashing tricks, but prolly not
  127. phalethbut I don't remember it's name
  128. phalethzine
  129. blueso the idea of priss is, you have dev mode. like `npx primate`. during that, you can access an in-browser editor that allows you to create content (pages/posts). you also get immediate feedback when editing their markdown (splitscreen).
  130. blueduring build though, this whole /admin area doesn't exist, like at all. we just generate those HTML pages. so unlike wordpress it's not possible to edit pages while the site is running
  131. phalethyou mean edit the page from devtools of the web browser?
  132. blueno, I mean edit the page inside your browser
  133. phaleththat'd be cool, just no idea how it'd work
  134. phalethok, but then you need some kind of editor like wordpress has
  135. phalethi forgot the name of that react thing
  136. bluesplit screen: textarea on your left, preview on your right
  137. blueyes that's no problem. this component is only used in the /admin area. the /admin area doesn't get bundled into the built website
  138. blueyou mean tinymce or whatever
  139. phalethsounds too complicated, someone like me would just use IDE to edit markdown and have esbuild to reload in the web browser
  140. phalethI think wordpress calls their editor gutenberg
  141. phalethbut it's a huge pile of react code
  142. blueyeah but someone like you isn't the target audience
  143. phaleth:)
  144. phalethI mean for starters it's fine to just use a code editor and have esbuild wrapper run in a console
  145. blueit's fine, but I wanna do more than that with priss
  146. bluebtw chatgpt said it's better to split the jsons
  147. blueyou win :(
  148. bluesomething something prefetching
  149. phalethyeah, well, jamstack is a super old concept that just works
  150. blue`You can keep “SPA feel” by prefetching the next page’s JSON on hover/viewport and caching in-memory (and/or Cache Storage).`
  151. phaletheven nowadays with all the nextjs or whatever bullshit rendering strategies
  152. phalethyup, browser already know what to do, just setup the HTTP server properly is the answer
  153. bluefor fully offline, it said it's better use a serviceworker and add --target=static:offline
  154. blue`Generate a service worker that precaches all HTML + page-data + assets (or a configurable subset)`
  155. phalethalso prefetching on hover is an old trick at this point
  156. blueyeah it sounds dumb to me though
  157. phalethand service workers also work well in all browsers
  158. phalethyeah, I'd not do prefetching on hover, thinking of mobile, anyway
  159. blueyeah that's dumb
  160. phalethusing on hover is dumb
  161. phalethexcept for changing colors slightly
  162. blueso I guess we'll do --target=static, and that generates docs/index.html, docs/start/index.html, and docs.json and docs-start.json
  163. bluesvelte becomes clientonly
  164. bluethe only thing I need to consider is if I move primate website to priss, what's the frontend of choice for priss
  165. blueideally should be chooseable
  166. phalethI'd recommend doing just svelte for now and bother with something else when somebody asks
  167. bluek
  168. bluephaleth: https://github.com/primate-run/primate/issues/253
  169. nevetProposal: `--target=static` (SSG output + client-only runtime) · Issue #253 · primate-run/primate
  170. blueI went over it and removed most of the ai slurp
  171. blueit had some interesting ideas like 4)
  172. bluethe proposal is mostly aligned with your suggestion, anyway
  173. phalethheh, nice
  174. phalethyeah, if json is embeded to html then there is no need to configure the HTTP server to add cache headers to json mimetype
  175. bluewell yeah, it's just the current page
  176. phalethright
  177. phalethwhat's weird that it suggest to use script tag for the json with type="applicaton/json", I'd recommend to use template tag https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/template
  178. nevet<template>: The Content Template element - HTML | MDN
  179. bluebut template doesn't contain data, I think that's the difference
  180. phalethhmm? I mean the json could be inside template tag instead of the script tag
  181. phalethscript element will get evaluated by the browser
  182. bluehow does that help you? I thought <template> should be reused
  183. bluein combination with <slot>
  184. phalethhmm, nope, you can put template on the page as a data container for say JS to grab the data later
  185. phalethslot is a webcomponent tag I think
  186. phaleththe purpose of template tag is that it's not being rendered
  187. phalethand so browsers don't bother with it too much, except putting it to DOM
  188. blueah, that's cool
  189. bluecould you add a comment about that at the issue?
  190. phalethI can try logging into github, yeah
  191. bluecool
  192. blueawesome
  193. bluephaleth: I need to prioritise stuff for 0.37
  194. blueperhaps you can help
  195. phalethwell, that's easy, use primate for anything and whenever you run into a bug or something that you need then just update primate, rcompat or the rest
  196. phalethlike for example the thing we ran into yesterday that package.json is required at runtime for a prod app
  197. * nevet joined #primate
  198. * blue!~blue@user/blue changed the topic to: https://primate.run | this channel is mirrored to the Primate discord, channel #irc
  199. blueya