Giter Site home page Giter Site logo

tauri-invoke-http's People

Contributors

fabianlars avatar lucasfernog avatar renovate[bot] avatar tillmann-crabnebula avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tauri-invoke-http's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • chore(deps): update actions/setup-node action to v4

Detected dependencies

cargo
Cargo.toml
  • tauri 1
  • tiny_http 0.12
  • portpicker 0.1
  • serde_json 1.0
github-actions
.github/workflows/audit.yml
  • actions/checkout v4
  • rustsec/audit-check v1
.github/workflows/covector-status.yml
  • actions/checkout v4
.github/workflows/covector-version-or-publish.yml
  • actions/checkout v4
  • actions/setup-node v3
  • tauri-apps/create-pull-request v3
.github/workflows/format.yml
  • actions/checkout v4
.github/workflows/lint.yml
  • actions/checkout v4
  • Swatinem/rust-cache v2
.github/workflows/test.yml
  • actions/checkout v4
  • Swatinem/rust-cache v2

  • Check this box to trigger a request for Renovate to run again on this repository

RUSTSEC-2021-0139: ansi_term is Unmaintained

ansi_term is Unmaintained

Details
Status unmaintained
Package ansi_term
Version 0.12.1
URL ogham/rust-ansi-term#72
Date 2021-08-18

The maintainer has adviced this crate is deprecated and will not
receive any maintenance.

The crate does not seem to have much dependencies and may or may not be ok to use as-is.

Last release seems to have been three years ago.

Possible Alternative(s)

The below list has not been vetted in any way and may or may not contain alternatives;

See advisory page for additional details.

cors

Access to XMLHttpRequest at 'http://localhost:23486/main' from origin 'http://localhost:1420' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Tauri 2.0 support?

Basically this crate is not compatible with tauri 2.0
I tried to fix what I could in my fork, but I am not qualified enough to migrate this crate to 2.0 fully.
Please help

RUSTSEC-2022-0048: xml-rs is Unmaintained

xml-rs is Unmaintained

Details
Status unmaintained
Package xml-rs
Version 0.8.4
URL https://github.com/netvl/xml-rs/issues
Date 2022-01-26

xml-rs is a XML parser has open issues around parsing including integer
overflows / panics that may or may not be an issue with untrusted data.

Together with these open issues with Unmaintained status xml-rs
may or may not be suited to parse untrusted data.

Alternatives

See advisory page for additional details.

Removed custom-protocol feature but tauri://localhost is still used

Context

I recently opened this discussion.
It sounded like this could fix my issues, since in my case I want the requests to have as Origin http://localhost.

What I tried

In my Cargo.toml, I removed the custom-protocol from the default features.

Before:

[features]
default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ]

After:

[features]
default = [ ]
custom-protocol = [ "tauri/custom-protocol" ]

And I have included the dependency as follows (also tried with branch release):

[dependencies]
tauri-invoke-http = { git = "https://github.com/tauri-apps/tauri-invoke-http", branch = "dev" }

But when I run npm run tauri build, the requests still have tauri://localhost as their Origin.
Am I doing something wrong?
Do I need to build with a specific flag?

I couldn't get it to work.

Cool idea. I couldn't get it to work.

Could you help?

Error: Couldn't connect to server

Can't shake hands

Thanks for listening

Tauri config

{
	"$schema": "../node_modules/@tauri-apps/cli/schema.json",
	"build": {
		"beforeBuildCommand": "npm run build",
		"beforeDevCommand": "npm run dev",
		"devPath": "http://localhost:3000",
		"distDir": "../.output/public",
		"withGlobalTauri": true
	},
	"package": {
		"productName": "royal",
		"version": "0.1.0"
	},
	"tauri": {
		"allowlist": {
			"all": true
		},
		"bundle": {
			"active": true,
			"category": "DeveloperTool",
			"copyright": "",
			"deb": {
				"depends": []
			},
			"externalBin": [],
			"icon": [
				"icons/32x32.png",
				"icons/128x128.png",
				"icons/[email protected]",
				"icons/icon.icns",
				"icons/icon.ico"
			],
			"identifier": "royal.custom.bundleid",
			"longDescription": "",
			"macOS": {
				"entitlements": null,
				"exceptionDomain": "",
				"frameworks": [],
				"providerShortName": null,
				"signingIdentity": null
			},
			"resources": [],
			"shortDescription": "",
			"targets": "all",
			"windows": {
				"certificateThumbprint": null,
				"digestAlgorithm": "sha256",
				"timestampUrl": ""
			}
		},
		"security": {
			"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
		},
		"updater": {
			"active": false
		},
		"windows": [
			{
				"fullscreen": false,
				"height": 600,
				"resizable": true,
				"title": "Royal",
				"width": 800
			}
		]
	}
}

Cargo

[package]
name = "app"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
default-run = "app"
edition = "2021"
rust-version = "1.62.1"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[build-dependencies]
tauri-build = { version = "1.0.4", features = [] }

[dependencies]
serde_json = "1.0"
tauri-invoke-http = { git = "https://github.com/tauri-apps/tauri-invoke-http", branch = "dev" }
serde = { version = "1.0.140", features = ["derive"] }
tauri = { version = "1.0.5", features = ["api-all"] }

[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = [ "custom-protocol" ]
# this feature is used used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = [ "tauri/custom-protocol" ]

Main

#![cfg_attr(
	all(not(debug_assertions), target_os = "windows"),
	windows_subsystem = "windows"
)]

#[tauri::command]
fn my_command(args: u64) -> Result<String, ()> {
	println!("executed command with args {:?}", args);
	Ok("executed".into())
}

fn main() {
	let http = tauri_invoke_http::Invoke::new(["tauri://localhost", "http://localhost:8080"]);

	tauri::Builder::default()
		.invoke_system(http.initialization_script(), http.responder())
		.setup(move |app| {
			http.start(app.handle());
			Ok(())
		})
		.invoke_handler(tauri::generate_handler![my_command])
		.run(tauri::generate_context!())
		.expect("error while running tauri application");
}

javascript

<script setup>
import { invoke } from '@tauri-apps/api/tauri'

invoke('my_command', { args: 5 }).then(data => {
  console.log(data)
}).catch(error => {
  console.log(error)
})
</script>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.