Commit graph

647 commits

Author SHA1 Message Date
dependabot[bot]
891296b36b
Bump openssl from 0.10.64 to 0.10.66 (#188)
Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.64
to 0.10.66.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/sfackler/rust-openssl/releases">openssl's
releases</a>.</em></p>
<blockquote>
<h2>openssl-v0.10.66</h2>
<h2>What's Changed</h2>
<ul>
<li>Fixed invariant violation in <code>MemBio::get_buf</code> with empty
results by <a href="https://github.com/alex"><code>@​alex</code></a> in
<a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2266">sfackler/rust-openssl#2266</a></li>
<li>Release openssl v0.10.66 by <a
href="https://github.com/alex"><code>@​alex</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2267">sfackler/rust-openssl#2267</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.65...openssl-v0.10.66">https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.65...openssl-v0.10.66</a></p>
<h2>openssl-v0.10.65</h2>
<h2>What's Changed</h2>
<ul>
<li>don't emit rerun-if-changed when vendoring by <a
href="https://github.com/reaperhulk"><code>@​reaperhulk</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2177">sfackler/rust-openssl#2177</a></li>
<li>Prepare for openssl-sys 0.9.101 release by <a
href="https://github.com/alex"><code>@​alex</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2182">sfackler/rust-openssl#2182</a></li>
<li>don't emit rerun-if-changed unless the path exists and is readable
by <a href="https://github.com/reaperhulk"><code>@​reaperhulk</code></a>
in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2187">sfackler/rust-openssl#2187</a></li>
<li>Added support for LibreSSL 3.9.0 by <a
href="https://github.com/alex"><code>@​alex</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2202">sfackler/rust-openssl#2202</a></li>
<li>Support stable LibreSSL 3.9.x by <a
href="https://github.com/alex"><code>@​alex</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2209">sfackler/rust-openssl#2209</a></li>
<li>openssl-sys 0.9.102 release by <a
href="https://github.com/alex"><code>@​alex</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2210">sfackler/rust-openssl#2210</a></li>
<li>Add repository field to openssl-macros crate by <a
href="https://github.com/paolobarbolini"><code>@​paolobarbolini</code></a>
in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2211">sfackler/rust-openssl#2211</a></li>
<li>Add missing openssl-sys dependency by <a
href="https://github.com/pieterdd"><code>@​pieterdd</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2212">sfackler/rust-openssl#2212</a></li>
<li>Test OpenSSL 3.3.0-beta1 by <a
href="https://github.com/sfackler"><code>@​sfackler</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2216">sfackler/rust-openssl#2216</a></li>
<li>test against 3.3.0 final by <a
href="https://github.com/alex"><code>@​alex</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2218">sfackler/rust-openssl#2218</a></li>
<li>fix min-versions in CI by <a
href="https://github.com/alex"><code>@​alex</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2228">sfackler/rust-openssl#2228</a></li>
<li>Make X509_VAL opaque for LibreSSL 4.0.0 by <a
href="https://github.com/botovq"><code>@​botovq</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2227">sfackler/rust-openssl#2227</a></li>
<li>Use the newer names for STACK_OF(T) functions with BoringSSL by <a
href="https://github.com/davidben"><code>@​davidben</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2231">sfackler/rust-openssl#2231</a></li>
<li>Only declare OpensslCallbacks in bindgen builds by <a
href="https://github.com/alex"><code>@​alex</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2234">sfackler/rust-openssl#2234</a></li>
<li>Fix building with latest BoringSSL by <a
href="https://github.com/davidben"><code>@​davidben</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2230">sfackler/rust-openssl#2230</a></li>
<li>Emit rustc-check-cfg for nightly by <a
href="https://github.com/alex"><code>@​alex</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2235">sfackler/rust-openssl#2235</a></li>
<li>Configure OpenSSL data dir on vendored builds. by <a
href="https://github.com/DanielSidhion"><code>@​DanielSidhion</code></a>
in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2122">sfackler/rust-openssl#2122</a></li>
<li>Add boringssl keylog callback support by <a
href="https://github.com/mspublic"><code>@​mspublic</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2237">sfackler/rust-openssl#2237</a></li>
<li>Correct the name of the <code>pkgconf</code> package on some distros
by <a
href="https://github.com/JonathanBrouwer"><code>@​JonathanBrouwer</code></a>
in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2253">sfackler/rust-openssl#2253</a></li>
<li>Add some OpenSSL 3 QUIC raw bindings by <a
href="https://github.com/bdbai"><code>@​bdbai</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2257">sfackler/rust-openssl#2257</a></li>
<li>Initialize OpenSSL in MD constructors by <a
href="https://github.com/sfackler"><code>@​sfackler</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2258">sfackler/rust-openssl#2258</a></li>
<li>Switch Pkey::from_ to use set1 functions by <a
href="https://github.com/alex"><code>@​alex</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2262">sfackler/rust-openssl#2262</a></li>
<li>Release openssl v0.10.65 and openssl-sys v0.9.103 by <a
href="https://github.com/alex"><code>@​alex</code></a> in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2265">sfackler/rust-openssl#2265</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a
href="https://github.com/paolobarbolini"><code>@​paolobarbolini</code></a>
made their first contribution in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2211">sfackler/rust-openssl#2211</a></li>
<li><a href="https://github.com/pieterdd"><code>@​pieterdd</code></a>
made their first contribution in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2212">sfackler/rust-openssl#2212</a></li>
<li><a
href="https://github.com/DanielSidhion"><code>@​DanielSidhion</code></a>
made their first contribution in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2122">sfackler/rust-openssl#2122</a></li>
<li><a href="https://github.com/mspublic"><code>@​mspublic</code></a>
made their first contribution in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2237">sfackler/rust-openssl#2237</a></li>
<li><a
href="https://github.com/JonathanBrouwer"><code>@​JonathanBrouwer</code></a>
made their first contribution in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2253">sfackler/rust-openssl#2253</a></li>
<li><a href="https://github.com/bdbai"><code>@​bdbai</code></a> made
their first contribution in <a
href="https://redirect.github.com/sfackler/rust-openssl/pull/2257">sfackler/rust-openssl#2257</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.64...openssl-v0.10.65">https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.64...openssl-v0.10.65</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="ad70a0bea5"><code>ad70a0b</code></a>
Merge pull request <a
href="https://redirect.github.com/sfackler/rust-openssl/issues/2267">#2267</a>
from alex/bump-for-release</li>
<li><a
href="5ce473b4e5"><code>5ce473b</code></a>
Release openssl v0.10.66</li>
<li><a
href="aef36e0f39"><code>aef36e0</code></a>
Merge pull request <a
href="https://redirect.github.com/sfackler/rust-openssl/issues/2266">#2266</a>
from alex/mem-bio-invariant</li>
<li><a
href="142deef717"><code>142deef</code></a>
Fixed invariant violation in <code>MemBio::get_buf</code> with empty
results</li>
<li><a
href="32f150b05a"><code>32f150b</code></a>
Merge pull request <a
href="https://redirect.github.com/sfackler/rust-openssl/issues/2265">#2265</a>
from alex/bump-for-release</li>
<li><a
href="98addd271e"><code>98addd2</code></a>
Release openssl v0.10.65 and openssl-sys v0.9.103</li>
<li><a
href="7c7958d436"><code>7c7958d</code></a>
Merge pull request <a
href="https://redirect.github.com/sfackler/rust-openssl/issues/2262">#2262</a>
from alex/pkey-api</li>
<li><a
href="d7b12ccf1f"><code>d7b12cc</code></a>
Switch Pkey::from_ to use set1 functions</li>
<li><a
href="22ffa9add6"><code>22ffa9a</code></a>
Merge pull request <a
href="https://redirect.github.com/sfackler/rust-openssl/issues/2258">#2258</a>
from sfackler/init-md</li>
<li><a
href="9de3794474"><code>9de3794</code></a>
Initialize OpenSSL in MD constructors</li>
<li>Additional commits viewable in <a
href="https://github.com/sfackler/rust-openssl/compare/openssl-v0.10.64...openssl-v0.10.66">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=openssl&package-manager=cargo&previous-version=0.10.64&new-version=0.10.66)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/tiffany352/rink-rs/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-22 17:08:33 -07:00
Tiffany Bennett
db3f8d060b
API usability improvements (#184)
* Added helper functions `load_definitions()` and `load_currency()` on
Context to deduplicate code every frontend had to write out
* Added ToSpans impl for `Result<QueryReply, QueryError>` to avoid a
pointless looking match statement
* Added more examples to the API docs
* Fleshed out the API docs a bit more
2024-06-02 15:59:35 -07:00
Tiffany Bennett
df8b961edf fix warnings on nightly 2024-06-02 14:11:45 -07:00
Tiffany Bennett
5859e928e9
Display impls use token formatting (#183)
Deduplicates a bunch of code by having Display impls use the TokenFmt
implementations. There were some bugs with the TokenFmt formatting that
I had to fix, and some slight differences in their output that required
adjusting tests. This also fixes a longstanding bug where there were 2
spaces in the output, like `42 (dimensionless)`.

I also got rid of that two-step pattern parsing stuff, it's simpler to
iterate the chars of the pattern string instead.
2024-06-02 13:54:24 -07:00
Tiffany Bennett
09c51634c5 more tests 2024-06-02 13:50:36 -07:00
Tiffany Bennett
50821a845a fix compilation on openbsd via makefile 2024-06-02 12:35:30 -07:00
dependabot[bot]
d642411f31
Bump pug from 3.0.2 to 3.0.3 in /web (#182)
Bumps [pug](https://github.com/pugjs/pug) from 3.0.2 to 3.0.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/pugjs/pug/releases">pug's
releases</a>.</em></p>
<blockquote>
<h2>pug-code-gen@3.0.3</h2>
<h2>Bug Fixes</h2>
<ul>
<li>Validate <code>templateName</code> and <code>globals</code> are
valid JavaScript identifiers to prevent possible remote code execution
if un-trusted user input is passed to the compilation options (<a
href="https://redirect.github.com/pugjs/pug/issues/3438">#3438</a>)</li>
</ul>
<h2>pug@3.0.3</h2>
<h2>Bug Fixes</h2>
<ul>
<li>
<p>Update pug-code-gen with the following fix: (<a
href="https://redirect.github.com/pugjs/pug/issues/3438">#3438</a>)</p>
<p>Validate <code>templateName</code> and <code>globals</code> are valid
JavaScript identifiers to prevent possible remote code execution if
un-trusted user input is passed to the compilation options</p>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="32acfe8f19"><code>32acfe8</code></a>
fix: ensure template names are valid identifiers (<a
href="https://redirect.github.com/pugjs/pug/issues/3438">#3438</a>)</li>
<li><a
href="4767cafea0"><code>4767caf</code></a>
refactor: convert pug-error to TypeScript (<a
href="https://redirect.github.com/pugjs/pug/issues/3355">#3355</a>)</li>
<li><a
href="a724446abb"><code>a724446</code></a>
chore: update character-parser (<a
href="https://redirect.github.com/pugjs/pug/issues/3354">#3354</a>)</li>
<li><a
href="6cca8f76be"><code>6cca8f7</code></a>
docs: fix GitHub format in README (<a
href="https://redirect.github.com/pugjs/pug/issues/3335">#3335</a>)</li>
<li>See full diff in <a
href="https://github.com/pugjs/pug/compare/pug@3.0.2...pug@3.0.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pug&package-manager=npm_and_yarn&previous-version=3.0.2&new-version=3.0.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/tiffany352/rink-rs/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-01 19:48:26 -07:00
Tiffany Bennett
900b07528a
Manually invoked currency refresh (#181)
Adds `currency.fetch_on_startup` to the config, which when set to false
behaves as if the `cache_duration` was infinite. This means rink will
fetch the file once, and then keep reusing that file indefinitely.

Adds a `--fetch-currency` CLI argument, which will make rink download
the latest version of the currency data and then exit. This can be put
into a cron job and used together with the config option so that rink
will never block on a web request at startup, without giving up currency
units. Requires manual setup though.
2024-06-01 19:07:35 -07:00
Tiffany Bennett
6e674f07f8 fix broken make install 2024-06-01 17:09:42 -07:00
Tiffany Bennett
9d5cb59bbc
Fix the irc bot (#169)
This has been broken for many years. I didn't have much motivation to
fix it because I wasn't actively using irc anymore.

Most of the libraries in the time in between have changed. I have to
rewrite the bot from scratch.

Unfortunately, the async ecosystem in rust is split down the middle with
tokio vs async-std. `irc` uses tokio, `rink-sandbox` uses async-std, so
they aren't compatible. I don't have the motivation to fix this yet, so
for now the IRC bot has no sandboxing support.
2024-05-27 19:04:54 -07:00
Tiffany Bennett
b3df5b8ae4 Add buttload (#178) 2024-05-27 17:58:06 -07:00
Tiffany Bennett
a13b9fcbaf
Markup for doc strings (#177)
Makes Rink parse out the links and date strings when using the token
format machinery. This is a new syntax in the definitions file with
`<abc>` for links and `#abc#` for dates.

Replaced ansi_term with nu-ansi-term because the former was
unmaintained. The latter comes with the ability to set hyperlinks.
2024-05-27 16:51:42 -07:00
Tiffany Bennett
fb1b58a7c1
Add more number output formats (#180)
Adds `to frac` and `to sci` to explicitly force the use of these
representations. Also adds `to eng` which behaves similar to the default
behavior, except rounds to every third power of 10 instead of every
power of 10. I might make the output format configurable and set the
engineering one as the default in a future version.

While working on this I found a bug in the current version of rink.
`surveyfoot to digits` is incorrect by 3 orders of magnitude. I fixed
that in this PR.
2024-05-27 16:48:00 -07:00
Tiffany Bennett
c0aadc4237 Remove unnecessary -t from Makefile
Based on the patch made to the Makefile done for OpenBSD:
<https://marc.info/?l=openbsd-ports&m=171628246015597&w=2>
2024-05-21 20:13:29 -07:00
Tiffany Bennett
dce8c4ddd0
Fix url parsing on web (#176) 2024-05-11 17:16:32 -07:00
Tiffany Bennett
4123b75031
Fix code coverage (#175) 2024-05-10 21:28:19 -07:00
Tiffany Bennett
6e0b42e658
Output bytes by default (#174)
This has been annoying me for years. Make rink output bytes by default,
even though bits are the base unit of information.

Only applies when you specifically ask for bytes by itself. Falls back
to bits if you use some other unit like `bit s^-1`, `bit^2`, `bit^-1`,
etc.

```
> 500 floppy
737.28 megabyte (information)
```

Improves #56 but doesn't really fix it.
2024-05-10 20:56:57 -07:00
Tiffany Bennett
ecba7c5707
Add phoot and floppydisk units (#173)
While researching this I wanted to see if I could add CD and DVD sizes
as well, but it turns out the size of these can depend on how they were
formatted. CDs can vary anywhere from 600-800MB depending on how much
you want to risk read errors.
2024-05-10 20:15:44 -07:00
Tiffany Bennett
8cf08d2b3c
Custom definitions files (#172)
Implements #79.

The CLI will now load more than the first `definitions.units` file it
finds. It will stick them together and load them as one big
`definitions.units` file. This lets you easily add custom definitions by
adding them to `~/.config/rink/definitions.units`. The format for it is
already documented in the manpage.
2024-05-10 18:37:38 -07:00
Tiffany Bennett
07dc170897
Website bugfixes (#171) 2024-05-04 15:23:30 -07:00
Tiffany Bennett
2bb9122767
Split the make install rule (#170) 2024-05-01 18:59:39 -07:00
Tiffany Bennett
980fa25ba0 Don't pass --release when running make test 2024-05-01 18:32:36 -07:00
Tiffany Bennett
62b85f2654
Add a .desktop file (#168)
It's a small thing, but being able to open rink from the app launcher
thing is nice.
2024-04-28 20:51:48 -07:00
Tiffany Bennett
90eff58b8e
Update clap to latest version (#167) 2024-04-27 20:19:00 -07:00
Tiffany Bennett
e34e126258 v0.8.0 2024-04-20 19:35:30 -07:00
Tiffany Bennett
c5ec3ce3e1 update readme 2024-04-20 18:54:16 -07:00
Tiffany Bennett
a0ddd52bdb
Rink-web 3 (#165)
Kind of silly that I'm already on the third iteration of the website.
But the previous one was a bit over-engineered and hard to maintain. I
actually can't even get it to compile anymore, it errors out while
trying to build the wasm binary.

So it was either migrate from sapper (which is deprecated and broken) to
svelte-kit (the successor to sapper), or to simplify. I simplified.

The new tech jenga tower is:
- Soupault for building the website
  - AsciiDoctor for the pages
  - cmark-gfm for processing the markdown in the github releases
  - Several plugins and scripts copied from my personal website
- Vite for compiling the javascript
- wasm-pack for building the wasm binary

Rink's website will now be completely static, so operating it is easier.
The javascript and wasm is quarantined to the index page where a rink
repl is active, the other pages are plain html.

The currency fetching is now a totally separate piece of code from the
website. It makes it simpler and requires less code to be loaded during
the regular cron job.

The javascript is way simpler now. It only manipulates the part of the
page that need to be dynamic. It also uses the token format machinery
instead of directly converting rink's output AST to html.

Pros:
- Way lighter, faster page load times.
- Easier to maintain.
- Site contains more information now. An about page, the manual, and a
releases tab with DL links.
- No more URL spam that makes search engines think the site is a content
farm.
- Actually acts as a REPL now so you can run multiple queries, use
`ans`, up/down arrows to re-run previous queries.
- Proper sandboxing - queries that timeout cause the worker to be killed
and restarted.
- Now has a progress indicator on downloading the wasm blob, which is
good on slow connections.

Cons:
- Even more of a custom setup than before.
- It doesn't work offline anymore. At least not until I add a new
service worker, which will be a real pain to debug.
- The interactive parts (the rink REPL) require javascript to work now.
- A lot of the old URLs like `/query/abc` and `/units/meter` are broken.
I think this is fine though. I can add redirects in nginx that point
them to `/?q=abc` and `/?q=meter`.

## Screenshots

### REPL

![image](https://github.com/tiffany352/rink-rs/assets/1254344/7e43fe58-134f-425c-b975-997797fc1af4)

### About page

![image](https://github.com/tiffany352/rink-rs/assets/1254344/d6a34ce5-a357-434c-b7e9-9ddee3884223)
2024-04-20 18:46:50 -07:00
Tiffany Bennett
1fa056dfea update readme 2024-04-13 16:29:18 -07:00
Tiffany Bennett
c433ee6a7c update the manual 2024-04-13 16:04:28 -07:00
Tiffany Bennett
40a7ff2c70 update the help message 2024-04-13 15:45:13 -07:00
Tiffany Bennett
1512265d46
Trig function improvements (#164)
Implements #148.
2024-04-13 14:48:18 -07:00
Tiffany Bennett
92c58488d4
Display recurring digits (#162)
Implements #72.

```
> 1/7
0.[142857]...  (dimensionless)
```

Also changes the behavior of `to digits` so that it will attempt to find
long-period recurring digits and show the entire sequence. The new
default for `to digits` is to show up to 1000 recurring digits.

```
> googol/7 to digits
1428571428571428571428571428571428571428571428571428571428571428571428571428571428571428571428571428.[571428]...  (dimensionless)
> surveyfoot to digits
0.[304800609601219202438404876809753619507239014478028956057912115824231648463296926593853187706375412750825501651003302006604013208026416052832105664211328422656845313690627381254762509525019050038100076200152400, period 210]... millimeter (length)
```
2024-04-13 14:21:56 -07:00
Tiffany Bennett
6ce8d91b97
Dependencies cleanup (#163)
- Set `default-features=false` where applicable
- Use specific num libraries instead of the top-level crate, as some
parts like complex numbers are not used.
- Replace reqwest with curl, which links the system libcurl and libssl
when possible.
- Add `opt-level="z"` and enable LTO for release builds.

All these changes combined, the CLI binary goes from 10.7 megabytes (or
8.7 manually stripped) to 5.4 megabytes.

The wasm binary is unaffected, still around 2.3 megabytes.
2024-03-31 14:34:09 -07:00
Tiffany Bennett
70ad6fb6b4 Don't use gray for unit decompositions (#13)
Despite being an official SI derived unit, gray is only meant to be used
in the context of ionizing radiation. There is no official SI unit for
specific heat capacity.
2024-03-30 12:50:14 -07:00
Tiffany Bennett
311b9928ce
Add new operators (#161)
`<<`, `>>`, `mod`, `and`, `or`, `xor`. Implements #99.
2024-03-29 23:22:26 -07:00
Tiffany Bennett
01be58b5cb
Date range checking (#160)
Dates have no range checking which makes parsing them slightly
unreliable and causes weird error messages like this:

```
> #25:00#
Most likely pattern `hour12:min[:sec] meridiem[ offset]` failed: Expected ` `, got eof
```

Additionally, large numbers cause a panic:
```
> #9999999999#
Panic: The application panicked (crashed).
Message:  called `Result::unwrap()` on an `Err` value: ParseIntError { kind: PosOverflow }
Location: core/src/parsing/datetime.rs:117

Backtrace omitted.
Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
```

This PR adds range checks. I also cleaned up the code a little.
2024-03-29 21:30:21 -07:00
Tiffany Bennett
ba3a17d452 Don't interpret GB as a timezone name (#129)
Fixes "4 bytes -> GB" being an error saying you can't convert to a
timezone.

This timezone can be obtained in better ways, there's no reason it
should be like this.
2024-03-29 19:31:23 -07:00
Tiffany Bennett
349fd86cb5
Update README.md 2024-03-29 19:19:49 -07:00
Tiffany Bennett
f194a37ed1
Update README.md 2024-03-29 19:19:14 -07:00
Tiffany Bennett
bf3b960307
Better packaging (#158)
I want rink to adhere slightly better to conventions on Linux.

- Adds man pages for the CLI and for the config file format, using
asciidoc.
- Updates the bundling functionality. It doesn't make sense to bundle
these files when building a distro package, they should go in
`/usr/share`.
- Adds a makefile with good defaults for distro packages.

The asciidoc files will likely become the new source of truth for rink's
documentation. There is no way to make PRs to github wikis, so this
might be for the best anyway.

Currently rink is packaged on arch, nix, and void linux.
2024-03-29 19:15:53 -07:00
Tiffany Bennett
c33040c746
Run cargo update and fix resulting warnings (#159)
There were compile errors on nightly builds that should be fixed by
this.
2024-03-27 21:28:54 -07:00
Tiffany Bennett
73998b3c47
New SI (#157)
Updating the units database based on Resolution 1 of the 26th CGPM
(2018), aka New SI.

Sources used:

- https://www.bipm.org/en/committees/cg/cgpm/26-2018/resolution-1 - New
SI. Note that the authoritative document is in French.
- https://www.bipm.org/en/cgpm-2022/resolution-3 - Extending SI prefixes
- https://www.bipm.org/en/publications/si-brochure - SI Brochure, 9th
edition
- https://physics.nist.gov/cuu/Constants/index.html - CODATA 2018
- https://syrte.obspm.fr/IAU_resolutions/Res_IAU2012_B2.pdf - 2012 IAU
definition of AU
- https://arxiv.org/abs/1510.06262 - 2015 IAU definition of parsec
- Wikipedia for the info about the IEC standards (the actual standards
are paywalled).

Todo:

- [x] Find remaining 2014 CODATA constants in the file and get them
updated to 2018.
- [x] Find any remaining constants that used to be exact but aren't
anymore.
- [x] Fix parsec definition (not new SI, but might as well)
- [x] Review changes to make sure they are correct
2024-03-23 20:29:24 -07:00
Tiffany Bennett
1f5f636442
Reorganize definitions.units (#156)
## Changes to `definitions.units`

- Added vim folds repurposing the `!category`/`!endcategory` syntax. There's a modeline at the bottom of the file for this.
- To make the vim folds work better, every single unit now has a category. I also moved them around a little bit so that each category collapses to a single line. This makes the file much easier to navigate. Kind of acts as its own table of contents.
- Rearranged some of the categories, and moved things between categories.
- Adjusted several comments, and added an explanation of the file to the top.
- Deleted some legacy GNU Units directives like !utf8 that Rink will never use. Also several of the function/LUTs that are commented out.
- Uncommented some fractions that apparently GNU Units didn't like. Also uncommented `googol`.
- Moved mercury to the periodic table section.
- Moved the 4 newest elements to be alphabetically sorted.
- Added atomic numbers to every element. (I double checked that the numbers are correct, but I might have still gotten some mixed up...)
- Fixed a few typos and trailing whitespace.

![image](https://github.com/tiffany352/rink-rs/assets/1254344/3d3fbc58-1928-4ded-8612-a84778127c65)

## Changes to rink-core

- Now prints an error on unrecognized directives instead of silently ignoring them.
- Ignores categories for non-units. This may be re-added later but it will require refactoring `Context::categories` to respect namespaces.
- Improved some of the error messages from the units DB loader.
2024-03-15 19:08:13 -07:00
Tiffany Bennett
a2bb73c2db Release v0.7.0 2024-01-06 19:58:04 -08:00
Tiffany Bennett
dff5c4c9af
Update live currency fetching (#153)
ECB doesn't include HRK anymore because of it being pinned now, now the message will be correct for older versions of Rink.

Also updated the fallback values since they're 2 years old.
2024-01-06 18:57:29 -08:00
Stipe Kotarac
2b91f2c169
adjust croatian kuna after euro adoption (#152)
Croatia adopted the euro on 2023-01-01, setting a fixed conversion rate of the kuna to euro to 7.53450 kuna per 1 euro. https://www.ecb.europa.eu/euro/changeover/croatia/html/index.en.html

The kuna is still often listed and used as a reference, so not removing it, but instead setting a fixed conversion rate and adding a couple of often used slang names for varied amounts.
2024-01-06 18:29:56 -08:00
Tiffany Bennett
fb3098aa65 cargo fmt 2023-11-22 21:03:10 -08:00
Tiffany Bennett
2c49c5f1aa Fix #151 2023-11-22 20:58:08 -08:00
Tiffany Bennett
f64cb2cb73 update ubyte 2023-11-22 20:21:11 -08:00
dependabot[bot]
4a492c64f3
Bump tokio from 1.17.0 to 1.24.1 (#139)
Bumps [tokio](https://github.com/tokio-rs/tokio) from 1.17.0 to 1.24.1.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.17.0...tokio-1.24.1)

---
updated-dependencies:
- dependency-name: tokio
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-09 12:21:14 -08:00