403 in tauri v2 where use assetProtocol #13254
-
First of all, I apologize for my possible ignorance I'm currently using tauri v2 + vue and need images that allow users to customize the front end after packaging But I found that using http://asset.localhost in css results in 403 and using asset:// results in ERR_UNKNOWN_URL_SCHEME How can I use it normally? This is my resource directory info: tauri.conf.json: {
"$schema": "https://schema.tauri.app/config/2",
"version": "0.1.0",
"build": {
"beforeDevCommand": "yarn dev",
"devUrl": "http://localhost:1420",
"beforeBuildCommand": "yarn build",
"frontendDist": "../dist"
},
"app": {
"windows": [
{
"title": "voyan-photo",
"width": 405,
"height": 720
}
],
"security": {
"csp": {
"default-src": "'self' customprotocol: asset: http://asset.localhost",
"connect-src": "ipc: http://ipc.localhost",
"font-src": ["https://fonts.gstatic.com"],
"img-src": "'self' asset: http://asset.localhost blob: data:",
"style-src": "'unsafe-inline' 'self' asset: http://asset.localhost"
},
"assetProtocol": {
"enable": true,
"scope": [
"resources/images/**"
]
}
}
},
"bundle": {
"active": true,
"targets": "all",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/[email protected]",
"icons/icon.icns",
"icons/icon.ico"
],
"windows": {
"webviewInstallMode": {
"type": "offlineInstaller"
}
},
"resources": [
"resources/images/*",
"resources/images/**/*"
]
}
}
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
that's always an incorrect scope config. try
|
Beta Was this translation helpful? Give feedback.
that's always an incorrect scope config. try
"resources/images/**/*"
instead.asset://
is macos/linux -http://asset.localhost
is windows (that's also why convertFileSrc exists so that you don't have to worry about it).