Compare commits

...

3 Commits

Author SHA1 Message Date
Lucas Nogueira
bec484c54a run covector version 2024-06-04 16:55:08 -03:00
Lucas Nogueira
1f06c2d00e fix(core): test invoke key, closes #9960 2024-06-04 16:53:55 -03:00
Lucas Nogueira
6749be08be add publish-hotfix workflow 2024-06-04 16:48:04 -03:00
7 changed files with 70 additions and 4 deletions

48
.github/workflows/publish-hotfix.yml vendored Normal file
View File

@@ -0,0 +1,48 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT
name: version or publish
on:
push:
branches:
- '1.*'
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 65
outputs:
change: ${{ steps.covector.outputs.change }}
commandRan: ${{ steps.covector.outputs.commandRan }}
successfulPublish: ${{ steps.covector.outputs.successfulPublish }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: 14
registry-url: 'https://registry.npmjs.org'
cache: yarn
cache-dependency-path: tooling/*/yarn.lock
- name: cargo login
run: cargo login ${{ secrets.ORG_CRATES_IO_TOKEN }}
- name: git config
run: |
git config --global user.name "${{ github.event.pusher.name }}"
git config --global user.email "${{ github.event.pusher.email }}"
- name: covector version or publish (publish when no change files present)
uses: jbolda/covector/packages/action@covector-v0
id: covector
env:
NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }}
CARGO_AUDIT_OPTIONS: ${{ secrets.CARGO_AUDIT_OPTIONS }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: 'version-or-publish'
createRelease: true

2
Cargo.lock generated
View File

@@ -4021,7 +4021,7 @@ checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f"
[[package]]
name = "tauri"
version = "1.6.7"
version = "1.6.8"
dependencies = [
"anyhow",
"base64 0.21.7",

View File

@@ -1,5 +1,11 @@
# Changelog
## \[1.6.8]
### Bug Fixes
- [`1f06c2d00`](https://www.github.com/tauri-apps/tauri/commit/1f06c2d00eb02b17a8ce450d6f21ef4510b59d91) ([#9960](https://www.github.com/tauri-apps/tauri/pull/9960)) Added `test::INVOKE_KEY` to be used in `tauri::InvokePayload` when testing using `test::assert_ipc_response` and `test::get_ipc_response`.
## \[1.6.7]
### Bug Fixes

View File

@@ -10,7 +10,7 @@ license = "Apache-2.0 OR MIT"
name = "tauri"
readme = "README.md"
repository = "https://github.com/tauri-apps/tauri"
version = "1.6.7"
version = "1.6.8"
[package.metadata.docs.rs]
no-default-features = true

View File

@@ -989,6 +989,9 @@ pub struct Builder<R: Runtime> {
/// The script that initializes the `window.__TAURI_POST_MESSAGE__` function.
invoke_initialization_script: String,
/// Invoke key. Used to secure IPC calls.
pub(crate) invoke_key: String,
/// The setup hook.
setup: SetupHook<R>,
@@ -1047,6 +1050,7 @@ impl<R: Runtime> Builder<R> {
invoke_responder: Arc::new(window_invoke_responder),
invoke_initialization_script:
format!("Object.defineProperty(window, '__TAURI_POST_MESSAGE__', {{ value: (message) => window.ipc.postMessage({}(message)) }})", crate::manager::STRINGIFY_IPC_MESSAGE_FN),
invoke_key: crate::generate_invoke_key().expect("failed to generate invoke key"),
on_page_load: Box::new(|_, _| ()),
pending_windows: Default::default(),
plugins: PluginStore::default(),
@@ -1569,7 +1573,7 @@ impl<R: Runtime> Builder<R> {
self.window_event_listeners,
(self.menu, self.menu_event_listeners),
(self.invoke_responder, self.invoke_initialization_script),
crate::generate_invoke_key()?,
self.invoke_key,
);
let http_scheme = manager.config().tauri.security.dangerous_use_http_scheme;

View File

@@ -50,6 +50,7 @@
//! callback: tauri::api::ipc::CallbackFn(0),
//! error: tauri::api::ipc::CallbackFn(1),
//! inner: serde_json::Value::Null,
//! invoke_key: Some(tauri::test::INVOKE_KEY.into()),
//! },
//! Ok(())
//! );
@@ -85,6 +86,9 @@ use tauri_utils::{
config::{CliConfig, Config, PatternKind, TauriConfig},
};
/// The invoke key used for tests.
pub const INVOKE_KEY: &str = "__invoke-key__";
/// A key for an [`Ipc`] call.
#[derive(Eq, PartialEq)]
struct IpcKey {
@@ -197,6 +201,8 @@ pub fn mock_context<A: Assets>(assets: A) -> crate::Context<A> {
pub fn mock_builder() -> Builder<MockRuntime> {
let mut builder = Builder::<MockRuntime>::new().manage(Ipc(Default::default()));
builder.invoke_key = INVOKE_KEY.to_string();
builder.invoke_responder = Arc::new(|window, response, callback, error| {
let window_ = window.clone();
let ipc = window_.state::<Ipc>();
@@ -250,6 +256,7 @@ pub fn mock_app() -> App<MockRuntime> {
/// callback: tauri::api::ipc::CallbackFn(0),
/// error: tauri::api::ipc::CallbackFn(1),
/// inner: serde_json::Value::Null,
/// invoke_key: Some(tauri::test::INVOKE_KEY.into()),
/// },
/// // the expected response is a success with the "pong" payload
/// // we could also use Err("error message") here to ensure the command failed
@@ -303,6 +310,7 @@ pub fn assert_ipc_response<T: Serialize + Debug>(
/// callback: tauri::api::ipc::CallbackFn(0),
/// error: tauri::api::ipc::CallbackFn(1),
/// inner: serde_json::Value::Null,
/// invoke_key: Some(tauri::test::INVOKE_KEY.into()),
/// });
/// assert_eq!(res, Ok("pong".into()))
/// ```

View File

@@ -3,6 +3,6 @@
"version": "1.5.14",
"node": ">= 10.0.0"
},
"tauri": "1.6.7",
"tauri": "1.6.8",
"tauri-build": "1.5.2"
}