Submit

Back to the channels

#primate

  1. phaleth nice, that tiny nginx:alpine-slim container is capable of proxying to HTTP/2 site https://theanswerisc.repopack.app/
  2. nevet The Answer Is C
  3. phaleth actually, I don't know if nginx itself supports proxying to HTTP/2, it's prolly defaulting to HTTP/1.1, but anyway
  4. phaleth the traffic goes like this: http client <-> contabo VPS <-> haproxy nspawn container <-> root nspawn container <-> rootless podman nginx container <-> fly.io cloud deployment https://github.com/terrablue/theanswerisc/blob/master/.github/workflows/deployment.yml
  5. blue phaleth: hi
  6. blue I added a readme to the repopack repo
  7. blue phaleth: so ideally we should have: http client <-> contabo VPS <-> haproxy podman container <-> rootless podman nginx container <-> podman machine running the blog
  8. blue or maybe we don't even need that interim podman thingy
  9. blue so one nice thingy the podman API saves us is manual network management
  10. blue you can just do POST networks and it allocates by itself. you can provide a name, which is great, because we'll use that to delete networks when apps are deleted
  11. blue phaleth: https://images4.imagebam.com/d8/24/e6/ME1B5M64_o.png
  12. blue so when you create an app, we add an entry to the app table in postgres, and we can use the id to refer to the network (or generate a network_id UUID column)
  13. blue phaleth: that rootless podman nginx container, it's running under your user, right?
  14. blue btw the podman API is nice. this is what you get if you try to create a network with an existing name:
  15. blue Error: HTTP 409: {"cause":"network already exists","message":"network name testtest already used: network already exists","response":409}
  16. phaleth blue: hi
  17. phaleth yeah, all podman containers and I think haproxy can be installed on arch host directly
  18. phaleth true, everything can be named and names are unique
  19. blue sounds good
  20. phaleth moved haproxy to archlinux host
  21. phaleth nice, all browsers finally support https://developer.mozilla.org/en-US/docs/Web/API/Trusted_Types_API
  22. nevet Trusted Types API - Web APIs | MDN
  23. blue dreamreal: can you now configure nevet for the primate repo?
  24. dreamreal I can but you're going to have to set up the webhook: I'll DM you the token on discord.
  25. dreamreal github webhook primate-run/primate
  26. nevet Error: No registered repository found for primate-run/primate
  27. blue shouldn't *I* send YOU the token?
  28. dreamreal Gah, another bug - the webhook mutates the existing record.
  29. dreamreal Ew, no
  30. dreamreal that means I'm storing the token
  31. dreamreal nevet generates it.
  32. blue yes? you need to store the token anyway to validate the hook
  33. dreamreal I don't, though: it gets the token from outside and encrypts it to match
  34. blue https://docs.github.com/en/webhooks/using-webhooks/validating-webhook-deliveries
  35. blue that's literally what the github docs say
  36. blue unless I missed something, I don't get how you can otherwise validate it
  37. blue "After creating a secret token, you should store it in a secure location that your server can access."
  38. blue typically, you put that in an env variable
  39. blue or if you wanna do it programmatically, something like a keyserver
  40. dreamreal I generate a string: aaabbcccdd. Send it to the user via PM. Store the encrypted version so I never have aaabbcccdd again. When I get aaabbcccdd over https, I re-encrypt it and check.
  41. blue yes, so you still store the token
  42. blue you just encrypt it
  43. blue which is... I guess fine
  44. dreamreal yes, and I COULD accept external tokens where you say "set it to this explicitly" but... eh
  45. blue I don't really see the point, but sure
  46. dreamreal give me a minute, workflow oversight
  47. blue honestly I have no idea *how* that can be even work. github sends you a hash signature using the token with each payload. how can you recalculate the signature if you don't have the original token?
  48. blue typically you take the payload + token, calculate a signature, then compare it to what gh sent
  49. blue but if you encrypted the token, that's not gonna work
  50. blue dreamreal: https://github.com/terrablue/gpbot/blob/master/routes/index.js#L25-L27
  51. blue you need to replicate *that* logic
  52. dreamreal It's already there
  53. blue well, that can't work unless you have the plain secret
  54. blue maybe you decrypt it at runtime, but I don't see the point in the indirection, I'd just have it in memory
  55. dreamreal Yes, I have to decrypt it, it's fine
  56. dreamreal but the code's already written, rabbit's dead, no win in changing it
  57. blue but then you need to store a decryption key...
  58. dreamreal I have one, I configure it externally
  59. blue what did you gain in trading a secret for a decryption key?
  60. dreamreal Not a lot, I was doing something dumb and re-using a key that was supplied elsewhere
  61. blue ok. well anyway, it doesn't really matter who of us supplies the secret. but if YOU do, I need the plaintext one obviously
  62. dreamreal yes, you'd get it
  63. dreamreal like I said, it generates a key, sends to the user, then stores something different
  64. blue yes, that's an indirection I wouldn't have chosen in my code, but if you want to do it like that, that's fine
  65. dreamreal github webhook primate-run/primate
  66. nevet Webhook enabled for primate-run/primate. Configure GitHub to POST to https://api.bytecode.news/webhooks/github with the provided secret.
  67. dreamreal github subscribe primate-run/primate
  68. nevet Subscribed to primate-run/primate
  69. dreamreal github subscriptions
  70. nevet primate-run/primate
  71. blue would be nice if nevet output the ping
  72. dreamreal Did it report success on the github console?
  73. blue yes
  74. dreamreal Then it worked. And the console will show pings, for what it's worth.
  75. blue I meant here. that's a wait to test full stack working without access to the console
  76. blue that's a way*
  77. dreamreal Well, the thing is, ORDINARILY this is a bit of an odd path
  78. blue how so?
  79. dreamreal admins are the only ones who can subscribe, so ordinarily the admin is the one who A) has access and B) sets the token
  80. dreamreal so *I* as the admin would be the one to validate the ping, not the channel
  81. blue yes but *I* don't have access to the console
  82. dreamreal I know
  83. dreamreal like I said, odd path
  84. blue it's only an odd path if you don't intend for nevet to relay those notifications for non-admins
  85. * dreamreal sighs. But like I said: ODD PATH. You create a subscription for webhooks... THEN you add what channels watch for them.
  86. dreamreal Without the channels, nevet doesn't know where to say "hey, ping succeeded!"
  87. dreamreal it's literally an internal event, and it's internally published
  88. blue that's a weird flow to me. if you do !github webhook primate-run/primate in #primate, I'd think that's intended to be used here
  89. dreamreal I get it
  90. dreamreal but the flow is not that way: I can create subscriptions ANYWHERE, and channel subscriptions are separate
  91. dreamreal same for RSS
  92. dreamreal (in fact, they use the same codebase and design)
  93. blue nonetheless, you can *still* map the ping event, and it works just like every other event: it outputs once it has channels
  94. dreamreal crikey
  95. dreamreal version
  96. nevet nevet 1.0 | 84619bb (github-webhook-fixes) | Built 2026-03-08 09:14:24 EDT
  97. dreamreal So try the emulated thing, let's see what it does
  98. blue well it still says successful
  99. blue for the redelivery
  100. dreamreal yep.
  101. blue yes? what changed?
  102. blue I see no message
  103. dreamreal I saw it
  104. blue ...
  105. dreamreal Again, pings are not echoed to subscriptions
  106. blue but why?
  107. dreamreal Because I don't trust them yet. I may turn it on eventually. But I don't know github's ping policy yet.
  108. blue there's no ping policy. it's done when you create a webhook, and when you change it iirc. I had the ping event mapped on gpbot, I'd have noticed it otherwise
  109. blue it's literally a way to test the full stack
  110. blue starting to get tired of claude here
  111. blue it's regularly amnesic, forgetting things discussed like 3 minutes ago
  112. dreamreal https://github.com/jottinger/bytecode.news/issues/196
  113. nevet github: ping should propagate to subscribed channels · Issue #196 · jottinger/bytecode.news
  114. dreamreal version
  115. nevet nevet 1.0 | 22fb3be (main) | Built 2026-03-08 09:17:40 EDT
  116. phaleth blue: thanks for the readme, quite useful
  117. blue yw phaleth
  118. blue `Happy DOM has a long history of incomplete default form-submission behavior`
  119. blue this industry is full of idiots
  120. blue time for @rcompat/dom
  121. blue phaleth: https://gitea.repopack.app/repopack/website/commit/3960e135869ad6930e25dbde1916c481b2e6e8e5
  122. blue can now create networks; duplicates are recognised and surfaced as form errors
  123. blue this has been interesting info for the future generation of openapi clients
  124. blue in future style, this will be:
  125. blue await client.createNetwork({ name }).conflict({ field: "name", message: "A network with this name already exists" });
  126. blue (409 is CONFLICT)
  127. blue that means HTTP status codes will be surfaced on the generated openapi client as methods
  128. blue so you can literally do .conflict().forbidden().notFound()
  129. blue the default return value is the OK (2xx) case
  130. phaleth nice, I've made a PR there just to test, it now has a merge conflict, very cool
  131. blue btw, I've noticed gitea is much, MUCH faster than github
  132. blue like orders of magnitude faster
  133. blue monopolies SUCH!
  134. blue SUCK*
  135. phaleth yup, I've noticed gitea has some frontend devs that continuously put effort into modularizing the frontend so it remains fast after features get added
  136. blue well, of course we're not gonna use gitea but repopack itself, but it's still so freshing to see that it doesn't HAVE to be this way
  137. blue or refreshing, rather
  138. phaleth yeah, I kinda refuse to go back to github already
  139. blue ya, github can go to hell
  140. blue phaleth: https://gitea.repopack.app/repopack/website/commit/68422c1c06103eeea93e91c2df3f48425b7e6487
  141. blue I really need to make it easily possible to add woff2 files into your file, it's ridiculous to need a module for that
  142. blue or maybe woff2 being parsed as file by esbuild should just be the default
  143. blue s/into your file/into your app/
  144. phaleth I remember webpack can take in static assets and put them where needed, also with the option to not add content hash to the filename
  145. phaleth maybe esbuild can do that too
  146. phaleth looks like this copy loader can be used https://esbuild.github.io/content-types/#copy
  147. blue yes, essentially it's the file loader
  148. blue the file loader causes esbuild to base64 the file and include it in the bundle
  149. blue https://gitea.repopack.app/repopack/website/commit/68422c1c06103eeea93e91c2df3f48425b7e6487#diff-4abca52bbb0fae9100b8e3e180ca4e8a39cc38a5
  150. blue but for woff2, this should be the standard behaviour. unless you're like a platform that offering woff2 for download, I don't see how you'd ever want different behaviour
  151. blue and even if you are a platform, you wouldn't place the woff2 files for download inside static, but would have them downloaded dynamically
  152. blue and if you DO want a different behaviour, you write a primate module
  153. blue phaleth: did you pull down the nice coloured changes?
  154. blue it's just adding some font and a bit of colours so it doesn't look 100% lame as before
  155. phaleth not yet, I'm gonna try to find some podman REST API reference
  156. phaleth afk
  157. blue phaleth: https://docs.podman.io/en/latest/_static/api.html?version=latest
  158. nevet Reference
  159. blue programmatic: https://storage.googleapis.com/libpod-master-releases/swagger-latest.yaml
  160. blue unfortunately it's swagger 2.0 which the primate openapi generator won't support
  161. blue but I believe it's possible to convert it to openapi 3.0
  162. blue and then I'll add it to the primate/openapi repo so it's av at openapi.primate.run
  163. blue /libpod/networks/create:
  164. blue post:
  165. blue description: Create a new network configuration
  166. blue operationId: NetworkCreateLibpod
  167. blue this operationId is totally dumb
  168. blue dreamreal: why is everyone so dumb in this industry all the time
  169. blue what am I supposed to do with "NetworkCreateLibpod"???
  170. blue the operationId is SUPPOSED to be "CreateNetwork"
  171. blue I suppose that in the swagger converter, I can add a strategy: "drop -Libpod, switch order"
  172. blue ok, I see what they did
  173. blue so we also have
  174. blue /libpod/pods/{name}/exists:
  175. blue get:
  176. blue description: Check if a pod exists by name or ID
  177. blue operationId: PodExistsLibpod
  178. blue can't really deal with that. so we'll be dropping -Libpod and generating as is
  179. blue client.podExists is acceptable. client.networkCreate sounds dumb but ok
  180. blue could've put a non-trivial effort into this though, redhat
  181. blue I sure do hope the nevet operationIds are SLIGHTLY better
  182. blue phaleth: dreamreal: https://github.com/primate-run/openapi/commit/00d9e4e77d2dadc948da6541bbab914eabc817cb
  183. nevet add support for swagger to openapi conversion and stripping operation… · primate-run/openapi@00d9e4e
  184. blue phaleth: https://github.com/primate-run/openapi/commit/7d8c850f277f4d644e6b002e26b1791ef5e8f4b6
  185. nevet add podman/libpod · primate-run/openapi@7d8c850
  186. blue can we redeploy the openapi machine?
  187. blue maybe as a podman container already
  188. blue nice, you created a user podman
  189. dreamreal blue: I gotta get you to learn how to use !article :D
  190. blue wth is THAT, dreamreal
  191. dreamreal It's a way to get nevet to build a draft article online
  192. dreamreal you say "!article title" and can add content blocks with "!content this is some content here", add channel context with "!logs 5m" (include the last five minutes for context), and signal done with !done (it'll time out on its own if you don't, after five minutes of no interaction) - and bam! draft article on bytecode.news
  193. dreamreal the diataxis article was written that way
  194. blue article Primate
  195. nevet Idea session started: "Primate". Use 'content <text>' to add body paragraphs, 'done' to save, or 'cancel' to discard.
  196. blue context Primate is the universal web framework -- the best tool to build websites with
  197. nevet ok, blue: updated context primate.
  198. blue done
  199. nevet Idea saved as draft: "Primate" (0 content blocks).
  200. blue oh, I wrote context, my bad
  201. blue well, at least it did something
  202. dreamreal It did indeed.
  203. blue I have no idea how to edit it
  204. dreamreal YOU don't. *I* would have to.
  205. blue hahaha
  206. dreamreal The !article thing submits DRAFTS. If you're not authenticated, it submits as anonymous.
  207. blue why can't I edit drafts though, if submitted anonymously?
  208. dreamreal This is entirelly intentional.
  209. blue also, wth is THIS
  210. blue https://bytecode.news/factoids/context%20primate
  211. nevet Nevet - Reference UI
  212. dreamreal What about it?
  213. blue so ! randomly creates factoids?
  214. blue that seems like a bug
  215. dreamreal No, you said "context primate" and "is" and some content.
  216. dreamreal That's working as designed. You created a factoid.
  217. blue oh man, that's CRAZY
  218. dreamreal if you'd used "!content primate is..." the internal routing would be different.
  219. blue that should be like +factoid or something
  220. dreamreal But "context" is not a keyword for the article system.
  221. dreamreal "is" is pretty human.
  222. blue yeah but you do realise that having both context words and pattrens like !x is y, is confusing, right?
  223. blue that effectively means that a typo can have wholly unintended consequences
  224. dreamreal Sure. And compare that against the ACTUAL formal syntax: !foo=bar
  225. dreamreal yep, and the consequences cost very very close to nothing so I don't care
  226. dreamreal just like karma
  227. blue so the making of a good system, that a typo does NOT cause wholly unintended behaviour
  228. blue but rather results in the system telling you made a typo
  229. blue something like: "!context does not exist as a operation"
  230. dreamreal in which case you have a formal grammar and not something easy for humans to use.
  231. blue and even nicer: "did you mean `!content`?"
  232. dreamreal So: no.
  233. dreamreal How would teh system know you might have meant "content?"
  234. dreamreal The system has no unified grammar. This is intentional.
  235. blue because it has a very small levenshtein distance
  236. blue stop making excuses, this is totally normal, git has it
  237. * dreamreal sighs
  238. dreamreal no. Because that means the system needs to know a shitload more about the operations than it should. It doesn't KNOW there are operations.
  239. dreamreal Actually, that's not true: the system DOES know there are operations... like, six or seven of them. Out of the close to 80 now.
  240. blue sigh, fine, your system, you know BEST, me typoing content into context is just a FACT of life and should result in garbage in the system
  241. dreamreal Yep! And it does! And again, the actual cost is 0
  242. dreamreal it's fine, it's also trivial to correct
  243. dreamreal context primate.forget
  244. nevet ok, forgot context primate.
  245. dreamreal OH NO SO MUCH SWEATING
  246. blue oh man, nevermind, I'll just shut up, I'm tired of this uphill battle
  247. blue you just do whatever you think is best and I'll stop making suggestions
  248. dreamreal The bot is messy: that's a fact of life. The actual OPERATION usage is absolutely linear; if we had an article *http operation* it can ensure types and make sure such things are unambiguous. Over IRC? not so much.
  249. dreamreal We could even do that for slack and discord, if I supported actual actions.
  250. blue it's really not messy to have a clear way to edit factoids, say with `+factoid title | text` to add, `~factoid title | text` to edit, and `-factoid title` to delete
  251. blue instead of using a pattern nobody understands like x is y
  252. dreamreal Gotta get lunch, later
  253. blue ciao
  254. blue phaleth: should we move primate/openapi to gitea?
  255. blue I'm honestly thinking of keeping just the high profile projects, so primate-run/primate, on GH. all the rest I think can move away
  256. phaleth blue: if you don't want that to be open why not
  257. phaleth same for superarch
  258. blue oh it will be open, in the future, when it's available under repopack.com/primate/primate
  259. phaleth should I redeploy primate/openapi?
  260. blue sorry, repopack.com/primate/openapi
  261. blue yes
  262. phaleth ok
  263. blue did you pull the latest rp colours? :P
  264. blue hm
  265. blue should I call the org primate or primate-run on gitea
  266. blue I guess it doesn't matter much
  267. phaleth call it primate
  268. blue k
  269. phaleth openapi is updated
  270. phaleth actually, no it isn't, forgot to download from git
  271. phaleth github*
  272. blue phaleth: https://gitea.repopack.app/primate/openapi
  273. blue I'm gonna delete the repo on gh
  274. blue btw I got a ton of template repos on gh for primate
  275. blue I'm sure we can do this better with repopack
  276. blue tell me when you've moved this to gitea
  277. blue and I can delete
  278. blue if you need to make it easier for yourself, add a pubkey, that's what I did
  279. blue I have a pubkey blue@vps in my gitea
  280. blue so I don't need to use weird bearer tokens
  281. phaleth you can delete from github all you want
  282. blue done
  283. phaleth https://openapi.primate.run/manifest.json
  284. blue NICE, libpod is there!
  285. blue dreamreal: I FIXED IT!
  286. blue https://openapi.primate.run/spec/podman/libpod.json
  287. blue now we can have a nice `client.networkCreate`
  288. blue phaleth: if you look at the NetworkCreate operation, you see it exposes four responses
  289. blue so the generated openapi client will have:
  290. phaleth no clue what I'm looking at in that json, will have to look into that later
  291. phaleth gotta go now, see ya
  292. blue client.networkCreate(/* params */).badRequest(/* handler */).conflict(/* handler */)
  293. blue ciao

Search posts