mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-08 07:12:49 +00:00
fix prod build not working & thumbnails on web
This commit is contained in:
parent
26c1c8cadb
commit
dc97f087c9
|
@ -5,6 +5,7 @@
|
|||
|
||||
use std::error::Error;
|
||||
use std::path::PathBuf;
|
||||
use std::time::Duration;
|
||||
|
||||
use sd_core::Node;
|
||||
use tauri::async_runtime::block_on;
|
||||
|
@ -14,6 +15,7 @@ use tauri::{
|
|||
Manager, RunEvent,
|
||||
};
|
||||
use tokio::task::block_in_place;
|
||||
use tokio::time::sleep;
|
||||
use tracing::{debug, error};
|
||||
#[cfg(target_os = "macos")]
|
||||
mod macos;
|
||||
|
@ -56,17 +58,20 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||
})
|
||||
.setup(|app| {
|
||||
let app = app.handle();
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
// use macos::{lock_app_theme, AppThemeType};
|
||||
|
||||
// lock_app_theme(AppThemeType::Dark as _);
|
||||
}
|
||||
|
||||
app.windows().iter().for_each(|(_, window)| {
|
||||
window.hide().unwrap();
|
||||
|
||||
tokio::spawn({
|
||||
let window = window.clone();
|
||||
async move {
|
||||
sleep(Duration::from_secs(3)).await;
|
||||
if window.is_visible().unwrap_or(true) == false {
|
||||
println!("Window did not emit `app_ready` event fast enough. Showing window...");
|
||||
let _ = window.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
window.set_decorations(true).unwrap();
|
||||
|
||||
|
|
|
@ -33,7 +33,8 @@ async function getOs(): Promise<OperatingSystem> {
|
|||
|
||||
const platform: Platform = {
|
||||
platform: 'tauri',
|
||||
getThumbnailUrlById: (casId) => `spacedrive://thumbnail/${encodeURIComponent(casId)}`,
|
||||
getThumbnailUrlById: (casId) =>
|
||||
`${window.location.origin}/spacedrive/thumbnail/${encodeURIComponent(casId)}`,
|
||||
openLink: shell.open,
|
||||
getOs,
|
||||
openFilePickerDialog: () => dialog.open({ directory: true }),
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
</head>
|
||||
<body style="overflow: hidden">
|
||||
<div id="root"></div>
|
||||
<!-- Script for React devtools. TODO: Make sure this isn't included in production builds. -->
|
||||
<script src="http://localhost:8097"></script>
|
||||
<script type="module" src="./index.tsx"></script>
|
||||
</body>
|
||||
|
|
|
@ -2,7 +2,7 @@ declare global {
|
|||
var isDev: boolean;
|
||||
}
|
||||
|
||||
if (!globalThis.localStorage || !globalThis.isDev)
|
||||
if (globalThis.localStorage === undefined || globalThis.isDev === undefined)
|
||||
throw new Error('Please ensure you have patched `globalThis` before importing `@sd/client`!');
|
||||
|
||||
export * from './hooks';
|
||||
|
|
Loading…
Reference in a new issue