From 810e2a1267b35be9870ac1b533ae22c33f60dc1c Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 21 Sep 2023 19:42:53 -0700 Subject: [PATCH 01/16] Fixed page scrolling --- site/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/site/index.html b/site/index.html index e10b735..78e2766 100644 --- a/site/index.html +++ b/site/index.html @@ -22,7 +22,6 @@ margin: 0; padding: 0; - overflow: hidden; height: 100vh; } From 3ab559b240867e26501fdcf566d6a6c3e5cc5a58 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 21 Sep 2023 19:43:00 -0700 Subject: [PATCH 02/16] Updated TODO --- TODO.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TODO.md b/TODO.md index ef9106d..ac5cc71 100644 --- a/TODO.md +++ b/TODO.md @@ -9,6 +9,8 @@ - cargo publish - Update packages - Build wasm & push changes + - Squash push + - Update AUR package ## Pre-release From 7215afcc7ee70ba028f948d9557c5060f9e082cc Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 21 Sep 2023 19:43:40 -0700 Subject: [PATCH 03/16] Fixed a link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9d7c662..98a5caf 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A high-precision scientific calculator with support for units, derivatives, and Many features are missing, this is still under development. -**Web demo: [here](daisy.betalupi.com)** +**Web demo: [here](https://daisy.betalupi.com)** # 📦 Installation - **Cargo:** `cargo install daisycalc` From a0fe0a938572ab5442119d0b82c5fae15088b669 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 21 Sep 2023 19:49:12 -0700 Subject: [PATCH 04/16] Minor edits --- README.md | 2 +- TODO.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 98a5caf..4f0943f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A high-precision scientific calculator with support for units, derivatives, and Many features are missing, this is still under development. -**Web demo: [here](https://daisy.betalupi.com)** +**Web demo: [here](https://daisy.betalupi.com) (won't work on mobile)** # 📦 Installation - **Cargo:** `cargo install daisycalc` diff --git a/TODO.md b/TODO.md index ac5cc71..41380a6 100644 --- a/TODO.md +++ b/TODO.md @@ -9,7 +9,7 @@ - cargo publish - Update packages - Build wasm & push changes - - Squash push + - Squash merge - Update AUR package From 49b88af2bbfee55ac608b4728e648233605b6bcd Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 21 Sep 2023 19:49:31 -0700 Subject: [PATCH 05/16] Version bump --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9cf2ae1..9911efe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,7 +28,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "daisycalc" -version = "1.1.1" +version = "1.1.2" dependencies = [ "cfg-if", "num", diff --git a/Cargo.toml b/Cargo.toml index ab23e32..04c8119 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "daisycalc" -version = "1.1.1" +version = "1.1.2" edition = "2021" build = "buildscript/main.rs" license = "GPL-3.0-only" From 178708a4acf2b988174c3a64a7453ee9bd95fa57 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 21 Sep 2023 19:52:48 -0700 Subject: [PATCH 06/16] Updated TODO --- TODO.md | 1 - 1 file changed, 1 deletion(-) diff --git a/TODO.md b/TODO.md index 41380a6..9bc12a1 100644 --- a/TODO.md +++ b/TODO.md @@ -9,7 +9,6 @@ - cargo publish - Update packages - Build wasm & push changes - - Squash merge - Update AUR package From a1d190b06e89ad0798bee9fe2aadbe0b86f65ddb Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 21 Sep 2023 19:54:37 -0700 Subject: [PATCH 07/16] Updated TODO --- TODO.md | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO.md b/TODO.md index 9bc12a1..e4a0721 100644 --- a/TODO.md +++ b/TODO.md @@ -6,6 +6,7 @@ - push - merge - git tag -a v1.0.0 -m "Version 1.0.0" on merge commit + - delete branch? - cargo publish - Update packages - Build wasm & push changes From 32463ad6aa309b62cbb145c147a61c619af0e5f3 Mon Sep 17 00:00:00 2001 From: mark Date: Thu, 21 Sep 2023 20:52:35 -0700 Subject: [PATCH 08/16] Updated shell.nix --- shell.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/shell.nix b/shell.nix index dff6d69..98d2bc8 100644 --- a/shell.nix +++ b/shell.nix @@ -1,11 +1,22 @@ +{ nixpkgs ? import { }}: let - pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/f155f0cf4ea43c4e3c8918d2d327d44777b6cad4.tar.gz") {}; + # If you set hash to an empty string, you'll get + # an error with the correct hash. + pinnedPkgs = nixpkgs.fetchFromGitHub { + owner = "NixOS"; + repo = "nixpkgs"; + rev = "4ecab3273592f27479a583fb6d975d4aba3486fe"; + sha256 = "btHN1czJ6rzteeCuE/PNrdssqYD2nIA4w48miQAFloM="; + }; + pkgs = import pinnedPkgs {}; + in pkgs.mkShell { buildInputs = with pkgs; [ cargo rustc rustfmt - m4 + rust-analyzer + wasm-pack ]; } From ef74b67f90c294610749dfa471272eb0c1b66ca1 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 22 Sep 2023 10:08:10 -0700 Subject: [PATCH 09/16] Moved server files to /server --- README.md | 2 +- server/.gitignore | 2 ++ Dockerfile => server/Dockerfile | 0 default => server/default | 0 .../docker-compose.yml | 2 +- {site => server/site}/index.html | 0 server/site/package-lock.json | 17 +++++++++++++++++ {site => server/site}/package.json | 0 {site => server/site}/resources/Fantasque.ttf | Bin {site => server/site}/resources/banner.svg | 0 {site => server/site}/resources/daisy-dark.svg | 0 .../site}/resources/daisy-icon-dark.svg | 0 .../site}/resources/daisy-icon-light.svg | 0 .../site}/resources/daisy-light.svg | 0 .../site}/resources/readme-banner.png | Bin site/.gitignore | 3 --- 16 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 server/.gitignore rename Dockerfile => server/Dockerfile (100%) rename default => server/default (100%) rename docker-compose.yml => server/docker-compose.yml (87%) rename {site => server/site}/index.html (100%) create mode 100644 server/site/package-lock.json rename {site => server/site}/package.json (100%) rename {site => server/site}/resources/Fantasque.ttf (100%) rename {site => server/site}/resources/banner.svg (100%) rename {site => server/site}/resources/daisy-dark.svg (100%) rename {site => server/site}/resources/daisy-icon-dark.svg (100%) rename {site => server/site}/resources/daisy-icon-light.svg (100%) rename {site => server/site}/resources/daisy-light.svg (100%) rename {site => server/site}/resources/readme-banner.png (100%) delete mode 100644 site/.gitignore diff --git a/README.md b/README.md index 4f0943f..0c7f9c6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![](./site/misc/readme-banner.png) +![](./server/site/resources/readme-banner.png) A high-precision scientific calculator with support for units, derivatives, and more. diff --git a/server/.gitignore b/server/.gitignore new file mode 100644 index 0000000..9f62a81 --- /dev/null +++ b/server/.gitignore @@ -0,0 +1,2 @@ +/site/node_modules +/pkg \ No newline at end of file diff --git a/Dockerfile b/server/Dockerfile similarity index 100% rename from Dockerfile rename to server/Dockerfile diff --git a/default b/server/default similarity index 100% rename from default rename to server/default diff --git a/docker-compose.yml b/server/docker-compose.yml similarity index 87% rename from docker-compose.yml rename to server/docker-compose.yml index e52a66d..43ccb04 100644 --- a/docker-compose.yml +++ b/server/docker-compose.yml @@ -7,7 +7,7 @@ networks: services: daisy: - build: ./. + build: ./server container_name: daisy restart: unless-stopped diff --git a/site/index.html b/server/site/index.html similarity index 100% rename from site/index.html rename to server/site/index.html diff --git a/server/site/package-lock.json b/server/site/package-lock.json new file mode 100644 index 0000000..3573a37 --- /dev/null +++ b/server/site/package-lock.json @@ -0,0 +1,17 @@ +{ + "name": "site", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "xterm": "^5.3.0" + } + }, + "node_modules/xterm": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/xterm/-/xterm-5.3.0.tgz", + "integrity": "sha512-8QqjlekLUFTrU6x7xck1MsPzPA571K5zNqWm0M0oroYEWVOptZ0+ubQSkQ3uxIEhcIHRujJy6emDWX4A7qyFzg==" + } + } +} diff --git a/site/package.json b/server/site/package.json similarity index 100% rename from site/package.json rename to server/site/package.json diff --git a/site/resources/Fantasque.ttf b/server/site/resources/Fantasque.ttf similarity index 100% rename from site/resources/Fantasque.ttf rename to server/site/resources/Fantasque.ttf diff --git a/site/resources/banner.svg b/server/site/resources/banner.svg similarity index 100% rename from site/resources/banner.svg rename to server/site/resources/banner.svg diff --git a/site/resources/daisy-dark.svg b/server/site/resources/daisy-dark.svg similarity index 100% rename from site/resources/daisy-dark.svg rename to server/site/resources/daisy-dark.svg diff --git a/site/resources/daisy-icon-dark.svg b/server/site/resources/daisy-icon-dark.svg similarity index 100% rename from site/resources/daisy-icon-dark.svg rename to server/site/resources/daisy-icon-dark.svg diff --git a/site/resources/daisy-icon-light.svg b/server/site/resources/daisy-icon-light.svg similarity index 100% rename from site/resources/daisy-icon-light.svg rename to server/site/resources/daisy-icon-light.svg diff --git a/site/resources/daisy-light.svg b/server/site/resources/daisy-light.svg similarity index 100% rename from site/resources/daisy-light.svg rename to server/site/resources/daisy-light.svg diff --git a/site/resources/readme-banner.png b/server/site/resources/readme-banner.png similarity index 100% rename from site/resources/readme-banner.png rename to server/site/resources/readme-banner.png diff --git a/site/.gitignore b/site/.gitignore deleted file mode 100644 index 6bd0e57..0000000 --- a/site/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/node_modules -/package-lock.json -/pkg \ No newline at end of file From cffb3726cc2d251bc145f8eac073505bf74269d1 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 22 Sep 2023 10:08:28 -0700 Subject: [PATCH 10/16] Character checks, minor cleanup --- src/lib.rs | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ceed6cc..6917f51 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -68,15 +68,12 @@ cfg_if::cfg_if! { return format!("\r\n{}", daisy_prompt(state)); } - if in_str.trim() == "quit" { - return "[quit]".to_string(); - } else { - let r = crate::do_string( unsafe { &mut (*state).context }, &in_str); - match r { - Ok(t) | Err(t) => { - out += t; - } + let r = crate::do_string( unsafe { &mut (*state).context }, &in_str); + + match r { + Ok(t) | Err(t) => { + out += t; } } }, @@ -91,7 +88,20 @@ cfg_if::cfg_if! { //'\x04' | '\x03' //=> { break 'outer; }, - _ => { unsafe { (*state).promptbuffer.add_char(s.chars().next().unwrap()); } }, + // Only process sane characters + + _ => { + let c = s.chars().next().unwrap(); + match c { + 'a'..='z' | 'A'..='Z' | '0'..='9' + |'!'|'@'|'#'|'$'|'%'|'^'|'&'|'*'|'('|')' + |'?'|'~'|','|'.'|'['|']' + |'<'|'>'|'/'|'_'|'-'|':'|'|'|'='|'+'|';' + => { unsafe { (*state).promptbuffer.add_char(c); } }, + + _ => {} + } + }, }; let t = unsafe { (*state).promptbuffer.write_prompt(&mut (*state).context) }; From 42fdcd5853cfff042afc1b6088624d86f4a03f96 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 22 Sep 2023 10:26:37 -0700 Subject: [PATCH 11/16] Minor cleanup --- server/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/docker-compose.yml b/server/docker-compose.yml index 43ccb04..196f830 100644 --- a/server/docker-compose.yml +++ b/server/docker-compose.yml @@ -7,7 +7,7 @@ networks: services: daisy: - build: ./server + build: . container_name: daisy restart: unless-stopped From 96a34dc05d047a7c00c7b9300665c66a8cd6c7b5 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 22 Sep 2023 10:26:46 -0700 Subject: [PATCH 12/16] Added makefile --- Makefile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..60e598b --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +release: + cargo build --release + +test: + cargo test + +run: + cargo run + +wasm: + wasm-pack build --release --target web --out-dir server/pkg + +publish: + cargo test + cargo publish + +docker: + docker build ./server -t git.betalupi.com/mark/daisy From c2d3e613d495d02918b82589b86c02cca5b0fb83 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 22 Sep 2023 10:41:01 -0700 Subject: [PATCH 13/16] Added mobile warning --- server/site/index.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/site/index.html b/server/site/index.html index 78e2766..9053391 100644 --- a/server/site/index.html +++ b/server/site/index.html @@ -100,6 +100,11 @@ AUR + +