Skip to content

Commit

Permalink
Merge branch 'dev' into actions_checkout_v4
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Sep 9, 2023
2 parents 5154bcf + a6a42f8 commit f5ae9e6
Show file tree
Hide file tree
Showing 37 changed files with 120 additions and 52 deletions.
8 changes: 8 additions & 0 deletions .changes/fix-windows-custom-protocol-url.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"tauri": patch:breaking
"@tauri-apps/api": patch:breaking
"@tauri-apps/cli": patch:breaking
"tauri-cli": patch:breaking
---

The custom protocol on Windows now uses the `http` scheme instead of `https`.
2 changes: 2 additions & 0 deletions .changes/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
".changes/fix-shell-build.md",
".changes/fix-tauri-binary-windows.md",
".changes/fix-tray-icon-validation.md",
".changes/fix-windows-custom-protocol-url.md",
".changes/fix-xcodescript-lib-path.md",
".changes/force-colored-logs.md",
".changes/generate-tauri-activity.md",
Expand Down Expand Up @@ -135,6 +136,7 @@
".changes/mobile-plugins.md",
".changes/mobile-webview-access.md",
".changes/mobile.md",
".changes/move-add-command.md",
".changes/move-app.md",
".changes/move-cli.md",
".changes/move-dialog-plugin.md",
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ jobs:
# The --precise flag can only be used once per invocation.
run: |
cargo update -p time --precise 0.3.23
cargo update -p toml@0.7.7 --precise 0.7.6
cargo update -p toml_edit@0.19.15 --precise 0.19.14
cargo update -p cfg-expr@0.15.5 --precise 0.15.4
- name: test
uses: actions-rs/cargo@v1
Expand Down
6 changes: 6 additions & 0 deletions core/tauri/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## \[2.0.0-alpha.13]

### Breaking Changes

- [`4cb51a2d`](https://www.github.com/tauri-apps/tauri/commit/4cb51a2d56cfcae0749062c79ede5236bd8c02c2)([#7779](https://www.github.com/tauri-apps/tauri/pull/7779)) The custom protocol on Windows now uses the `http` scheme instead of `https`.

## \[2.0.0-alpha.12]

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion core/tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tauri"
version = "2.0.0-alpha.12"
version = "2.0.0-alpha.13"
description = "Make tiny, secure apps for all desktop platforms with Tauri"
exclude = [ "/test", "/.scripts", "CHANGELOG.md", "/target" ]
readme = "README.md"
Expand Down
10 changes: 7 additions & 3 deletions core/tauri/scripts/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@

window.__TAURI__.convertFileSrc = function convertFileSrc(filePath, protocol = 'asset') {
const path = encodeURIComponent(filePath)
return osName === 'windows' || osName === 'android'
? `https://${protocol}.localhost/${path}`
: `${protocol}://localhost/${path}`
return osName === 'windows'
? `http://${protocol}.localhost/${path}`
: (
osName === 'android'
? `https://${protocol}.localhost/${path}`
: `${protocol}://localhost/${path}`
)
}

window.__TAURI__.transformCallback = function transformCallback(
Expand Down
18 changes: 14 additions & 4 deletions core/tauri/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,13 @@ impl<R: Runtime> WindowManager<R> {
}

pub(crate) fn protocol_url(&self) -> Cow<'_, Url> {
#[cfg(any(windows, target_os = "android"))]
return Cow::Owned(Url::parse("https://tauri.localhost").unwrap());
#[cfg(not(any(windows, target_os = "android")))]
Cow::Owned(Url::parse("tauri://localhost").unwrap())
if cfg!(windows) {
Cow::Owned(Url::parse("http://tauri.localhost").unwrap())
} else if cfg!(target_os = "android") {
Cow::Owned(Url::parse("https://tauri.localhost").unwrap())
} else {
Cow::Owned(Url::parse("tauri://localhost").unwrap())
}
}

fn csp(&self) -> Option<Csp> {
Expand Down Expand Up @@ -612,6 +615,11 @@ impl<R: Runtime> WindowManager<R> {
let window_origin = if window_url.scheme() == "data" {
"null".into()
} else if cfg!(windows) && window_url.scheme() != "http" && window_url.scheme() != "https" {
format!("http://{}.localhost", window_url.scheme())
} else if cfg!(target_os = "android")
&& window_url.scheme() != "http"
&& window_url.scheme() != "https"
{
format!("https://{}.localhost", window_url.scheme())
} else {
format!(
Expand Down Expand Up @@ -876,6 +884,8 @@ mod test {
assert_eq!(
manager.get_url().to_string(),
if cfg!(windows) {
"http://tauri.localhost/"
} else if cfg!(target_os = "android") {
"https://tauri.localhost/"
} else {
"tauri://localhost"
Expand Down
4 changes: 3 additions & 1 deletion core/tauri/src/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ pub(crate) struct PatternJavascript {

#[allow(dead_code)]
pub(crate) fn format_real_schema(schema: &str) -> String {
if cfg!(windows) || cfg!(target_os = "android") {
if cfg!(windows) {
format!("http://{schema}.{ISOLATION_IFRAME_SRC_DOMAIN}")
} else if cfg!(target_os = "android") {
format!("https://{schema}.{ISOLATION_IFRAME_SRC_DOMAIN}")
} else {
format!("{schema}://{ISOLATION_IFRAME_SRC_DOMAIN}")
Expand Down
2 changes: 1 addition & 1 deletion core/tauri/test/fixture/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
],
"security": {
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: https://ipc.localhost"
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: http://ipc.localhost https://ipc.localhost"
}
}
}
6 changes: 3 additions & 3 deletions examples/api/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions examples/api/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@
"security": {
"csp": {
"default-src": "'self' customprotocol: asset:",
"connect-src": "ipc: https://ipc.localhost",
"connect-src": "ipc: http://ipc.localhost https://ipc.localhost",
"font-src": [
"https://fonts.gstatic.com"
],
"img-src": "'self' asset: https://asset.localhost blob: data:",
"img-src": "'self' asset: http://asset.localhost https://asset.localhost blob: data:",
"style-src": "'unsafe-inline' 'self' https://fonts.googleapis.com"
},
"freezePrototype": true,
Expand All @@ -114,4 +114,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion examples/commands/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
}
],
"security": {
"csp": "default-src 'self'; connect-src ipc: https://ipc.localhost"
"csp": "default-src 'self'; connect-src ipc: http://ipc.localhost https://ipc.localhost"
}
}
}
2 changes: 1 addition & 1 deletion examples/helloworld/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
}
],
"security": {
"csp": "default-src 'self'; connect-src ipc: https://ipc.localhost"
"csp": "default-src 'self'; connect-src ipc: http://ipc.localhost https://ipc.localhost"
}
}
}
2 changes: 1 addition & 1 deletion examples/isolation/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
}
],
"security": {
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'; connect-src ipc: https://ipc.localhost"
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'; connect-src ipc: http://ipc.localhost https://ipc.localhost"
}
}
}
2 changes: 1 addition & 1 deletion examples/multiwindow/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
}
],
"security": {
"csp": "default-src 'self'; connect-src ipc: https://ipc.localhost"
"csp": "default-src 'self'; connect-src ipc: http://ipc.localhost https://ipc.localhost"
}
}
}
2 changes: 1 addition & 1 deletion examples/navigation/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
}
],
"security": {
"csp": "default-src 'self'; connect-src ipc: https://ipc.localhost"
"csp": "default-src 'self'; connect-src ipc: http://ipc.localhost https://ipc.localhost"
}
}
}
2 changes: 1 addition & 1 deletion examples/parent-window/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"category": "DeveloperTool"
},
"security": {
"csp": "default-src 'self'; connect-src ipc: https://ipc.localhost"
"csp": "default-src 'self'; connect-src ipc: http://ipc.localhost https://ipc.localhost"
}
}
}
2 changes: 1 addition & 1 deletion examples/resources/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
}
],
"security": {
"csp": "default-src 'self'; connect-src ipc: https://ipc.localhost"
"csp": "default-src 'self'; connect-src ipc: http://ipc.localhost https://ipc.localhost"
}
}
}
2 changes: 1 addition & 1 deletion examples/splashscreen/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
}
],
"security": {
"csp": "default-src 'self'; connect-src ipc: https://ipc.localhost"
"csp": "default-src 'self'; connect-src ipc: http://ipc.localhost https://ipc.localhost"
}
}
}
2 changes: 1 addition & 1 deletion examples/state/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
}
],
"security": {
"csp": "default-src 'self'; connect-src ipc: https://ipc.localhost"
"csp": "default-src 'self'; connect-src ipc: http://ipc.localhost https://ipc.localhost"
}
}
}
16 changes: 11 additions & 5 deletions examples/streaming/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"$schema": "../../core/tauri-config-schema/schema.json",
"build": {
"distDir": ["index.html"],
"devPath": ["index.html"],
"distDir": [
"index.html"
],
"devPath": [
"index.html"
],
"beforeDevCommand": "",
"beforeBuildCommand": "",
"withGlobalTauri": true
Expand Down Expand Up @@ -47,10 +51,12 @@
}
],
"security": {
"csp": "default-src 'self' ipc:; media-src stream: https://stream.localhost asset: https://asset.localhost",
"csp": "default-src 'self' ipc:; media-src stream: http://stream.localhost https://stream.localhost asset: http://asset.localhost https://asset.localhost",
"assetProtocol": {
"scope": ["**/test_video.mp4"]
"scope": [
"**/test_video.mp4"
]
}
}
}
}
}
2 changes: 1 addition & 1 deletion examples/tauri-dynamic-lib/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
}
],
"security": {
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: https://ipc.localhost"
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: http://ipc.localhost https://ipc.localhost"
}
}
}
6 changes: 6 additions & 0 deletions tooling/api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## \[2.0.0-alpha.7]

### Breaking Changes

- [`4cb51a2d`](https://www.github.com/tauri-apps/tauri/commit/4cb51a2d56cfcae0749062c79ede5236bd8c02c2)([#7779](https://www.github.com/tauri-apps/tauri/pull/7779)) The custom protocol on Windows now uses the `http` scheme instead of `https`.

## \[2.0.0-alpha.6]

### New Features
Expand Down
2 changes: 1 addition & 1 deletion tooling/api/docs/js-api.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tooling/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tauri-apps/api",
"version": "2.0.0-alpha.6",
"version": "2.0.0-alpha.7",
"description": "Tauri API definitions",
"type": "module",
"funding": {
Expand Down
4 changes: 2 additions & 2 deletions tooling/api/src/tauri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ async function invoke<T>(

/**
* Convert a device file path to an URL that can be loaded by the webview.
* Note that `asset:` and `https://asset.localhost` must be added to [`tauri.security.csp`](https://tauri.app/v1/api/config/#securityconfig.csp) in `tauri.conf.json`.
* Example CSP value: `"csp": "default-src 'self' ipc: https://ipc.localhost; img-src 'self' asset: https://asset.localhost"` to use the asset protocol on image sources.
* Note that `asset:`, `http://asset.localhost` and `https://asset.localhost` must be added to [`tauri.security.csp`](https://tauri.app/v1/api/config/#securityconfig.csp) in `tauri.conf.json`.
* Example CSP value: `"csp": "default-src 'self' ipc: http://ipc.localhost https://ipc.localhost; img-src 'self' asset: http://asset.localhost https://asset.localhost"` to use the asset protocol on image sources.
*
* Additionally, `asset` must be added to [`tauri.allowlist.protocol`](https://tauri.app/v1/api/config/#allowlistconfig.protocol)
* in `tauri.conf.json` and its access scope must be defined on the `assetScope` array on the same `protocol` object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}
],
"security": {
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: https://ipc.localhost"
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: http://ipc.localhost https://ipc.localhost"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}
],
"security": {
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: https://ipc.localhost"
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: http://ipc.localhost https://ipc.localhost"
}
}
}
2 changes: 1 addition & 1 deletion tooling/bench/tests/helloworld/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
}
],
"security": {
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: https://ipc.localhost"
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; connect-src ipc: http://ipc.localhost https://ipc.localhost"
}
}
}
7 changes: 7 additions & 0 deletions tooling/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## \[2.0.0-alpha.13]

### Breaking Changes

- [`4cb51a2d`](https://www.github.com/tauri-apps/tauri/commit/4cb51a2d56cfcae0749062c79ede5236bd8c02c2)([#7779](https://www.github.com/tauri-apps/tauri/pull/7779)) The custom protocol on Windows now uses the `http` scheme instead of `https`.
- [`974e38b4`](https://www.github.com/tauri-apps/tauri/commit/974e38b4ddc198530aa977ec77d513b76013b9f3)([#7744](https://www.github.com/tauri-apps/tauri/pull/7744)) Renamed the `plugin add` command to `add`.

## \[2.0.0-alpha.12]

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion tooling/cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f5ae9e6

Please sign in to comment.