[ENG-683] Fix tauri allow list (#897)

* Fix Tauri drag not working
 - Fix Mpeg videos compleatly breaking QuickPreview
 - Fix Dev build open data folder button not working
 - Fix MP4 videos freezing in QuickPreview on MacOS

* Fix React inter-component state error
This commit is contained in:
Vítor Vasconcellos 2023-06-02 00:09:19 +00:00 committed by GitHub
parent 9584dbd924
commit 350b7e39db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 79 additions and 8 deletions

41
Cargo.lock generated
View file

@ -5028,6 +5028,16 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "open"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2078c0039e6a54a0c42c28faa984e115fb4c2d5bf2208f77d1961002df8576f8"
dependencies = [
"pathdiff",
"windows-sys 0.42.0",
]
[[package]]
name = "opener"
version = "0.6.1"
@ -5141,6 +5151,16 @@ dependencies = [
"winapi",
]
[[package]]
name = "os_pipe"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ae859aa07428ca9a929b936690f8b12dc5f11dd8c6992a18ca93919f28bc177"
dependencies = [
"libc",
"windows-sys 0.48.0",
]
[[package]]
name = "overload"
version = "0.1.1"
@ -5287,6 +5307,12 @@ version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79"
[[package]]
name = "pathdiff"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
[[package]]
name = "peeking_take_while"
version = "0.1.2"
@ -7369,6 +7395,16 @@ dependencies = [
"lazy_static",
]
[[package]]
name = "shared_child"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0d94659ad3c2137fef23ae75b03d5241d633f8acded53d672decfa0e6e0caef"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "shlex"
version = "1.1.0"
@ -8015,16 +8051,20 @@ dependencies = [
"minisign-verify",
"objc",
"once_cell",
"open",
"os_info",
"os_pipe",
"percent-encoding",
"rand 0.8.5",
"raw-window-handle",
"regex",
"rfd",
"semver",
"serde",
"serde_json",
"serde_repr",
"serialize-to-javascript",
"shared_child",
"state",
"tar",
"tauri-macros",
@ -8075,6 +8115,7 @@ dependencies = [
"png",
"proc-macro2",
"quote",
"regex",
"semver",
"serde",
"serde_json",

View file

@ -9,7 +9,16 @@ repository.workspace = true
edition.workspace = true
[dependencies]
tauri = { version = "1.3.0", features = ["dialog-all", "linux-protocol-headers", "macos-private-api", "os-all"] }
tauri = { version = "1.3.0", features = [
"dialog-all",
"linux-protocol-headers",
"macos-private-api",
"os-all",
"path-all",
"protocol-all",
"shell-all",
"window-all",
] }
rspc = { workspace = true, features = ["tauri"] }
httpz = { workspace = true, features = [
"axum",

View file

@ -58,7 +58,17 @@
},
"allowlist": {
"all": false,
"window": {
"all": true
},
"path": {
"all": true
},
"shell": {
"all": true
},
"protocol": {
"all": true,
"assetScope": ["*"]
},
"os": {

View file

@ -13,7 +13,7 @@ use std::{
sync::Arc,
};
#[cfg(not(target_os = "linux"))]
#[cfg(windows)]
use std::cmp::min;
use http_range::HttpRange;
@ -232,12 +232,16 @@ async fn handle_file(
"avi" => "video/x-msvideo",
// MP4 video
"mp4" | "m4v" => "video/mp4",
#[cfg(not(target_os = "macos"))]
// FIX-ME: This media types break macOS video rendering
// MPEG transport stream
"ts" => "video/mp2t",
#[cfg(not(target_os = "macos"))]
// FIX-ME: This media types break macOS video rendering
// MPEG Video
"mpeg" => "video/mpeg",
// OGG video
"ogv" => "video/ogg",
// MPEG transport stream
"ts" => "video/mp2t",
// WEBM video
"webm" => "video/webm",
// 3GPP audio/video container (TODO: audio/3gpp if it doesn't contain video)
@ -319,7 +323,8 @@ async fn handle_file(
// TODO: For some reason webkit2gtk doesn't like this at all.
// It causes it to only stream random pieces of any given audio file.
#[cfg(not(target_os = "linux"))]
// TODO: This causes macOS to freeze streaming mp4
#[cfg(windows)]
// prevent max_length;
// specially on webview2
if mime_type != "application/pdf" && range.length > file_size / 3 {

View file

@ -1,7 +1,7 @@
import clsx from 'clsx';
import { Trash } from 'phosphor-react';
import { Info } from 'phosphor-react';
import { ChangeEvent, useId } from 'react';
import { ChangeEvent, useEffect, useId } from 'react';
import { useCallback } from 'react';
import { createPortal } from 'react-dom';
import { Controller, FormProvider, useFieldArray } from 'react-hook-form';
@ -121,7 +121,9 @@ const RulesForm = ({ onSubmitted }: Props) => {
}
});
if (form.formState.isSubmitSuccessful) onSubmitted?.();
useEffect(() => {
if (form.formState.isSubmitSuccessful) onSubmitted?.();
}, [form.formState.isSubmitSuccessful, onSubmitted]);
return (
// The portal is required for Form because this component can be nested inside another form element

View file

@ -1,4 +1,8 @@
lockfileVersion: '6.0'
lockfileVersion: '6.1'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
overrides:
'@radix-ui/react-dismissable-layer': 1.0.2