Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI support #3

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on:
release:
types: [created]

jobs:
release:
name: Release - ${{ matrix.platform.os-name }}
strategy:
matrix:
platform:
- os-name: Linux-x86_64
runs-on: ubuntu-20.04
target: x86_64-unknown-linux-musl

- os-name: Linux-aarch64
runs-on: ubuntu-20.04
target: aarch64-unknown-linux-musl

- os-name: Windows-x86_64
runs-on: windows-latest
target: x86_64-pc-windows-msvc

- os-name: macOS-x86_64
runs-on: macOS-latest
target: x86_64-apple-darwin

runs-on: ${{ matrix.platform.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build binary
uses: houseabsolute/actions-rust-cross@v1
with:
target: ${{ matrix.platform.target }}
args: "--release"
strip: true
- name: Publish artifacts and release
uses: houseabsolute/actions-rust-release@v0
with:
executable-name: mdict-rs
target: ${{ matrix.platform.target }}
extra-files: "resources"
changes-file:
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ Cargo.lock
*.mdx.db
mdx/

/resources/dict
24 changes: 15 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,34 @@ version = "0.1.0"
authors = ["zhimoe"]
edition = "2021"


[dependencies]
# error handling
anyhow = "1"
thiserror = "2"

pretty_env_logger = "0.5.0"
log = "0.4"
serde_derive = "1.0"
pretty_env_logger = "0.5.0"
serde = "1"
serde_derive = "1.0"

actix-web = "4"
actix-files = "0.6"
actix-web = "4"

nom = "8"
encoding = "0.2"
nom = "8"

adler32 = "1"
regex = "1.5"
rusqlite = { version = "0.33", features = ["bundled"] }
clap = { version = "4.5.29", features = ["derive"] }
flate2 = { version = "1.0", features = ["zlib"], default-features = false }
rand = "0.8"
minilzo-rs = "0.6.0"
ripemd = "0.1.3"
once_cell = "1.19.0"
r2d2 = "0.8.10"
r2d2_sqlite = "0.26.0"
rand = "0.8"
regex = "1.5"
ripemd = "0.1.3"
rusqlite = { version = "0.33", features = ["bundled"] }

[profile.release]
opt-level = "s"
lto = true
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@
a simple web dictionary write in rust, base on mdx format dictionary file.
it's at an early stage of development, now only support mdx version 2.0 with encrypted=2 or 0

## usage
## Usage

1. put your mdx file in `resources/mdx/en` folder ando config `src/config/mod.rs`
2. if your mdx file has separate css file, put it in `resources/static/` folder
3. run
1. Copy your dictionary file (.db or .mdx) to the resources/dict directory. To specify a custom location, use the -d flag when launching the application.
> Tip: After database generation completes, you can safely remove the original .mdx file. For deployment preparation, use the -g flag to generate the database file locally first.
2. If your MDX file has a corresponding CSS stylesheet, place it in the same dictionary folder.
3. Launch the application.

```bash
cargo run --bin mdict-rs
./mdict-rs
# now open your chrome, and search
# http://localhost:8181
```
```

## screenshot
## Screenshot

![screenshot](screenshot.jpg)
![screenshot](screenshot.png)

## 参考

Expand Down
12 changes: 12 additions & 0 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"markdown": {
},
"toml": {
},
"excludes": [],
"plugins": [
"https://plugins.dprint.dev/markdown-0.17.8.wasm",
"https://plugins.dprint.dev/toml-0.6.4.wasm",
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.0.wasm"
]
}
Loading