Skip to content
Merged
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
20 changes: 3 additions & 17 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ tasks:

db:
env:
DB: /Users/yujonglee/Library/Application Support/com.hyprnote.nightly/db.sqlite
DB: /Users/yujonglee/Library/Application Support/hyprnote/db.sqlite
cmds:
- |
sqlite3 -json "$DB" 'SELECT store FROM main LIMIT 1;' |
Expand Down
4 changes: 2 additions & 2 deletions crates/gguf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ mod tests {
fn test_chat_format() {
let test_path = dirs::data_dir()
.unwrap()
.join("com.hyprnote.stable")
.join("ttt/hypr-llm.gguf");
.join("hyprnote")
.join("models/llm/hypr-llm.gguf");

assert!(test_path.exists());
println!("{:?}", test_path.chat_format().unwrap().unwrap());
Expand Down
4 changes: 2 additions & 2 deletions crates/llama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ mod tests {
fn get_model() -> Llama {
let model_path = dirs::data_dir()
.unwrap()
.join("com.hyprnote.dev")
.join("ttt/hypr-llm.gguf");
.join("hyprnote")
.join("models/llm/hypr-llm.gguf");

Llama::new(model_path).unwrap()
}
Expand Down
4 changes: 2 additions & 2 deletions crates/transcribe-whisper-local/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ mod tests {
async fn test_service() -> Result<(), Box<dyn std::error::Error>> {
let model_path = dirs::data_dir()
.unwrap()
.join("com.hyprnote.dev")
.join("stt/ggml-small-q8_0.bin");
.join("hyprnote")
.join("models/stt/ggml-small-q8_0.bin");

let service = HandleError::new(
TranscribeService::builder().model_path(model_path).build(),
Expand Down
6 changes: 3 additions & 3 deletions owhisper/owhisper-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ impl ModelConfig {
}

pub fn models_dir() -> std::path::PathBuf {
dirs::cache_dir().unwrap().join("com.fastrepl.owhisper")
dirs::cache_dir().unwrap().join("owhisper")
}

pub fn data_dir() -> std::path::PathBuf {
dirs::data_dir().unwrap().join("com.fastrepl.owhisper")
dirs::data_dir().unwrap().join("owhisper")
}

pub fn config_dir() -> std::path::PathBuf {
dirs::config_dir().unwrap().join("com.fastrepl.owhisper")
dirs::config_dir().unwrap().join("owhisper")
}

pub fn global_config_path() -> std::path::PathBuf {
Expand Down
2 changes: 1 addition & 1 deletion owhisper/owhisper-server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ mod tests {
id: "whisper_cpp".to_string(),
assets_dir: dirs::data_dir()
.unwrap()
.join("com.hyprnote.dev/stt/ggml-small-q8_0.bin")
.join("hyprnote/models/stt/ggml-small-q8_0.bin")
.to_str()
.unwrap()
.to_string(),
Expand Down
1 change: 1 addition & 0 deletions plugins/db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ specta = { workspace = true }
tauri = { workspace = true, features = ["test"] }
tauri-specta = { workspace = true, features = ["derive", "typescript"] }

dirs = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }
uuid = { workspace = true }
Expand Down
4 changes: 1 addition & 3 deletions plugins/db/src/ext.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::future::Future;
use tauri::Manager;

pub trait DatabasePluginExt<R: tauri::Runtime> {
fn db_user_id(&self) -> impl Future<Output = Result<Option<String>, crate::Error>>;
Expand Down Expand Up @@ -36,8 +35,7 @@ impl<R: tauri::Runtime, T: tauri::Manager<R>> DatabasePluginExt<R> for T {

fn db_local_path(&self) -> Result<String, crate::Error> {
let v = {
let app = self.app_handle();
let dir = app.path().app_data_dir()?;
let dir = dirs::data_dir().unwrap().join("hyprnote");
std::fs::create_dir_all(&dir)?;

dir.join("db.sqlite").to_str().unwrap().to_string()
Expand Down
2 changes: 1 addition & 1 deletion plugins/db2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ futures-util = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
tracing = { workspace = true }

dirs = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
specta = { workspace = true, features = ["serde_json"] }
strum = { workspace = true, features = ["derive"] }

thiserror = { workspace = true }
2 changes: 2 additions & 0 deletions plugins/db2/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ pub enum Error {
HyprDbError(#[from] hypr_db_core::Error),
#[error(transparent)]
TauriError(#[from] tauri::Error),
#[error(transparent)]
IoError(#[from] std::io::Error),
}

impl Serialize for Error {
Expand Down
3 changes: 2 additions & 1 deletion plugins/db2/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ impl<R: tauri::Runtime, T: tauri::Manager<R>> Database2PluginExt<R> for T {
.await
.unwrap()
} else {
let dir_path = self.app_handle().path().app_data_dir()?;
let dir_path = dirs::data_dir().unwrap().join("hyprnote");
std::fs::create_dir_all(&dir_path)?;
let file_path = dir_path.join("db.sqlite");

hypr_db_core::DatabaseBuilder::default()
Expand Down
2 changes: 1 addition & 1 deletion plugins/listener/src/actors/controller.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::time::{Instant, SystemTime};

use tauri::Manager;

Check warning on line 3 in plugins/listener/src/actors/controller.rs

View workflow job for this annotation

GitHub Actions / ci (macos, macos-14)

unused import: `tauri::Manager`
use tauri_specta::Event;
use tokio_util::sync::CancellationToken;

Expand Down Expand Up @@ -279,7 +279,7 @@
Some(RecorderActor::name()),
RecorderActor,
RecArgs {
app_dir: state.app.path().app_data_dir().unwrap(),
app_dir: dirs::data_dir().unwrap().join("hyprnote").join("sessions"),
session_id: state.params.session_id.clone(),
},
supervisor,
Expand Down
6 changes: 5 additions & 1 deletion plugins/local-llm/src/ext/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ impl<R: Runtime, T: Manager<R>> LocalLlmPluginExt<R> for T {
}

fn models_dir(&self) -> PathBuf {
self.path().app_data_dir().unwrap().join("ttt")
dirs::data_dir()
.unwrap()
.join("hyprnote")
.join("models")
.join("llm")
}

#[tracing::instrument(skip_all)]
Expand Down
2 changes: 1 addition & 1 deletion plugins/local-llm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
.setup(move |app, _api| {
specta_builder.mount_events(app);

let data_dir = app.path().app_data_dir().unwrap();
let data_dir = dirs::data_dir().unwrap().join("hyprnote");
let models_dir = app.models_dir();

// for backward compatibility
Expand Down
8 changes: 6 additions & 2 deletions plugins/local-stt/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ pub trait LocalSttPluginExt<R: Runtime> {

impl<R: Runtime, T: Manager<R>> LocalSttPluginExt<R> for T {
fn models_dir(&self) -> PathBuf {
self.path().app_data_dir().unwrap().join("stt")
dirs::data_dir()
.unwrap()
.join("hyprnote")
.join("models")
.join("stt")
}

fn list_ggml_backends(&self) -> Vec<hypr_whisper_local::GgmlBackend> {
Expand Down Expand Up @@ -132,7 +136,7 @@ impl<R: Runtime, T: Manager<R>> LocalSttPluginExt<R> for T {
start_internal_server(&supervisor, cache_dir, whisper_model).await
}
ServerType::External => {
let data_dir = self.app_handle().path().app_data_dir().unwrap().join("stt");
let data_dir = self.models_dir();
let am_model = match model {
SupportedSttModel::Am(m) => m,
_ => return Err(crate::Error::UnsupportedModelType),
Expand Down
1 change: 1 addition & 0 deletions plugins/misc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ tauri = { workspace = true, features = ["test"] }
tauri-plugin-opener = { workspace = true }
tauri-specta = { workspace = true, features = ["derive", "typescript"] }

dirs = { workspace = true }
lazy_static = { workspace = true }
regex = { workspace = true }
rodio = { workspace = true, features = ["wav"] }
Expand Down
19 changes: 9 additions & 10 deletions plugins/misc/src/commands.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::path::PathBuf;

use tauri::Manager;
use tauri_plugin_opener::OpenerExt;

use crate::audio::import_audio;
Expand Down Expand Up @@ -33,10 +32,10 @@
#[tauri::command]
#[specta::specta]
pub async fn audio_exist<R: tauri::Runtime>(
app: tauri::AppHandle<R>,

Check warning on line 35 in plugins/misc/src/commands.rs

View workflow job for this annotation

GitHub Actions / ci (macos, macos-14)

unused variable: `app`
session_id: String,
) -> Result<bool, String> {
let data_dir = app.path().app_data_dir().unwrap();
let data_dir = dirs::data_dir().unwrap().join("hyprnote").join("sessions");
let session_dir = data_dir.join(session_id);

["audio.wav", "audio.ogg"]
Expand All @@ -52,10 +51,10 @@
#[tauri::command]
#[specta::specta]
pub async fn audio_delete<R: tauri::Runtime>(
app: tauri::AppHandle<R>,

Check warning on line 54 in plugins/misc/src/commands.rs

View workflow job for this annotation

GitHub Actions / ci (macos, macos-14)

unused variable: `app`
session_id: String,
) -> Result<(), String> {
let data_dir = app.path().app_data_dir().unwrap();
let data_dir = dirs::data_dir().unwrap().join("hyprnote").join("sessions");
let session_dir = data_dir.join(session_id);

["audio.wav", "audio.ogg"]
Expand Down Expand Up @@ -84,14 +83,14 @@
}

fn audio_import_internal<R: tauri::Runtime>(
app: &tauri::AppHandle<R>,

Check warning on line 86 in plugins/misc/src/commands.rs

View workflow job for this annotation

GitHub Actions / ci (macos, macos-14)

unused variable: `app`
session_id: &str,
source_path: &str,
) -> Result<PathBuf, AudioImportError> {
let data_dir = app
.path()
.app_data_dir()
.map_err(|err| AudioImportError::PathResolver(err.to_string()))?;
let data_dir = dirs::data_dir()
.ok_or_else(|| AudioImportError::PathResolver("Failed to get data directory".to_string()))?
.join("hyprnote")
.join("sessions");
let session_dir = data_dir.join(session_id);

std::fs::create_dir_all(&session_dir)?;
Expand All @@ -118,10 +117,10 @@
#[tauri::command]
#[specta::specta]
pub async fn audio_path<R: tauri::Runtime>(
app: tauri::AppHandle<R>,

Check warning on line 120 in plugins/misc/src/commands.rs

View workflow job for this annotation

GitHub Actions / ci (macos, macos-14)

unused variable: `app`
session_id: String,
) -> Result<String, String> {
let data_dir = app.path().app_data_dir().unwrap();
let data_dir = dirs::data_dir().unwrap().join("hyprnote").join("sessions");
let session_dir = data_dir.join(session_id);

let path = ["audio.ogg", "audio.wav"]
Expand All @@ -139,7 +138,7 @@
app: tauri::AppHandle<R>,
session_id: String,
) -> Result<(), String> {
let data_dir = app.path().app_data_dir().unwrap();
let data_dir = dirs::data_dir().unwrap().join("hyprnote").join("sessions");
let session_dir = data_dir.join(session_id);

app.opener()
Expand All @@ -152,10 +151,10 @@
#[tauri::command]
#[specta::specta]
pub async fn delete_session_folder<R: tauri::Runtime>(
app: tauri::AppHandle<R>,

Check warning on line 154 in plugins/misc/src/commands.rs

View workflow job for this annotation

GitHub Actions / ci (macos, macos-14)

unused variable: `app`
session_id: String,
) -> Result<(), String> {
let data_dir = app.path().app_data_dir().unwrap();
let data_dir = dirs::data_dir().unwrap().join("hyprnote").join("sessions");
let session_dir = data_dir.join(session_id);

if session_dir.exists() {
Expand Down
3 changes: 1 addition & 2 deletions plugins/tracing/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ use crate::{Level, TracingPluginExt};
#[tauri::command]
#[specta::specta]
pub async fn logs_dir<R: tauri::Runtime>(app: tauri::AppHandle<R>) -> Result<PathBuf, String> {
let bundle_id = app.config().identifier.clone();
app.logs_dir(bundle_id).map_err(|e| e.to_string())
app.logs_dir().map_err(|e| e.to_string())
}

#[tauri::command]
Expand Down
7 changes: 3 additions & 4 deletions plugins/tracing/src/ext.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
use std::path::PathBuf;

pub trait TracingPluginExt<R: tauri::Runtime> {
fn logs_dir(&self, bundle_id: impl Into<String>) -> Result<PathBuf, crate::Error>;
fn logs_dir(&self) -> Result<PathBuf, crate::Error>;
fn do_log(&self, level: Level, data: Vec<serde_json::Value>) -> Result<(), crate::Error>;
}

impl<R: tauri::Runtime, T: tauri::Manager<R>> TracingPluginExt<R> for T {
fn logs_dir(&self, bundle_id: impl Into<String>) -> Result<PathBuf, crate::Error> {
let base_dir = dirs::data_dir().unwrap();
let logs_dir = base_dir.join(bundle_id.into()).join("logs");
fn logs_dir(&self) -> Result<PathBuf, crate::Error> {
let logs_dir = dirs::home_dir().unwrap().join("Library/Logs/hyprnote");
let _ = std::fs::create_dir_all(&logs_dir);
Ok(logs_dir)
}
Expand Down
7 changes: 3 additions & 4 deletions plugins/tracing/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ pub fn init() -> tauri::plugin::TauriPlugin<tauri::Wry> {
.unwrap_or_else(|_| EnvFilter::new("info"))
.add_directive("ort=warn".parse().unwrap());

if let Some((file_writer, guard)) = make_file_writer_if_enabled(
true,
&app.logs_dir(app.config().identifier.clone()).unwrap(),
) {
if let Some((file_writer, guard)) =
make_file_writer_if_enabled(true, &app.logs_dir().unwrap())
{
tracing_subscriber::Registry::default()
.with(env_filter)
.with(sentry::integrations::tracing::layer())
Expand Down
12 changes: 6 additions & 6 deletions scripts/info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ nightly_user_id=""
stable_version=""
nightly_version=""

if [ -d "$HOME/Library/Application Support/com.hyprnote.stable" ]; then
if [ -f "$HOME/Library/Application Support/com.hyprnote.stable/store.json" ]; then
stable_user_id=$(jq -r '."auth-user-id" // empty' "$HOME/Library/Application Support/com.hyprnote.stable/store.json")
if [ -d "$HOME/Library/Application Support/hyprnote" ]; then
if [ -f "$HOME/Library/Application Support/hyprnote/store.json" ]; then
stable_user_id=$(jq -r '."auth-user-id" // empty' "$HOME/Library/Application Support/hyprnote/store.json")
fi
fi

if [ -d "$HOME/Library/Application Support/com.hyprnote.nightly" ]; then
if [ -f "$HOME/Library/Application Support/com.hyprnote.nightly/store.json" ]; then
nightly_user_id=$(jq -r '."auth-user-id" // empty' "$HOME/Library/Application Support/com.hyprnote.nightly/store.json")
if [ -d "$HOME/Library/Application Support/hyprnote-nightly" ]; then
if [ -f "$HOME/Library/Application Support/hyprnote-nightly/store.json" ]; then
nightly_user_id=$(jq -r '."auth-user-id" // empty' "$HOME/Library/Application Support/hyprnote-nightly/store.json")
fi
fi

Expand Down
4 changes: 2 additions & 2 deletions scripts/swap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ if pgrep -q "Hyprnote"; then
exit 1
fi

STABLE_DIR="$HOME/Library/Application Support/com.hyprnote.stable"
NIGHTLY_DIR="$HOME/Library/Application Support/com.hyprnote.nightly"
STABLE_DIR="$HOME/Library/Application Support/hyprnote"
NIGHTLY_DIR="$HOME/Library/Application Support/hyprnote-nightly"
TEMP_DIR=$(mktemp -d)

if [[ ! -d "$STABLE_DIR" ]]; then
Expand Down
Loading