#tauri.conf pls help :)

107 messages · Page 1 of 1 (latest)

subtle trench
#
  "build": {
    "beforeBuildCommand": "",
    "beforeDevCommand": "",
    "devPath": "../dist",
    "distDir": "../dist"
  },
  "package": {
    "productName": "tauri-app",
    "version": "0.1.0"
  },
  "tauri": {
    "allowlist": {
      "all": true
    },
    "bundle": {},
    "security": {
      "csp": null
    },
    "updater": {
      "active": false
    },
    "windows": [
      {
        "fullscreen": false,
        "height": 600,
        "resizable": true,
        "title": "Tauri App",
        "width": 800
      }
    ]
  }
}```
shell geyser
#

@subtle trench

subtle trench
#

my bad

#

thats tauri v1

#

v2

#
  build: {
    devUrl: 'http://localhost:3000',
    // start the dev server
    beforeDevCommand: 'npm run dev',
  },
  bundle: {
    active: true,
    icon: ['icons/app.png'],
  },
  app: {
    windows: [
      {
        title: 'MyApp',
      },
    ],
  },
  plugins: {
    updater: {
      pubkey: 'updater pub key',
      endpoints: ['https://my.app.updater/{{target}}/{{current_version}}'],
    },
  },
}```
shell geyser
#

but where can i enable shell?

#

sry im very new 🙂

subtle trench
#
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "main-capability",
  "description": "Capability for the main window",
  "windows": ["main"],
  "permissions": [
    {
      "identifier": "shell:allow-execute",
      "allow": [
        {
          "name": "exec-sh",
          "cmd": "sh",
          "args": [
            "-c",
            {
              "validator": "\\S+"
            }
          ],
          "sidecar": false
        }
      ]
    }
  ]
}```
#

src-tauri/capabilities/default.json

shell geyser
#

mhhh idk

subtle trench
#

this is mine only thing it highlights is sidecar:

  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "default",
  "description": "enables the default permissions",
  "windows": [
    "main"
  ],
  "permissions": [
    {
      "identifier": "shell:allow-execute",
      "allow": [
        {
          "name": "exec-sh",
          "cmd": "sh",
          "args": [
            "-c",
            {
              "validator": "\\S+"
            }
          ],
          "sidecar": false
        }
      ]
    }
  ]
}
shell geyser
#

still same

subtle trench
#

try running npm run tauri dev

shell geyser
subtle trench
#

npm run tauri add shell

shell geyser
#

found this:

subtle trench
shell geyser
#

ahh yess now i think

subtle trench
#

ok cool

shell geyser
#

this shoudl work now right?

#

thank you very much for your help @subtle trench

subtle trench
#

no worries

shell geyser
#

@subtle trench do you know how i can open links in default browser it doesnt work for me sryyy for asking xDD

subtle trench
#

open from what

#

tauri rust

shell geyser
#

tauri

subtle trench
#

first npm install @tauri-apps/api

shell geyser
#

i have this

#

but it doesnt do anything when i click it

subtle trench
#

are you trying in rust or js

shell geyser
#

rust

#

i guess

#

xD

subtle trench
#

shell.open(url).catch((err) => console.error("Failed to open link:", err));
``` js example
subtle trench
shell geyser
subtle trench
#

did you npm install @tauri-apps/api

shell geyser
#

yess

subtle trench
#

show code snippet where you added window.__TAURI_IPC

shell geyser
#

i dont added it?

subtle trench
#

show handle login click then the function

shell geyser
#

okey

subtle trench
#

which is line 62

shell geyser
#

this shell.open(url).catch((err) => console.error("Failed to open link:", err));

subtle trench
#

is this you tauri version:
[dependencies]
tauri = "2.0"

shell geyser
#

let me look

subtle trench
#

"@tauri-apps/api": "^2.2.0", for npm

#

if not npm install @tauri-apps/api@latest

shell geyser
subtle trench
#

and do cargo update -p tauri

shell geyser
#

yes i did

#

still and also require is not defined

#

look now

subtle trench
#

@tauri-apps/api/shell module removed. Use @tauri-apps/plugin-shell instead. Migration

shell geyser
subtle trench
#

"@tauri-apps/plugin-shell": "^2.2.0",

shell geyser
#

does that work?

subtle trench
#

import { open } from '@tauri-apps/plugin-shell';

#

yep

shell geyser
#

okey i try

subtle trench
#

not shell.pen just opne

#

await open(

shell geyser
#

yes already have

subtle trench
#

my bad for going around in a circle, i got confused with v1 and v2 tauri

shell geyser
#

nono np

subtle trench
#

run npm install

shell geyser
#

no errors

#

maybe becasue of the tauri.conf?

subtle trench
shell geyser
#

look this but i t doesnt work

shell geyser
#

i did 1 to 1

subtle trench
#

ok but tauri.conf that i have:

{
  "$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
  "build": {
    "frontendDist": "../dist",
    "devUrl": "http://localhost:1420",
    "beforeDevCommand": "npm run vue-dev",
    "beforeBuildCommand": "npm run build"
  },
  "app": {
    "windows": [
      {
        "title": "",
        "width": 800,
        "height": 600,
        "resizable": true,
        "fullscreen": false
      }
    ],
    "security": {
      "csp": null
    }
  },
  "bundle": {
    "active": true,
    "targets": "all",
    "externalBin": [
      "../backend/apppy/apppy"
    ],
    "icon": [
      "icons/**/*"
    ],
    "resources": [
      "../backend/apppy/**/*",
      "../backend/requirements.txt"
    ]
  }
}```
shell geyser
#

yes i have same

subtle trench
#

then you should be good

shell geyser
#

yes normaly i think my pc is a ghost or something

subtle trench
#

what are you using to run

#

npm run dev?

#

or npm run tauri dev?

shell geyser
#

yarn tauri dev

#

only this error

subtle trench
#

i reproduced on my side and the only way that is possible is if its outside tauri env

shell geyser
#

mh how can i do that?

subtle trench
#

add tauri-plugin-shell = "2"
in cargo.toml

#

was it there before?

shell geyser
#

yes but 2.2.0

subtle trench
#

try // Ensure Tauri environment

  await open('https://github.com/tauri-apps/tauri');
} else {
  console.error('Not running in a Tauri environment');
}```
shell geyser
subtle trench
#

__

shell geyser
#

sryyyy my pc is retarted or i am xD

subtle trench
#

instead of shell:allow-execute use shell:allow-open

shell geyser
#

okeyy

#

you dont need to help me you have halped m,e for so long xDD