Skip to content

Commit

Permalink
v2022.5.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
a5huynh committed May 4, 2022
2 parents 036f969 + 185347e commit 257fda0
Show file tree
Hide file tree
Showing 14 changed files with 142 additions and 87 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
releaseName: "Spyglass v__VERSION__"
tagName: v20__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
releaseName: "Spyglass v20__VERSION__"
releaseBody: "See the assets to download this version and install."
releaseDraft: true
prerelease: false
54 changes: 44 additions & 10 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,23 @@ jobs:
runs-on: ubuntu-latest

steps:
# Checkout source code
- uses: actions/checkout@v3
# Setup arch target for sidecar build
- name: Setup arch target
run: echo "target_arch=$(rustc -Vv | grep host | awk '{print $2 " "}')" >> $GITHUB_ENV
- name: Setup wasm target
run: rustup target add wasm32-unknown-unknown
# Setup rust toolchain
- name: Setup rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
components: clippy
# Should help bring down build times
- uses: Swatinem/rust-cache@v1
with:
key: "1" # increment this to bust the cache if needed
- name: Install tauri system deps
run: |
sudo apt-get update -y
Expand All @@ -31,15 +43,37 @@ jobs:
librsvg2-dev
cargo install tauri-cli --locked --version ^1.0.0-rc.8
cargo install --locked trunk
- name: Build backend
run: cargo build -p spyglass --verbose
- name: Create sidecar
- name: Build sidecar
uses: actions-rs/cargo@v1
with:
command: build
args: -p spyglass

- name: Move sidecar into place
run: |
mkdir -p crates/tauri/binaries
cp target/debug/spyglass crates/tauri/binaries/spyglass-server-${{ env.target_arch }}
- name: Build everything
run: |
cargo tauri build
cargo build --verbose
# Build front-end client
- name: Build client
uses: actions-rs/cargo@v1
with:
command: tauri
args: build
# Build backend crates
- name: Build backend
uses: actions-rs/cargo@v1
with:
command: build
# Run tests
- name: Run tests
run: cargo test --verbose
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose
# Run clippy
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ build-client:
build-release:
# Build backend binaries
cargo build -p spyglass --release
mkdir -p crates/tauri/binaries/spyglss-server-$(TARGET_ARCH)
mkdir -p crates/tauri/binaries
cp target/release/spyglass crates/tauri/binaries/spyglass-server-$(TARGET_ARCH)
# Build client
cargo tauri build
Expand All @@ -37,4 +37,4 @@ setup-dev:
cargo install --locked trunk

run-client-dev:
cargo tauri dev
cargo tauri dev
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,17 @@ curated set of websites with high quality recipes.
"#),
domains: [

# Major sites that often have really good recipes
// Major sites that often have really good recipes
"www.seriouseats.com",
"cooking.nytimes.com",
...

# Specific cuisines/sites that I've found randomly w/ high-quality recipes
// Specific cuisines/sites that I've found randomly w/ high-quality recipes
"www.hungryhuy.com",
"www.vickypham.com",
],

# Not yet supported but ideally more ways to filter URLs within a domain
// Not yet supported but ideally more ways to filter URLs within a domain
urls: [
"www.reddit.com/r/recipes/*",
]
Expand All @@ -108,7 +108,7 @@ programming language and not the Rust game / The Rust Belt / oxidation / etc.
name: "rustlang",
description: Some("Rustlang targeted websites"),
domains: [
# Support for wildcards in domain names
// Support for wildcards in domain names
"*.rust-lang.org",
"docs.rs",
"rustconf.com",
Expand All @@ -117,8 +117,8 @@ programming language and not the Rust game / The Rust Belt / oxidation / etc.
...
],

# Again not yet supported but an example of indexing specific communities that
# are relevant to the topic
// Again not yet supported but an example of indexing specific communities that
// are relevant to the topic
urls: [
"www.reddit.com/r/rust",
"www.reddit.com/r/rust_gamedev",
Expand All @@ -135,22 +135,22 @@ file found in their directory on startup, a default one will be created.

``` rust
(
# The max number of pages to index per domain
// The max number of pages to index per domain
domain_crawl_limit: Finite(1000),
# The max number of crawlers per domain
// The max number of crawlers per domain
inflight_domain_limit: Finite(2),
# The max number of crawlers in total
// The max number of crawlers in total
inflight_crawl_limit: Finite(10),
# Not used... yet!
// Not used... yet!
run_wizard: false,
# Not used... yet!
// Not used... yet!
allow_list: [],
# Domains to completely ignore.
// Domains to completely ignore.
block_list: [
"web.archive.org",
"w3schools.com"
],
# Shortcut to launch the search bar
// Shortcut to launch the search bar
shortcut: "CmdOrCtrl+Shift+/",
)
```
Expand All @@ -171,5 +171,8 @@ Supported Modifiers:
Examples:

* "CmdOrCtrl+/" => Launches the app w/ `Cmd` or `Ctrl` + `/`
* "CmdOrCtrl+Shift+/" => Launches the app w/ `Cmd` or `Ctrl` + `/`
* "Shift+4+2" => Launches the app w/ `Shift` + `4` + `2`
* "CmdOrCtrl+Shift+/" => Launches the app w/ `Cmd` or `Ctrl` + `Shift` + `/`
* "Shift+4" => Launches the app w/ `Shift` + `4`

NOTE: Shortcuts are allowed to have any number of modifiers but only a *single* key.
For example, `Shift+4` will work but not `Shift+4+2`
1 change: 0 additions & 1 deletion crates/client/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pub const DEBOUNCE_TIME_MS: f64 = (1 * 1000) as f64;
pub const LENS_SEARCH_PREFIX: &str = "/";
pub const MIN_CHARS: usize = 2;
9 changes: 1 addition & 8 deletions crates/client/src/events.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use js_sys::Date;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use wasm_bindgen_futures::spawn_local;
Expand Down Expand Up @@ -71,16 +70,12 @@ pub fn handle_global_key_down(

pub fn handle_query_change(
query: &str,
query_debounce: UseStateHandle<f64>,
node_ref: UseStateHandle<NodeRef>,
lens: UseStateHandle<Vec<String>>,
search_results: UseStateHandle<Vec<ResultListData>>,
selected_idx: UseStateHandle<usize>,
) {
// Was the last char typed > 1 sec ago?
let is_debounced = *query_debounce >= constants::DEBOUNCE_TIME_MS;

if is_debounced && query.len() >= constants::MIN_CHARS {
if query.len() >= constants::MIN_CHARS {
let el = node_ref.cast::<Element>().unwrap();
if query.starts_with(constants::LENS_SEARCH_PREFIX) {
// show lens search
Expand All @@ -89,6 +84,4 @@ pub fn handle_query_change(
super::show_doc_results(search_results, &lens, el, selected_idx, query.to_string());
}
}

query_debounce.set(Date::now());
}
5 changes: 0 additions & 5 deletions crates/client/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use gloo::events::EventListener;
use js_sys::Date;
use wasm_bindgen::{prelude::*, JsCast};
use wasm_bindgen_futures::spawn_local;
use web_sys::{window, Element, HtmlElement, HtmlInputElement};
Expand Down Expand Up @@ -46,7 +45,6 @@ pub fn app() -> Html {
let lens = use_state_eq(Vec::new);
// Current query string
let query = use_state_eq(|| "".to_string());
let query_debounce = use_state_eq(Date::now);
// Search results + selected index
let search_results = use_state_eq(Vec::new);
let selected_idx = use_state_eq(|| 0);
Expand Down Expand Up @@ -87,7 +85,6 @@ pub fn app() -> Html {
move |query| {
events::handle_query_change(
query,
query_debounce,
node_ref,
lens,
search_results,
Expand Down Expand Up @@ -142,7 +139,6 @@ pub fn app() -> Html {
.collect::<Html>();

let onkeyup = {
let query = query.clone();
Callback::from(move |e: KeyboardEvent| {
let input: HtmlInputElement = e.target_unchecked_into();
query.set(input.value());
Expand Down Expand Up @@ -172,7 +168,6 @@ pub fn app() -> Html {
type={"text"}
class={"search-box"}
placeholder={"Search"}
value={(*query).clone()}
{onkeyup}
{onkeydown}
spellcheck={"false"}
Expand Down
2 changes: 1 addition & 1 deletion crates/spyglass/src/search/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn build_query(
.map(|token| token.trim())
.collect();

log::info!("lenses: {:?}, terms: {:?}", applied_lens, terms);
log::trace!("lenses: {:?}, terms: {:?}", applied_lens, terms);

let mut lense_queries: QueryVec = Vec::new();
for lens in applied_lens {
Expand Down
1 change: 1 addition & 0 deletions crates/tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
shared = { path = "../shared" }
tauri = { version = "1.0.0-rc.8", features = ["api-all", "ayatana-tray", "devtools", "notification", "system-tray"] }
tokio = "1"
tokio-retry = "0.3"
tracing = "0.1"
tracing-appender = "0.2"
Expand Down
Loading

0 comments on commit 257fda0

Please sign in to comment.