Skip to content

Commit

Permalink
v2022.6.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
a5huynh committed Jun 25, 2022
2 parents 8a8f325 + 8778900 commit 2f74405
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 34 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
⚠️ Spyglass is very much in its early stages, but it’s in a place where it's functional and can be used to replace basic searches. ⚠️

Download now:
[Mac](https://github.com/a5huynh/spyglass/releases/download/v2022.6.2/Spyglass_22.6.2_x64.dmg)
| [Windows](https://github.com/a5huynh/spyglass/releases/download/v2022.6.2/Spyglass_22.6.2_x64_en-US.msi)
| [Linux (AppImage)](https://github.com/a5huynh/spyglass/releases/download/v2022.6.2/spyglass_22.6.2_amd64.AppImage)
[Mac](https://github.com/a5huynh/spyglass/releases/download/v2022.6.3/Spyglass_22.6.3_x64.dmg)
| [Windows](https://github.com/a5huynh/spyglass/releases/download/v2022.6.3/Spyglass_22.6.3_x64_en-US.msi)
| [Linux (AppImage)](https://github.com/a5huynh/spyglass/releases/download/v2022.6.3/spyglass_22.6.3_amd64.AppImage)


Looking for lenses? Check out our [community contributions](https://github.com/spyglass-search/lens-box)!
Expand All @@ -27,7 +27,7 @@ Looking for lenses? Check out our [community contributions](https://github.com/s
* [Example: Narrowing down by a specific topic](#curated-recipe-searching)
* [Lens Directory](#lens-directory)
* [Settings](#settings)
* [Updating the shorcut](#updating-the-shortcut)
* [Updating the shortcut](#updating-the-shortcut)

---

Expand Down
20 changes: 10 additions & 10 deletions VERSION.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"version": "22.6.2",
"version": "22.6.3",
"notes": "See full release notes here: https://github.com/a5huynh/spyglass/releases/tag/v2022.6.2",
"pub_date": "2022-06-22T04:23:23Z",
"pub_date": "2022-06-22T17:44:53Z",
"platforms": {
"darwin-x86_64": {
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSRk9WYXdDUXphYnQycDd1bUdxRmxSZG5Obml1SU4zWi9KY29TLzdzUUdRaWVGWk15VHZHdGtrRWNXSFdSVERneVV3azFINmRPSGxYYmMwK2FiMkxxbzhQSlFFQm85d0FFPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNjU1ODcwNTkwCWZpbGU6L1VzZXJzL3J1bm5lci93b3JrL3NweWdsYXNzL3NweWdsYXNzL3RhcmdldC9yZWxlYXNlL2J1bmRsZS9tYWNvcy9TcHlnbGFzcy5hcHAudGFyLmd6CmpQR1owYUUyRm81ZTRIazRwcU5iQ3Jsdi84SzMvNlhyckxlUVJ0cVJ3SzhoSGw3aFdsMkllTkFNeUp5VEYwZ2MzeGhsb01hWStPMkdzMUk3VEhhakFRPT0K",
"url": "https://github.com/a5huynh/spyglass/releases/download/v2022.6.2/Spyglass.app.tar.gz"
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSRk9WYXdDUXphYmtjTUtkRFBReEJGNVNHcjNRbkR6WGhrbzR2M2NnRDd4c1VWNDdETGZ6TWhLaGlEcTMwZE8zdmpxL3JOa0ZsMjQxemR6YVJCK1RQL3YvbnJLRkp3MFF3PQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNjU1OTE4ODE1CWZpbGU6L1VzZXJzL3J1bm5lci93b3JrL3NweWdsYXNzL3NweWdsYXNzL3RhcmdldC9yZWxlYXNlL2J1bmRsZS9tYWNvcy9TcHlnbGFzcy5hcHAudGFyLmd6CmRaTjRsTEcyOERpcS9mUi9yLzF5T0s0TDhVYmRnN1hqWCtkbE9PckxTb2txOXVVaVlQZGo4c2Z6Vmdod2pvVUpwMUs5c2UwZGtlSVh0RElKMzV6aUFRPT0K",
"url": "https://github.com/a5huynh/spyglass/releases/download/v2022.6.3/Spyglass.app.tar.gz"
},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PT0K",
"url": "https://github.com/a5huynh/spyglass/releases/download/v2022.6.3/Spyglass.app.tar.gz"
},
"linux-x86_64": {
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSRk9WYXdDUXphYnFvTEZQNlQ4dHgzT0g2dWMwSmtKMUFMaGVjWVAxZ2dFSC8xUmJhZ3BLQU5xQkhLY1I5c214My96czBmMWlVNHdBM2dLQXlkcHRZemxkSXVLbWdLU3dzPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNjU1ODcwMzYzCWZpbGU6L2hvbWUvcnVubmVyL3dvcmsvc3B5Z2xhc3Mvc3B5Z2xhc3MvdGFyZ2V0L3JlbGVhc2UvYnVuZGxlL2FwcGltYWdlL3NweWdsYXNzXzIyLjYuMl9hbWQ2NC5BcHBJbWFnZS50YXIuZ3oKaXlsZG81My8yd1ZRejE0NzBBdlh6dHZhdG1tQWk0Skw1SHJPaG5tRW9yL1F2YWNLYS90Z25YWW1FV1djSmVZVzZ5OWxuaWdrMnk0ZkdZeElSNFFWQ3c9PQo=",
"url": "https://github.com/a5huynh/spyglass/releases/download/v2022.6.2/spyglass_22.6.2_amd64.AppImage.tar.gz"
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSRk9WYXdDUXphYnUzL2tXSjY3dFpvYlgybzhIWWhKanZsQ3YwWU5MeVRRQmMvWnRCUnhucWVSZU8xT0F0eGFHR1FhbVlHNDhIbzNjQitRekxxTDRqTVMwTStiUEdVV1FZPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNjU1OTE4MzU0CWZpbGU6L2hvbWUvcnVubmVyL3dvcmsvc3B5Z2xhc3Mvc3B5Z2xhc3MvdGFyZ2V0L3JlbGVhc2UvYnVuZGxlL2FwcGltYWdlL3NweWdsYXNzXzIyLjYuM19hbWQ2NC5BcHBJbWFnZS50YXIuZ3oKNHF6TlB5ZVVSdmhYZmR6K3N3a1Erc3VqUW15b0FweTkwbDBlc2VOeVhpQ1EzSGVpOHNScGM5YjY2dHFyL1k3U2VqUUFqbXdmcEx1dWsrQWhZdHBqQmc9PQo=",
"url": "https://github.com/a5huynh/spyglass/releases/download/v2022.6.3/spyglass_22.6.3_amd64.AppImage.tar.gz"
},
"windows-x86_64": {
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSRk9WYXdDUXphYmkyQVUyL0VCOUl2NGRhcGJaUGhPSEVuMDJnVFBkdXhXSHl5QTVwOUR4MDFhVWNXM2tOZjVkQ3Z5ZEY3eTZoS1ZyTEFCa2hOd1FFLzBwdXpNVStGRFFnPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNjU1ODcwNzQwCWZpbGU6RDpcYVxzcHlnbGFzc1xzcHlnbGFzc1x0YXJnZXRccmVsZWFzZVxidW5kbGUvbXNpL1NweWdsYXNzXzIyLjYuMl94NjRfZW4tVVMubXNpLnppcApjRWpkWlFrL1RmMDVhV1pYOXE2R1dvcjlrRHRUTWlzL2FOTHBmdjErdzNMQjJEZFpsejlCTURkeEN4cmlvWkhvYlhGNmpMZW1PUzlLZG52UnBlUkVBQT09Cg==",
"url": "https://github.com/a5huynh/spyglass/releases/download/v2022.6.2/Spyglass_22.6.2_x64_en-US.msi.zip"
"signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVSRk9WYXdDUXphYm9DL1hOVEgzZ0ZkNS9PMExHUmdzREJUbE5VcU83YndrcjU5bjFxSmFtalhZeUZEZVJNUlVlT01HWC9KbnZVcFhKcXhqS0lKbkx1YWVNVFhVYXUyblE0PQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNjU1OTE5NDk1CWZpbGU6RDpcYVxzcHlnbGFzc1xzcHlnbGFzc1x0YXJnZXRccmVsZWFzZVxidW5kbGUvbXNpL1NweWdsYXNzXzIyLjYuM194NjRfZW4tVVMubXNpLnppcApMRGt6cjZuZU9VYldNeUsrMVpPdEpSNmJpTHBUVTA5ZkxLVnQ5aDJrdEpFVldmOG5YcC91YTJaV25SeXJrWXJESFpkSHI0RXoxUlVCdXY5cnBaNExCZz09Cg==",
"url": "https://github.com/a5huynh/spyglass/releases/download/v2022.6.3/Spyglass_22.6.3_x64_en-US.msi.zip"
}
}
}
26 changes: 15 additions & 11 deletions crates/client/public/glue.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if (window.__TAURI__) {
}

export async function escape() {
return await invoke("escape");
return await invoke('escape');
}

export async function onClearSearch(callback) {
Expand All @@ -26,41 +26,45 @@ export async function on_refresh_lens_manager(callback) {
}

export async function crawlStats() {
return await invoke("crawl_stats");
return await invoke('crawl_stats');
}

export async function deleteDoc(id) {
return await invoke("delete_doc", { id });
return await invoke('delete_doc', { id });
}

export async function install_lens(downloadUrl) {
return await invoke("install_lens", { downloadUrl })
return await invoke('install_lens', { downloadUrl })
}

export async function listInstalledLenses() {
return await invoke("list_installed_lenses");
return await invoke('list_installed_lenses');
}

export async function listInstallableLenses() {
return await invoke("list_installable_lenses");
return await invoke('list_installable_lenses');
}

export async function network_change(isOffline) {
return await invoke('network_change', { isOffline });
}

export async function searchDocs(lenses, query) {
return await invoke("search_docs", { lenses, query });
return await invoke('search_docs', { lenses, query });
}

export async function searchLenses(query) {
return await invoke("search_lenses", { query });
return await invoke('search_lenses', { query });
}

export async function openResult(url) {
return await invoke("open_result", { url });
return await invoke('open_result', { url });
}

export async function openLensFolder() {
return await invoke("open_lens_folder");
return await invoke('open_lens_folder');
}

export async function resizeWindow(height) {
return await invoke("resize_window", { height });
return await invoke('resize_window', { height });
}
29 changes: 29 additions & 0 deletions crates/client/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use gloo::events::EventListener;
use wasm_bindgen::prelude::*;
use wasm_bindgen_futures::spawn_local;
use yew::prelude::*;
use yew_router::prelude::*;

Expand Down Expand Up @@ -55,6 +57,9 @@ extern "C" {

#[wasm_bindgen(js_name = "crawlStats", catch)]
pub async fn crawl_stats() -> Result<JsValue, JsValue>;

#[wasm_bindgen]
pub async fn network_change(is_offline: bool);
}

#[derive(Clone, Routable, PartialEq)]
Expand All @@ -74,6 +79,30 @@ fn main() {

#[function_component(App)]
pub fn app() -> Html {
// Global events we're interested in

// Detect loss of internet access
use_effect(move || {
let window = gloo::utils::window();

let offline_listener = EventListener::new(&window, "offline", move |_| {
spawn_local(async move {
network_change(true).await;
});
});

let online_listener = EventListener::new(&window, "online", move |_| {
spawn_local(async move {
network_change(false).await;
});
});

|| {
drop(offline_listener);
drop(online_listener);
}
});

html! {
<BrowserRouter>
<Switch<Route> render={Switch::render(switch)} />
Expand Down
2 changes: 1 addition & 1 deletion crates/entities/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub async fn create_connection(
// See https://www.sea-ql.org/SeaORM/docs/install-and-config/connection
// for more connection options
let mut opt = ConnectOptions::new(db_uri);
opt.max_connections(5).sqlx_logging(false);
opt.max_connections(1).sqlx_logging(false);

Ok(Database::connect(opt).await?)
}
Expand Down
22 changes: 15 additions & 7 deletions crates/spyglass/src/crawler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@ impl Crawler {
// Fetch & store page data.
let res = self.client.get(&url).await;
if res.is_err() {
// Log out reason for failure.
log::warn!("Unable to fetch <{}> due to {}", &url, res.unwrap_err());
// Unable to connect to host
return CrawlResult {
// Service unavilable
status: 503_u16,
// TODO: Have our own internal error codes we can refer too later on
status: 600_u16,
url: url.to_string(),
..Default::default()
};
Expand All @@ -152,10 +154,11 @@ impl Crawler {
let res = res.unwrap();
let status = res.status().as_u16();
if status == StatusCode::OK {
let raw_body = res.text().await.unwrap();
let mut scrape_result = self.scrape_page(&url, &raw_body).await;
scrape_result.status = status;
return scrape_result;
if let Ok(raw_body) = res.text().await {
let mut scrape_result = self.scrape_page(&url, &raw_body).await;
scrape_result.status = status;
return scrape_result;
}
}

CrawlResult {
Expand Down Expand Up @@ -238,7 +241,12 @@ impl Crawler {

// Crawl & save the data
let mut result = self.crawl(&url).await;
log::info!("fetched {} {:?}", result.status, result.url);
if result.is_bad_request() {
log::warn!("issue fetching {} {:?}", result.status, result.url);
} else {
log::trace!("fetched {} {:?}", result.status, result.url);
}

// Check to see if a canonical URL was found, if not use the original
// bootstrapped URL
if crawl.crawl_type == crawl_queue::CrawlType::Bootstrap {
Expand Down
38 changes: 38 additions & 0 deletions crates/tauri/src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,41 @@ pub async fn install_lens<'r>(

Ok(())
}

#[tauri::command]
pub async fn network_change(
_: tauri::Window,
rpc: State<'_, rpc::RpcMutex>,
is_offline: bool,
) -> Result<(), String> {
log::info!(
"network change detected ({}), toggling crawler",
if is_offline { "offline" } else { "online" }
);

let mut rpc = rpc.lock().await;
match rpc
.client
.call_method::<Value, response::AppStatus>("app_status", "", Value::Null)
.await
{
Ok(status) => {
// Pause the crawler if we're offline and we're currently crawling.
let should_toggle =
(!status.is_paused && is_offline) || (status.is_paused && !is_offline);

if should_toggle {
let _ = rpc
.client
.call_method::<Value, response::AppStatus>("toggle_pause", "", Value::Null)
.await;
}
}
Err(err) => {
log::error!("Error sending RPC: {}", err);
rpc.reconnect().await;
}
}

Ok(())
}
1 change: 1 addition & 0 deletions crates/tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
cmd::install_lens,
cmd::list_installable_lenses,
cmd::list_installed_lenses,
cmd::network_change,
cmd::open_lens_folder,
cmd::open_result,
cmd::resize_window,
Expand Down
2 changes: 1 addition & 1 deletion crates/tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"package": {
"productName": "Spyglass",
"version": "22.6.3"
"version": "22.6.4"
},
"build": {
"distDir": "../client/dist",
Expand Down

0 comments on commit 2f74405

Please sign in to comment.