mirror of
https://github.com/ow-mods/ow-mod-man.git
synced 2025-12-11 20:15:50 +01:00
Update to actual v2
This commit is contained in:
parent
a79194fe93
commit
3316a65f0d
1909
Cargo.lock
generated
1909
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
{
|
||||
stdenv,
|
||||
lib,
|
||||
libsoup,
|
||||
libsoup_3,
|
||||
dbus,
|
||||
dpkg,
|
||||
fetchurl,
|
||||
@ -9,7 +9,7 @@
|
||||
glib,
|
||||
glib-networking,
|
||||
librsvg,
|
||||
webkitgtk,
|
||||
webkitgtk_4_1,
|
||||
pkg-config,
|
||||
openssl,
|
||||
wrapGAppsHook,
|
||||
@ -56,11 +56,11 @@ rustPlatform.buildRustPackage rec {
|
||||
buildInputs = [
|
||||
openssl
|
||||
dbus
|
||||
libsoup
|
||||
libsoup_3
|
||||
glib
|
||||
librsvg
|
||||
glib-networking
|
||||
webkitgtk
|
||||
webkitgtk_4_1
|
||||
];
|
||||
|
||||
buildAndTestSubdir = "owmods_gui/backend";
|
||||
@ -72,7 +72,7 @@ rustPlatform.buildRustPackage rec {
|
||||
inherit version;
|
||||
pname = "owmods_gui-ui";
|
||||
|
||||
npmDepsHash = "sha256-y2ozBEXF4kYaXxMqDhObCsCUn+4QePj86+PjPoUZ9AE=";
|
||||
npmDepsHash = "sha256-ZD1qVbA1Aj9BAj75A2nj/kiN2O0Ulxr9KnQTRJFvyOM=";
|
||||
src = ../owmods_gui/frontend;
|
||||
|
||||
packageJSON = ../owmods_gui/frontend/package.json;
|
||||
@ -88,7 +88,7 @@ rustPlatform.buildRustPackage rec {
|
||||
};
|
||||
in ''
|
||||
substituteInPlace owmods_gui/backend/tauri.conf.json \
|
||||
--replace '"distDir": "../dist"' '"distDir": "${frontend}"'
|
||||
--replace '"frontendDist": "../dist"' '"frontendDist": "${frontend}"'
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
{pkgs ? import <nixpkgs> {}}:
|
||||
# NOTE(Spoonbaker): This doesn't include the overlay when using `nix-shell` instead of `nix shell`
|
||||
pkgs.mkShell {
|
||||
name = "owmods-shell";
|
||||
buildInputs = with pkgs; [
|
||||
@ -8,17 +7,24 @@ pkgs.mkShell {
|
||||
clippy
|
||||
rustfmt
|
||||
nodejs
|
||||
gcc
|
||||
webkitgtk_4_1
|
||||
glib-networking
|
||||
pkg-config
|
||||
libnotify
|
||||
gtk3
|
||||
libsoup
|
||||
librsvg
|
||||
(pkgs.callPackage ./tauri-cli.nix {})
|
||||
typeshare
|
||||
at-spi2-atk
|
||||
atkmm
|
||||
cairo
|
||||
gdk-pixbuf
|
||||
glib
|
||||
gobject-introspection
|
||||
gobject-introspection.dev
|
||||
gtk3
|
||||
harfbuzz
|
||||
librsvg
|
||||
libsoup_3
|
||||
(callPackage ./tauri-cli.nix {})
|
||||
pango
|
||||
webkitgtk
|
||||
];
|
||||
PKG_CONFIG_PATH = with pkgs; "${glib.dev}/lib/pkgconfig:${libsoup_3.dev}/lib/pkgconfig:${webkitgtk_4_1.dev}/lib/pkgconfig:${at-spi2-atk.dev}/lib/pkgconfig:${gtk3.dev}/lib/pkgconfig:${gdk-pixbuf.dev}/lib/pkgconfig:${cairo.dev}/lib/pkgconfig:${pango.dev}/lib/pkgconfig:${harfbuzz.dev}/lib/pkgconfig";
|
||||
OPENSSL_LIB_DIR = "${pkgs.openssl.out}/lib";
|
||||
OPENSSL_INCLUDE_DIR = "${pkgs.openssl.dev}/include";
|
||||
shellHook = ''
|
||||
|
||||
@ -9,31 +9,28 @@ license = "GPL-3.0-or-later"
|
||||
edition = "2021"
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2.0.0-rc.2", features = [] }
|
||||
tauri-build = { version = "2.0.1", features = [] }
|
||||
|
||||
[dependencies]
|
||||
owmods_core = { version = "0.14.2", path = "../../owmods_core" }
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "2.0.0-rc.2", features = [] }
|
||||
tauri = { version = "2.0.0", features = [] }
|
||||
anyhow = "1.0.75"
|
||||
tokio = { version = "1.32.0", features = ["sync", "macros"] }
|
||||
log = { version = "0.4.20", features = ["std", "serde"] }
|
||||
typeshare = "1.0.1"
|
||||
notify = { version = "6.0.1", default-features = false, features = [
|
||||
tokio = { version = "1.40.0", features = ["sync", "macros"] }
|
||||
log = { version = "0.4.22", features = ["std", "serde"] }
|
||||
typeshare = "1.0.3"
|
||||
notify = { version = "6.1.1", default-features = false, features = [
|
||||
"macos_kqueue",
|
||||
] }
|
||||
regex = "1.9.3"
|
||||
time = { version = "0.3.25", features = ["macros", "local-offset"] }
|
||||
tauri-plugin-deep-link = "0.1.2"
|
||||
opener = "0.6.1"
|
||||
tauri-plugin-dialog = "2.0.0-rc.0"
|
||||
tauri-plugin-updater = "2.0.0-rc.0"
|
||||
tauri-plugin-os = "2.0.0-rc.0"
|
||||
tauri-plugin-shell = "2.0.0-rc.0"
|
||||
tauri-plugin-process = "2.0.0-rc.0"
|
||||
tauri-plugin-clipboard-manager = "2.0.0-rc.0"
|
||||
|
||||
[features]
|
||||
default = ["custom-protocol"]
|
||||
custom-protocol = ["tauri/custom-protocol"]
|
||||
regex = "1.11.0"
|
||||
time = { version = "0.3.36", features = ["macros", "local-offset"] }
|
||||
opener = "0.7.2"
|
||||
tauri-plugin-deep-link = "2.0.1"
|
||||
tauri-plugin-single-instance = { version = "2.0.1", features = ["deep-link"] }
|
||||
tauri-plugin-dialog = "2.0.1"
|
||||
tauri-plugin-updater = "2.0.2"
|
||||
tauri-plugin-os = "2.0.1"
|
||||
tauri-plugin-shell = "2.0.1"
|
||||
tauri-plugin-process = "2.0.1"
|
||||
tauri-plugin-clipboard-manager = "2.0.1"
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
"core:webview:allow-internal-toggle-devtools",
|
||||
"core:app:allow-version",
|
||||
"core:event:default",
|
||||
"deep-link:default",
|
||||
"dialog:default",
|
||||
"shell:allow-open"
|
||||
]
|
||||
|
||||
@ -33,7 +33,7 @@ use owmods_core::{
|
||||
};
|
||||
use serde::Serialize;
|
||||
use tauri::{async_runtime, AppHandle, DragDropEvent, Manager, WindowEvent};
|
||||
use tauri_plugin_dialog::{DialogExt, MessageDialogKind};
|
||||
use tauri_plugin_dialog::{DialogExt, MessageDialogButtons, MessageDialogKind};
|
||||
use tokio::{select, sync::mpsc, try_join};
|
||||
use typeshare::typeshare;
|
||||
|
||||
@ -345,8 +345,7 @@ pub async fn install_mod(
|
||||
current_mod.manifest.name
|
||||
))
|
||||
.kind(MessageDialogKind::Info)
|
||||
.ok_button_label("Yes")
|
||||
.cancel_button_label("No")
|
||||
.buttons(MessageDialogButtons::OkCancelCustom("Yes".to_string(), "No".to_string()))
|
||||
.title("Reinstall?")
|
||||
.blocking_show();
|
||||
}
|
||||
@ -914,8 +913,7 @@ pub async fn db_has_issues(state: tauri::State<'_, State>, window: tauri::Window
|
||||
owml.manifest.version
|
||||
))
|
||||
.kind(MessageDialogKind::Info)
|
||||
.ok_button_label("Yes")
|
||||
.cancel_button_label("No")
|
||||
.buttons(MessageDialogButtons::OkCancelCustom("Yes".to_string(), "No".to_string()))
|
||||
.title("Update OWML?")
|
||||
.blocking_show();
|
||||
if answer {
|
||||
|
||||
@ -20,6 +20,7 @@ use owmods_core::{
|
||||
};
|
||||
|
||||
use anyhow::anyhow;
|
||||
use tauri_plugin_deep_link::DeepLinkExt;
|
||||
use time::macros::format_description;
|
||||
use tokio::sync::RwLock as TokioLock;
|
||||
|
||||
@ -93,13 +94,13 @@ pub struct State {
|
||||
mods_in_progress: StatePart<Vec<String>>,
|
||||
}
|
||||
|
||||
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let config = Config::get(None).unwrap_or(Config::default(None)?);
|
||||
let gui_config = GuiConfig::get().unwrap_or_default();
|
||||
let local_db = LocalDatabase::fetch(&config.owml_path).unwrap_or_default();
|
||||
|
||||
tauri_plugin_deep_link::prepare("com.bwc9876.owmods-gui");
|
||||
|
||||
let url = std::env::args().nth(1).map(|s| ProtocolPayload::parse(&s));
|
||||
|
||||
let res = tauri::Builder::default()
|
||||
@ -114,6 +115,10 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
progress_bars: manage(ProgressBars::new()),
|
||||
mods_in_progress: manage(Vec::with_capacity(4)),
|
||||
})
|
||||
.plugin(tauri_plugin_single_instance::init(|_app, _argv, _cwd| {
|
||||
println!("New app instance opened, invoked URI handler.");
|
||||
}))
|
||||
.plugin(tauri_plugin_deep_link::init())
|
||||
.setup(move |app| {
|
||||
// Logger Setup
|
||||
|
||||
@ -131,13 +136,13 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
|
||||
// Protocol Listener Setup
|
||||
|
||||
let handle = app.handle().clone();
|
||||
|
||||
let res = protocol::prep_protocol(handle);
|
||||
#[cfg(any(target_os = "linux", all(debug_assertions, windows)))]
|
||||
let res = app.deep_link().register_all();
|
||||
|
||||
if let Err(why) = res {
|
||||
warn!("Failed to setup URI handler: {:?}", why);
|
||||
} else {
|
||||
protocol::prep_protocol(app.handle().clone());
|
||||
debug!("Setup URI handler");
|
||||
}
|
||||
|
||||
|
||||
@ -1,35 +1,17 @@
|
||||
use anyhow::Result;
|
||||
use log::debug;
|
||||
use owmods_core::protocol::{ProtocolPayload, ProtocolVerb};
|
||||
use tauri::{async_runtime, Manager};
|
||||
use tauri_plugin_deep_link::DeepLinkExt;
|
||||
|
||||
use crate::events::{CustomEventEmitterAll, Event};
|
||||
|
||||
/// Amount of listeners that need to be active before we can emit the protocol invoke event.
|
||||
pub const PROTOCOL_LISTENER_AMOUNT: usize = 2;
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
fn register_or_listen<F>(uri: &str, handler: F) -> Result<()>
|
||||
where
|
||||
F: FnMut(String) + Send + 'static,
|
||||
{
|
||||
debug!("Registering protocol handler for {}", uri);
|
||||
tauri_plugin_deep_link::register(uri, handler)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn register_or_listen<F>(_: &str, handler: F) -> Result<()>
|
||||
where
|
||||
F: FnMut(String) + Send + 'static,
|
||||
{
|
||||
debug!("Skipping protocol registration for Linux");
|
||||
tauri_plugin_deep_link::listen(handler)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn prep_protocol(handle: tauri::AppHandle) -> Result<()> {
|
||||
register_or_listen("owmods", move |request| {
|
||||
pub fn prep_protocol(handle: tauri::AppHandle) {
|
||||
let handle_inner = handle.clone();
|
||||
handle.deep_link().on_open_url(move |request| {
|
||||
let request = request.urls().first().map(|u| u.to_string()).unwrap_or_default();
|
||||
let protocol_payload = ProtocolPayload::parse(&request);
|
||||
match protocol_payload.verb {
|
||||
ProtocolVerb::Unknown => {
|
||||
@ -45,7 +27,7 @@ pub fn prep_protocol(handle: tauri::AppHandle) -> Result<()> {
|
||||
// Meaning opposed to being able to be read like in main.rs, we have to ensure
|
||||
// that the listeners are ready to receive the protocol payload and store it
|
||||
// otherwise.
|
||||
let handle2 = handle.clone();
|
||||
let handle2 = handle_inner.clone();
|
||||
async_runtime::spawn(async move {
|
||||
let state = handle2.state::<crate::State>();
|
||||
let listeners = state.protocol_listeners.read().await;
|
||||
@ -59,11 +41,11 @@ pub fn prep_protocol(handle: tauri::AppHandle) -> Result<()> {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
handle
|
||||
handle_inner
|
||||
.typed_emit_all(&Event::ProtocolInvoke(protocol_payload))
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,13 +1,19 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2.0.0",
|
||||
"build": {
|
||||
"beforeBuildCommand": "cd frontend && npm run build",
|
||||
"beforeDevCommand": "cd frontend && npm run dev",
|
||||
"devUrl": "http://localhost:5173",
|
||||
"devUrl": "http://localhost:1420",
|
||||
"frontendDist": "../dist"
|
||||
},
|
||||
"productName": "Outer Wilds Mod Manager",
|
||||
"identifier": "com.bwc9876.owmods-gui",
|
||||
"plugins": {
|
||||
"deep-link": {
|
||||
"desktop": {
|
||||
"schemes": ["owmods"]
|
||||
}
|
||||
},
|
||||
"shell": {
|
||||
"open": "(^https://(www\\.)?(github.com|outerwildsmods.com|paypal.me|patreon.com|buymeacoffee.com|cash.app|ko-fi.com)/)|(^https://(www\\.)?discord.gg/wusTQYbYTc$)"
|
||||
},
|
||||
|
||||
1021
owmods_gui/frontend/package-lock.json
generated
1021
owmods_gui/frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,7 @@
|
||||
"lint-dry": "tsc --noEmit && eslint .",
|
||||
"prettify": "prettier --write . --ignore-unknown",
|
||||
"prettier-check": "prettier --check . --ignore-unknown",
|
||||
"tauri": "tauri"
|
||||
"tauri": "cd ../backend && tauri"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emotion/react": "11.13.0",
|
||||
@ -26,19 +26,19 @@
|
||||
"@mui/icons-material": "5.16.6",
|
||||
"@mui/lab": "5.0.0-alpha.173",
|
||||
"@mui/material": "5.16.6",
|
||||
"@tauri-apps/api": "2.0.0-rc.0",
|
||||
"@tauri-apps/plugin-clipboard-manager": "2.0.0-rc.0",
|
||||
"@tauri-apps/plugin-dialog": "2.0.0-rc.0",
|
||||
"@tauri-apps/plugin-os": "2.0.0-rc.0",
|
||||
"@tauri-apps/plugin-process": "2.0.0-rc.0",
|
||||
"@tauri-apps/plugin-shell": "2.0.0-rc.0",
|
||||
"@tauri-apps/api": "2.0.1",
|
||||
"@tauri-apps/plugin-clipboard-manager": "2.0.0",
|
||||
"@tauri-apps/plugin-dialog": "2.0.0",
|
||||
"@tauri-apps/plugin-os": "2.0.0",
|
||||
"@tauri-apps/plugin-process": "2.0.0",
|
||||
"@tauri-apps/plugin-shell": "2.0.0",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1",
|
||||
"react-error-boundary": "4.0.13",
|
||||
"react-virtuoso": "4.9.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^2.0.0-rc.2",
|
||||
"@tauri-apps/cli": "^2.0.1",
|
||||
"@types/react": "18.3.3",
|
||||
"@types/react-dom": "18.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "7.18.0",
|
||||
|
||||
@ -43,6 +43,6 @@ const FileInput = <T,>(openFunc: (options?: T) => Promise<string | string[] | nu
|
||||
|
||||
export const OpenFileInput = FileInput(async (options?: dialog.OpenDialogOptions) => {
|
||||
const res = await dialog.open(options);
|
||||
return res?.path ?? null;
|
||||
return res ?? null;
|
||||
});
|
||||
export const SaveFileInput = FileInput(dialog.save);
|
||||
|
||||
@ -4,13 +4,24 @@ import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { imagetools } from "vite-imagetools";
|
||||
|
||||
const host = process.env.TAURI_DEV_HOST;
|
||||
|
||||
import path from "path";
|
||||
|
||||
export default defineConfig({
|
||||
publicDir: false,
|
||||
clearScreen: false,
|
||||
server: {
|
||||
port: 1420,
|
||||
strictPort: true,
|
||||
host: host || false,
|
||||
hmr: host
|
||||
? {
|
||||
protocol: "ws",
|
||||
host,
|
||||
port: 1421,
|
||||
}
|
||||
: undefined,
|
||||
watch: {
|
||||
ignored: ["owmods_gui/backend/target/**"]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user