fix appearance init

This commit is contained in:
Gregory Schier
2024-01-12 21:59:46 -08:00
parent a8630ede38
commit 93d1ff778e
4 changed files with 23 additions and 2 deletions

11
src-tauri/Cargo.lock generated
View File

@@ -2738,6 +2738,15 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-src"
version = "300.1.6+3.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439fac53e092cd7442a3660c85dde4643ab3b5bd39040912388dcdabf6b88085"
dependencies = [
"cc",
]
[[package]]
name = "openssl-sys"
version = "0.9.95"
@@ -2746,6 +2755,7 @@ checksum = "40a4130519a360279579c2053038317e40eff64d13fd3f004f9e1b72b8a6aaf9"
dependencies = [
"cc",
"libc",
"openssl-src",
"pkg-config",
"vcpkg",
]
@@ -5740,6 +5750,7 @@ dependencies = [
"http",
"log",
"objc",
"openssl-sys",
"rand 0.8.5",
"reqwest",
"serde",

View File

@@ -48,7 +48,7 @@ tokio = { version = "1.25.0", features = ["sync"] }
uuid = "1.3.0"
log = "0.4.20"
datetime = "0.5.2"
openssl-sys = {version = "0.9", features = ["vendored"]} # For Ubuntu installation to work
openssl-sys = {version = "0.9", features = ["vendored"] } # For Ubuntu installation to work
[features]
# by default Tauri runs in production mode

View File

@@ -1,5 +1,9 @@
import { invoke } from '@tauri-apps/api';
import type { Environment, Folder, HttpRequest, Workspace } from './models';
import type { Environment, Folder, HttpRequest, Settings, Workspace } from './models';
export async function getSettings(): Promise<Settings> {
return invoke('get_settings', {});
}
export async function getRequest(id: string | null): Promise<HttpRequest | null> {
if (id === null) return null;

View File

@@ -4,10 +4,16 @@ import { attachConsole } from 'tauri-plugin-log-api';
import { App } from './components/App';
import { maybeRestorePathname } from './lib/persistPathname';
import './main.css';
import { getSettings } from './lib/store';
import type { Appearance } from './lib/theme/window';
import { setAppearanceOnDocument } from './lib/theme/window';
await attachConsole();
await maybeRestorePathname();
const settings = await getSettings();
setAppearanceOnDocument(settings.appearance as Appearance);
document.addEventListener('keydown', (e) => {
// Don't go back in history on backspace
if (e.key === 'Backspace') e.preventDefault();