666
This commit is contained in:
@@ -1,3 +1,58 @@
|
||||
const APP_COMMANDS: &[&str] = &[
|
||||
"api_request",
|
||||
"get_software_info",
|
||||
"sync_auth_session",
|
||||
"get_app_config",
|
||||
"get_app_config_last_message",
|
||||
"get_server_app_config",
|
||||
"get_app_config_detail",
|
||||
"list_local_app_config",
|
||||
"set_local_app_config",
|
||||
"delete_local_app_config",
|
||||
"run_quickjs_script",
|
||||
"run_quickjs_script_source",
|
||||
"list_quickjs_scripts",
|
||||
"run_nodejs_script",
|
||||
"run_nodejs_script_source",
|
||||
"list_nodejs_scripts",
|
||||
"read_local_file_base64",
|
||||
"get_media_duration_seconds",
|
||||
"copy_local_file",
|
||||
"write_local_text_file",
|
||||
"reveal_local_file_in_folder",
|
||||
"list_avatars",
|
||||
"insert_avatar",
|
||||
"update_avatar_name",
|
||||
"delete_avatar",
|
||||
"avatar_name_exists",
|
||||
"import_avatar_video",
|
||||
"list_materials",
|
||||
"update_material_name",
|
||||
"delete_material",
|
||||
"import_material_files",
|
||||
"update_generated_audio_name",
|
||||
"list_asr_history",
|
||||
"delete_asr_history",
|
||||
"update_asr_history_name",
|
||||
"transcribe_media_file",
|
||||
"list_generated_audios",
|
||||
"insert_generated_audio",
|
||||
"delete_generated_audio",
|
||||
"list_generated_videos",
|
||||
"insert_generated_video",
|
||||
"import_generated_video",
|
||||
"delete_generated_video",
|
||||
"publish_list_accounts",
|
||||
"publish_login",
|
||||
"publish_check_login",
|
||||
"publish_execute",
|
||||
"publish_delete_account",
|
||||
];
|
||||
|
||||
fn main() {
|
||||
tauri_build::build()
|
||||
tauri_build::try_build(
|
||||
tauri_build::Attributes::new()
|
||||
.app_manifest(tauri_build::AppManifest::new().commands(APP_COMMANDS)),
|
||||
)
|
||||
.expect("failed to run tauri build script");
|
||||
}
|
||||
|
||||
@@ -1,9 +1,21 @@
|
||||
{
|
||||
"$schema": "../gen/schemas/desktop-schema.json",
|
||||
"identifier": "default",
|
||||
"description": "Capability for the main window",
|
||||
"windows": ["main"],
|
||||
"description": "Capability for the main window (local dev + remote production frontend)",
|
||||
"local": true,
|
||||
"remote": {
|
||||
"urls": [
|
||||
"http://localhost:1420/*",
|
||||
"http://127.0.0.1:1420/*",
|
||||
"http://81.71.163.140/*",
|
||||
"http://81.71.163.140:8001/*"
|
||||
]
|
||||
},
|
||||
"windows": ["*"],
|
||||
"permissions": [
|
||||
"default",
|
||||
"allow-api-request",
|
||||
"allow-sync-auth-session",
|
||||
"core:default",
|
||||
"core:window:default",
|
||||
"core:window:allow-start-dragging",
|
||||
@@ -17,6 +29,8 @@
|
||||
"core:event:default",
|
||||
"core:event:allow-listen",
|
||||
"core:event:allow-unlisten",
|
||||
"core:event:allow-emit",
|
||||
"core:event:allow-emit-to",
|
||||
"opener:default",
|
||||
"dialog:default"
|
||||
]
|
||||
|
||||
52
src-tauri/permissions/default.toml
Normal file
52
src-tauri/permissions/default.toml
Normal file
@@ -0,0 +1,52 @@
|
||||
[default]
|
||||
description = "主窗口可调用的应用自定义 IPC 命令"
|
||||
permissions = [
|
||||
"allow-api-request",
|
||||
"allow-get-software-info",
|
||||
"allow-sync-auth-session",
|
||||
"allow-get-app-config",
|
||||
"allow-get-app-config-last-message",
|
||||
"allow-get-server-app-config",
|
||||
"allow-get-app-config-detail",
|
||||
"allow-list-local-app-config",
|
||||
"allow-set-local-app-config",
|
||||
"allow-delete-local-app-config",
|
||||
"allow-run-quickjs-script",
|
||||
"allow-run-quickjs-script-source",
|
||||
"allow-list-quickjs-scripts",
|
||||
"allow-run-nodejs-script",
|
||||
"allow-run-nodejs-script-source",
|
||||
"allow-list-nodejs-scripts",
|
||||
"allow-read-local-file-base64",
|
||||
"allow-get-media-duration-seconds",
|
||||
"allow-copy-local-file",
|
||||
"allow-write-local-text-file",
|
||||
"allow-reveal-local-file-in-folder",
|
||||
"allow-list-avatars",
|
||||
"allow-insert-avatar",
|
||||
"allow-update-avatar-name",
|
||||
"allow-delete-avatar",
|
||||
"allow-avatar-name-exists",
|
||||
"allow-import-avatar-video",
|
||||
"allow-list-materials",
|
||||
"allow-update-material-name",
|
||||
"allow-delete-material",
|
||||
"allow-import-material-files",
|
||||
"allow-update-generated-audio-name",
|
||||
"allow-list-asr-history",
|
||||
"allow-delete-asr-history",
|
||||
"allow-update-asr-history-name",
|
||||
"allow-transcribe-media-file",
|
||||
"allow-list-generated-audios",
|
||||
"allow-insert-generated-audio",
|
||||
"allow-delete-generated-audio",
|
||||
"allow-list-generated-videos",
|
||||
"allow-insert-generated-video",
|
||||
"allow-import-generated-video",
|
||||
"allow-delete-generated-video",
|
||||
"allow-publish-list-accounts",
|
||||
"allow-publish-login",
|
||||
"allow-publish-check-login",
|
||||
"allow-publish-execute",
|
||||
"allow-publish-delete-account",
|
||||
]
|
||||
@@ -172,3 +172,30 @@ pub fn run() {
|
||||
}
|
||||
});
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod acl_url_tests {
|
||||
use std::str::FromStr;
|
||||
|
||||
use tauri::utils::acl::RemoteUrlPattern;
|
||||
|
||||
#[test]
|
||||
fn production_origin_matches_remote_patterns() {
|
||||
let url: url::Url = "http://81.71.163.140/images/newyaoyan/index.html"
|
||||
.parse()
|
||||
.expect("valid url");
|
||||
|
||||
for pattern in [
|
||||
"http://81.71.163.140/*",
|
||||
"http://81.71.163.140:8001/*",
|
||||
"http://81.71.163.140/images/newyaoyan/*",
|
||||
"http://81.71.163.140/images/newyaoyan/index.html",
|
||||
] {
|
||||
let parsed = RemoteUrlPattern::from_str(pattern)
|
||||
.unwrap_or_else(|e| panic!("failed to parse {pattern}: {e}"));
|
||||
assert!(
|
||||
parsed.test(&url),
|
||||
"pattern {pattern} should match production origin"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
],
|
||||
"security": {
|
||||
"capabilities": ["default"],
|
||||
"csp": null,
|
||||
"assetProtocol": {
|
||||
"enable": true,
|
||||
|
||||
Reference in New Issue
Block a user