refactor sora module naming

This commit is contained in:
Brandon Thomas committed 2025-04-21 15:45:27 -04:00
1 parent 638f453cb8
commit dd8b03692a
9 files changed
+17 -15

No files matched your search

@@ -1,3 +1,2 @@
pub mod flip_image;
pub mod image_generation_command;
pub mod open_login_command;
pub mod sora;
@@ -0,0 +1,2 @@
pub mod sora_image_generation_command;
pub mod open_sora_login_command;
@@ -4,7 +4,7 @@ use once_cell::sync::Lazy;
use tauri::{AppHandle, Manager, Url, WebviewUrl, WebviewWindowBuilder, WindowBuilder};
use tokio::time::sleep_until;
use errors::AnyhowResult;
use crate::threads::login_thread::{LOGIN_WINDOW_NAME, SORA_LOGIN_URL};
use crate::threads::sora_session_login_thread::{LOGIN_WINDOW_NAME, SORA_LOGIN_URL};
use crate::utils::clear_all_webview_cookies::clear_all_webview_cookies;
pub const START_URL_STR: &str = "https://storyteller.ai/";
@@ -20,7 +20,7 @@ pub static SORA_HOMEPAGE_URL : Lazy<Url> = Lazy::new(|| {
});
#[tauri::command]
pub async fn open_login_command(
pub async fn open_sora_login_command(
app: AppHandle,
) -> Result<String, String> {
info!("open_login_command called");
@@ -15,7 +15,7 @@ use openai_sora_client::upload::upload_media_from_file::SoraMediaUploadRequest;
use crate::state::app_dir::AppDataRoot;
#[tauri::command]
pub async fn image_generation_command(
pub async fn sora_image_generation_command(
image: &str,
prompt: &str,
app: AppHandle,
+6 -6
View File
@@ -6,10 +6,10 @@ pub mod transfer;
pub mod utils;
use crate::commands::flip_image::flip_image;
use crate::commands::image_generation_command::image_generation_command;
use crate::commands::open_login_command::open_login_command;
use crate::commands::sora::open_sora_login_command::open_sora_login_command;
use crate::commands::sora::sora_image_generation_command::sora_image_generation_command;
use crate::state::app_config::AppConfig;
use crate::threads::login_thread::login_thread;
use crate::threads::sora_session_login_thread::sora_session_login_thread;
use tauri_plugin_log::Target;
use tauri_plugin_log::TargetKind;
@@ -49,7 +49,7 @@ pub fn run() {
//}
let app = app.handle().clone();
tauri::async_runtime::spawn(login_thread(app, app_data_root2));
tauri::async_runtime::spawn(sora_session_login_thread(app, app_data_root2));
Ok(())
})
@@ -57,8 +57,8 @@ pub fn run() {
.manage(app_data_root)
.invoke_handler(tauri::generate_handler![
flip_image,
image_generation_command,
open_login_command,
sora_image_generation_command,
open_sora_login_command,
])
.run(tauri::generate_context!("tauri.conf.json"))
.expect("error while running tauri application");
@@ -1 +1 @@
pub mod login_thread;
pub mod sora_session_login_thread;
@@ -23,7 +23,7 @@ pub static SORA_ROOT_URL: Lazy<Url> = Lazy::new(|| {
Url::parse(SORA_ROOT_URL_STR).expect("URL should parse")
});
pub async fn login_thread(app: AppHandle, app_data_root: AppDataRoot) -> ! {
pub async fn sora_session_login_thread(app: AppHandle, app_data_root: AppDataRoot) -> ! {
loop {
for (window_name, webview) in app.webviews() {
if window_name == LOGIN_WINDOW_NAME {
@@ -134,7 +134,7 @@ export const Main = withProtectionRoute(() => {
iconFlip={true}
onClick={async () => {
if (isTauri()) {
await invoke('open_login_command');
await invoke('open_sora_login_command');
setFirstTimeDialogOpen(false);
} else {
console.error('Tauri is not available in this environment');
+2 -1
View File
@@ -12,8 +12,8 @@ if lsof -i tcp:5741 &>/dev/null; then
else
echo "No process running on port 5741"
fi
# TODO(bt,2025-02-13): This is not the correct way to get the root dir
brew install pkg-config pixman cairo pango libpng jpeg giflib librsvg
root_dir=$(pwd)
frontend_path="${root_dir}/frontend"
@@ -30,3 +30,4 @@ export CONFIG_PATH="${TAURI_APP_PATH}/tauri.artcraft_2d.conf.toml"
# TODO: --no-watch
cargo tauri dev --config "${CONFIG_PATH}"