gitoriaLog in with ident

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitf83571c3f83571c3tracker#18 (mission 067): daily sync by change lists — TMDB /tv|movie/changes (since the stored day, paged) + TVmaze /updates/shows → only our changed titles (followed: full step, unfollowed: light step — changed seasons, no TVmaze), full walk on first run / gap > 14 days / failed list; show record refreshed (title, tmdbSummary, tagline, status, genres …; renamed titles re-indexed); summary = the creator's own text (page: summary > tmdbSummary > tvmazeSummary), one-time clear of copied summaries (9,647 on the live copy); gate 261, tests/realdata-018*.mjs, README + STATUSmref83571c3/plugins/smtp/Mailer.hl

3.4 KB

  1. \* hl:smtp — the SMTP submission client.
  2. import { Mailer } from 'hl:smtp'
  3. m = new Mailer('mail.example.com', 587, {
  4. user = '[email protected]'
  5. pass = '…'
  6. from = '[email protected]'
  7. })
  8. m.send({ to = '[email protected]' subject = 'Hello' text = 'Hi' })
  9. Non-blocking: send() answers a job id, the OUTCOME arrives later — drain
  10. it with `for (r of m.results())`, or deliver() it as the declared events
  11. below while the program keeps running. *\
  12. /* The first three declared properties ARE the positional signature (SPEC.md
  13. "The file root is the constructor"), so `new Mailer(host, port, options)`
  14. reads as written. */
  15. \* One send was ACCEPTED by the server. r = { id, ok, code, stage, message,
  16. secure, to }. *\
  17. emit sent(
  18. Hybrid r \\ the result record for one message
  19. )
  20. \* One send FAILED — refused, TLS problem, timeout. Same record shape;
  21. `stage` names where it died. *\
  22. emit failed(
  23. Hybrid r \\ the result record for one message
  24. )
  25. String host = "127.0.0.1" \\ the submission server
  26. Number port = 587 \\ 587 STARTTLS, 465 implicit TLS
  27. Hybrid options = null \\ { user, pass, from, … } — credentials and defaults
  28. \* The plugin's handle for this mailer — set by the run body; a send() before
  29. construction finished is impossible, the root IS the constructor. *\
  30. Number handle = 0
  31. \* SEND — non-blocking. Validated and rendered HERE, on this thread, so a
  32. refusal (a line break in to/subject, a missing recipient, an address
  33. without an @) is a located error at YOUR line, through `on Error` like any
  34. plugin failure. Answers the job id; the outcome arrives on the result
  35. source. msg: { to (String or list), subject, text, html, from }. *\
  36. send(
  37. Hybrid msg \\ the message — to/subject/text/html/from
  38. ) {
  39. return __native("smtp.send", handle, msg)
  40. }
  41. \* THE RESULT SOURCE, drained: `for (r of m.results())` yields one result per
  42. accepted send and ENDS when every send is answered — which is what lets a
  43. script that only sends mail terminate. *\
  44. results() {
  45. return __native("smtp.results", handle)
  46. }
  47. \* THE RESULT SOURCE, delivered: results arrive as the declared sent/failed
  48. events while the program goes on — a server keeps serving with mail in
  49. flight. Use this OR results(), never both: they take from one queue. *\
  50. deliver() {
  51. __native("smtp.mark_registered", handle)
  52. __native("eventloop.register", __native("smtp.results", handle), "mail")
  53. }
  54. \* How many sends have not been answered yet. *\
  55. pending() {
  56. return __native("smtp.pending", handle)
  57. }
  58. \* Stop the sender thread. A job already in conversation finishes. *\
  59. close() {
  60. __native("smtp.close", handle)
  61. handle = 0
  62. }
  63. // The split every caller of deliver() wants: one event per outcome. `mail`
  64. // is delivered at THIS instance by the loop, and the re-emit dispatches at
  65. // it too, so an instance-scoped `on m.sent(r)` in the constructing program
  66. // hears it.
  67. on mail(r) {
  68. if (r.ok == true) {
  69. emit sent(r)
  70. } else {
  71. emit failed(r)
  72. }
  73. }
  74. // Open the mailer and start its sender thread. A METHOD, called from the run
  75. // body — never a root assignment: a bare `handle = …` at the root would be a
  76. // property INITIALIZER, and initializers run BEFORE positional args bind
  77. // (construction order 1 vs 4) — it would open a mailer for the DEFAULT host.
  78. // Same shape as hl:http1's listen().
  79. open() {
  80. handle = __native("smtp.open", host, port, options)
  81. }
  82. // Run body — the constructor's last act.
  83. open()

Branches

Latest commits

  • f83571c3tracker#18 (mission 067): daily sync by change lists — TMDB /tv|movie/changes (since the stored day, paged) + TVmaze /updates/shows → only our changed titles (followed: full step, unfollowed: light step — changed seasons, no TVmaze), full walk on first run / gap > 14 days / failed list; show record refreshed (title, tmdbSummary, tagline, status, genres …; renamed titles re-indexed); summary = the creator's own text (page: summary > tmdbSummary > tvmazeSummary), one-time clear of copied summaries (9,647 on the live copy); gate 261, tests/realdata-018*.mjs, README + STATUSmre
  • 10bb3f93tracker#28 (mission 061): full cast (all seasons, main cast by episodes, guest stars) + crew (created by, directed by, written by, screenplay, story, music) — stored by the details completion, the daily sync, the search import (one details request) and a background credits job (resumes, RSS limit); show page collapsed after 20 with client-side Show all; showBySlug via a slug map; gate 249, tests/realdata-028.mjs, README + STATUSmre
  • 25a50bc4tracker#26 (mission 059): titles from a filmography are completed — on open (skeleton, step-wise face showComplete, no reload) and by the in-app details repair (resumes, TMDB-paced, series in parts); cast from TMDB credits; gate 231, tests/realdata-026.mjs, README + STATUSmre
  • 1704ec45tracker#17 (mission 057): season caret down/up, skeleton rows while a season loads, sessionless showSeasonEpisodes face (no page re-mount), client-only close; gate 214, tests/realdata-057.mjs, README + STATUSmre
  • f2fe3e36mission 056: README + STATUS (merge, fixes, Hybriel 8590df63, real-data check), tests/realdata-056.mjs, tools/check-public-slugs.hlmre
  • f40c250emission 056: re-vendor hybriel master 8590df63 (#121, #122); an adult title's page is Not found for non-followers; gate: leave the page before stopping the servermre
  • 2b7fdd6cmission 056: signed-out header one row on phones ("Log in", nowrap), backfill skips adult titles' posters, gate checksmre
  • 2c53d5efMerge branch 't16-person' (tracker#16 person pages) into main; filmography shows only public titles (054 adult flag), gate race fix (backfill start line)mre
  • c171227emission 054: hide adult/unknown titles from the public lists and the search; in-app adult-flag backfill (TMDB details + poster per title, resumes), gate + real-data proofmre
  • 139fafd8tracker#16: short bio (4 lines, click = all), real-data check script, README + STATUSmre
  • 93be9476tracker#16: person pages /person/<slug> with the filmography fetched from TMDB on the first visit (step by step), gatemre
  • 47a3cae6STATUS: mission 053 merge commit idsmre
  • dcc5eecaMerge branch 't14-search'mre
  • 03edc783Merge branch 't15-tvmaze'mre
  • 71b46345tracker#15: numbering check by date or title, placeholder titles in other languages, docs + real-data proofmre
  • 6bb2daf1tracker#13: homepage (tiles, intro, latest movies/shows), /shows, /movies/page/N, /my/movies; lists cached in memorymre
  • b8bd1157tracker#14: README + STATUS (search, real-data numbers, gate, merge notes)mre
  • 65c694a8tracker#14: search — header magnifier, /search/<text> (in-memory word-prefix index over titles + people), Fetch from web (TMDB search/multi, ours left out), Add = import via syncShow; gate +25 checks, real-data scriptmre
  • 34f2c15btracker#15: TVmaze merge in the sync (gaps only: new episodes/seasons, empty titles/air dates; numbering check), fake TVmaze episodes + gatemre
  • cbdc4ea7tracker#12: link icons TMDB/IMDb/TVDB/TVmaze; sync fills missing ids (TVmaze lookup); movies fetched via /movie/mre