max / goingson
| 1 | //! Application metadata commands. |
| 2 | //! |
| 3 | //! Exposes static, app-level information to the frontend. The changelog is |
| 4 | //! embedded at compile time via `include_str!` so the "What's New" dialog can |
| 5 | //! surface release notes after an OTA update without shipping a separate |
| 6 | //! resource file or reading from disk at runtime. |
| 7 | |
| 8 | use instrument; |
| 9 | |
| 10 | /// The project changelog, baked into the binary at build time. |
| 11 | const CHANGELOG: &str = include_str!; |
| 12 | |
| 13 | /// Parse a free-text date ("tomorrow", "friday 3pm", "dec 25", ISO) into a |
| 14 | /// local `YYYY-MM-DDTHH:MM` string, or `None` if unrecognized. |
| 15 | /// |
| 16 | /// This is the single source of truth for date-field parsing; the frontend |
| 17 | /// calls it instead of duplicating the grammar in JavaScript. Resolution is |
| 18 | /// relative to the machine's local wall-clock time. |
| 19 | |
| 20 | |
| 21 | pub async |
| 22 | let now = now.naive_local; |
| 23 | parse_natural_date |
| 24 | .map |
| 25 | |
| 26 | |
| 27 | /// Return the raw `CHANGELOG.md` contents. |
| 28 | /// |
| 29 | /// The frontend parses out the section for the freshly-installed version and |
| 30 | /// renders it in the "What's New" dialog. Infallible — the changelog is part |
| 31 | /// of the binary. |
| 32 | |
| 33 | |
| 34 | pub async |
| 35 | CHANGELOG.to_string |
| 36 | |
| 37 |