Commit graph

37 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
a2bb73c2db Release v0.7.0 2024-01-06 19:58:04 -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
Tiffany Bennett
6dce181bc1 Release v0.6.3 2022-03-24 19:35:06 -07:00
Tiffany Bennett
85c7ea921c Update rustyline to v9 2022-03-24 18:35:03 -07:00
Tiffany Bennett
ebf7bca80e Update color-eyre to v0.6 2022-03-24 18:34:00 -07:00
Tiffany Bennett
5be14432af Update dirs to v4 2022-03-24 18:32:16 -07:00
Tiffany Bennett
c222af5f4a Update to clap v3 2022-03-24 18:29:49 -07:00
Tiffany Bennett
4689cc7a56 Run cargo update (Fixes #121) 2022-03-24 18:23:05 -07:00
Tiffany Bennett
6e3fecff57 Version 0.6.2 2021-10-31 15:10:02 -07:00
Adrian
474c407d15
Provide access to result of previous calculation (#107) 2021-08-20 20:44:37 -07:00
Tiffany Bennett
0f4ebf9451
Sandboxing (#100) 2021-06-05 18:18:00 -07:00
Tiffany Bennett
8d73153565 Bump CLI to 0.6.1 2021-04-25 14:24:36 -07:00
Tiffany Bennett
af49f5d8b1 Release v0.6.0 2021-04-05 17:31:39 -07:00
Tiffany Bennett
709b5d01b4
Output highlighting (#90)
Adds a token tree based representation for Rink's output, allowing it to be colored. Adds support for this to Rink CLI to get improved appearance.
2021-04-05 16:04:46 -07:00
Tiffany Bennett
c453dfdeb9
Update dependencies (#89) 2021-04-01 16:13:17 -07:00
Tiffany Bennett
622dd31901
CLI improvements (#86) 2021-02-14 20:25:27 -08:00
Tiffany Bennett
b1fad6be3c
Use unified currency API endpoint (#76) 2020-09-20 20:45:22 -07:00
Tiffany Bennett
dbe6a45a0d Rink 0.5.1 2020-08-29 21:57:47 -07:00
Tiffany Bennett
bf1a66ca84
Rink Web 2 (#62)
* Start over with the web interface

* Add initial stuff

* Extract file+network IO out of rink-core

* Fix cargo warning

* Add tests for rink-web

* Add Serialize to AST types

* Refactor AST

* Split up ast module

* BinOp -> BinOpExpr

* Split out UnaryOpExpr

* Remove Deserialize bound from AST

* Clean up Serialize impl for Numeric

* Convert Expr::Const to struct variant

* Make datetime handling deterministic

* Changes to js API

* Rename rink-web to rink-js

* Add initial npm project

* Add lit-element

* Parse textbox inputs

* Make Expr::Error a variant struct

* Convert Expr::Unit to struct variant

* Don't cache when running npm start

* Convert Expr::Mul to struct variant

* Convert Expr::Date to struct variant

* Convert Expr::Quote to struct variant

* Pretty print json

* Fix warnings

* Switch to svelte

* Remove web components polyfill

* Switch to sapper

* Only load wasm once

* Result component

* Update chrono

* `Utc::now` panics on wasm builds

* Hook up eval

* Disable humanize since it panics in wasm

* SSR test page

* Factor out wasm code into new file

* Make json output better

* Improve json output

* Better json for QueryError

* Add TS definitions for QueryReply

* Render some reply types

* Add proper font

* Add PWA manifest

* Add basic favicon

* Initial styling pass

* Include AST in replies

* Expr component

* Make Numeric json repr more useful

* Indicate approximate values

* Remove duplicate information in definitions

* Split up Result into smaller components

* Search reply

* Add UnitsForReply

* Add UnitListReply

* Add SubstanceReply

* Show dates

* Add DurationReply

* Hook up basic routing

* UI polishing

* Add links to unit pages

* Quantity links

* Split ExprNode and fix whitespace issues

* Fix whitespace issues in NumberParts

* Fix Binop component

* Precedence fixes

* Fix imports

* NumberParts.svelte -> Number.svelte

* Remove App + debug prints

* Fix whitespace in parentheses

* Allow division slash for fractions

* Add home button

* Add aria info

* Improve units for page

* Add links to errors

* Remove rink-irc from workspace

So that cargo test --workspace will work.

* Run all workspace tests in CI

* Remove legacy argument
2020-08-06 16:25:12 -07:00
Tiffany Bennett
a6246ab3c4
Revamp CLI (#59)
* Refactor: Change Dim to struct with named fields

* Move files into `core`, leaving `rink` as the CLI

* Split out completer into separate module

* Clean up cargo files

* Move repl to separate file

* Use clap for rink CLI

* More ways to exit the CLI

* Serde doesn't require nightly for derive anymore

* Hopefully better caching behavior for requests
2020-07-18 02:11:41 -07:00
Tiffany Bennett
4bdb902281 Replace gmp with num 2020-07-17 23:26:38 -07:00
Lukas Werling
7273ff2ace Update linefeed to 0.6 2020-05-27 18:07:19 +02:00
Alex Alemi
1195f7832e try! -> ? everywhere 2020-04-22 21:56:38 -04:00
Benjamin Hipple
9ec790dcec Include Cargo.lock in src
Since this is producing a binary that users and distributions want to install,
we should include a Cargo.lock for a deterministic build.

https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
https://reproducible-builds.org/
2020-02-16 01:17:03 -05:00
Tiffany Bennett
f5f784a5b5 Don't track Cargo.lock in libraries 2016-08-03 10:39:51 -04:00
Tiffany Bennett
75f0c84037 Rename from units-rs to rink 2016-08-03 10:39:08 -04:00
Tiffany Bennett
0b728865ec Initial commit 2016-08-02 15:33:19 -04:00