mirror of
https://github.com/kunkunsh/kunkun.git
synced 2025-04-04 14:46:42 +00:00

* feat: implement a file streamer for file share Only server with hardcoded file path * bump valibot version * feat: add server-info gRPC module to serve server info * feat: add ssl cert and public key to peers state When peer is online, KK always have know its cert and pub key for future secure communication * feat: add grpc ts package * Enable "/refresh-worker-extension" rest API, grpc version isn't ready yet * update pnpm lock * ci: fix CI by moving protobuf install order * ci: fix * upgrade api due to valibot incompatibility * fix: use fs instead of bun shell to be compatible with windows * skip grpc pkg build on windows * feat: local network file transfer prototype working * fix: grpc build.ts * download next to 14 * ci: add ci env try to fix next * fix: hideRefreshBtn and a few other btns' hide API in iframe ext page * feat: disable NODE_TLS_REJECT_UNAUTHORIZED for extension HMR refresh * fix: manifest json schema with objectWithRest to allow any other fields in package.json * chore: update valibot and related dependencies to version 1.0.0-beta.9 in pnpm-lock.yaml * ci: add protobuf compiler installation to manifest-schema-upload workflow * refactor: move grpc code from jarvis to a separate grpc crate for easier testing * feat(file-transfer): POC multi file + directory file transfer * feat(file-transfer): replace file transfer recursive download in ts with rust * feat(file-transfer): implement on_progress event for file transfer * feat(file-transfer): report progress every 1MB instead of 100 iterations * feat(file-transfer): add progress bar * feat(file-transfer): UI * feat(file-transfer): add file transfer bucket info preview Show total size and number of files * feat(file-transfer): improve UX Show bucket info during confirm; improve progress bar UI, prevent inconsistent width * feat(grpc): skip build in Cloudflare Pages due to missing protoc * refactor: with cargo fix, unused imports removed * ci: debug cloudflare pages env var * fix(grpc): update environment variable access for Cloudflare Pages build check * fix(grpc): add error handling for protoc command in build script * chore: update kkrpc version to 0.0.13, remove kkrpc submodule, and enhance grpc build script logging - Updated kkrpc dependency version from 0.0.12 to 0.0.13 in package.json. - Removed the kkrpc submodule from the project. - Enhanced logging in the grpc build script to include additional Cloudflare Pages environment variables for better debugging. * fix(api): typescript error, remove base.json from tsconfig * chore: update pnpm lock * fix(api): update TypeScript configuration to extend base.json and clean up unused options * refactor(api): update TypeScript configuration to extend path-alias.json and enhance compiler options * fix(api): restore KunkunManifestPermission in PermissionUnion and update valibot import in schema tests * fix: missing trait error * fix: js require replaced with import * test: fix a unit test with a more robust method --------- Co-authored-by: Huakun Shen <huaukun.shen@huakunshen.com>
172 lines
6.0 KiB
Rust
172 lines
6.0 KiB
Rust
use base64::prelude::*;
|
|
|
|
const COMMANDS: &[&str] = &[
|
|
"open_devtools",
|
|
"close_devtools",
|
|
"is_devtools_open",
|
|
"toggle_devtools",
|
|
"app_is_dev",
|
|
"open_trash",
|
|
"empty_trash",
|
|
"shutdown",
|
|
"reboot",
|
|
"sleep",
|
|
"toggle_system_appearance",
|
|
"show_desktop",
|
|
"quit_all_apps",
|
|
"sleep_displays",
|
|
"set_volume",
|
|
"turn_volume_up",
|
|
"turn_volume_down",
|
|
"toggle_stage_manager",
|
|
"toggle_bluetooth",
|
|
"toggle_hidden_files",
|
|
"eject_all_disks",
|
|
"logout_user",
|
|
"toggle_mute",
|
|
"mute",
|
|
"unmute",
|
|
"hide_all_apps_except_frontmost",
|
|
"get_selected_files_in_file_explorer",
|
|
"run_apple_script",
|
|
"run_powershell",
|
|
"get_applications",
|
|
"refresh_applications_list",
|
|
"refresh_applications_list_in_bg",
|
|
// "load_manifest",
|
|
// "load_all_extensions",
|
|
"path_exists",
|
|
"start_server",
|
|
"stop_server",
|
|
"restart_server",
|
|
"set_dev_extension_folder",
|
|
"set_extension_folder",
|
|
"get_extension_folder",
|
|
"get_dev_extension_folder",
|
|
"server_is_running",
|
|
/* -------------------------------------------------------------------------- */
|
|
/* FS */
|
|
/* -------------------------------------------------------------------------- */
|
|
"decompress_tarball",
|
|
"compress_tarball",
|
|
"unzip",
|
|
/* -------------------------------------------------------------------------- */
|
|
/* File Search */
|
|
/* -------------------------------------------------------------------------- */
|
|
"file_search",
|
|
/* -------------------------------------------------------------------------- */
|
|
/* Path */
|
|
/* -------------------------------------------------------------------------- */
|
|
"get_default_extensions_dir",
|
|
"get_default_extensions_storage_dir",
|
|
"is_window_label_registered",
|
|
"register_extension_window",
|
|
"register_extension_spawned_process",
|
|
"unregister_extension_spawned_process",
|
|
"unregister_extension_window",
|
|
"spawn_extension_file_server",
|
|
"get_ext_label_map",
|
|
// "ext_store_wrapper_set",
|
|
// "ext_store_wrapper_get",
|
|
// "ext_store_wrapper_has",
|
|
// "ext_store_wrapper_delete",
|
|
// "ext_store_wrapper_clear",
|
|
// "ext_store_wrapper_reset",
|
|
// "ext_store_wrapper_keys",
|
|
// "ext_store_wrapper_values",
|
|
// "ext_store_wrapper_entries",
|
|
// "ext_store_wrapper_length",
|
|
// "ext_store_wrapper_load",
|
|
// "ext_store_wrapper_save",
|
|
"get_server_port",
|
|
/* ----------------------------- sqlite database ---------------------------- */
|
|
"create_extension",
|
|
"get_all_extensions",
|
|
"get_unique_extension_by_identifier",
|
|
"get_unique_extension_by_path",
|
|
"get_all_extensions_by_identifier",
|
|
"delete_extension_by_path",
|
|
"delete_extension_by_ext_id",
|
|
"create_command",
|
|
"get_command_by_id",
|
|
"get_commands_by_ext_id",
|
|
"delete_command_by_id",
|
|
"update_command_by_id",
|
|
"create_extension_data",
|
|
"get_extension_data_by_id",
|
|
"search_extension_data",
|
|
"delete_extension_data_by_id",
|
|
"update_extension_data_by_id",
|
|
/* -------------------------------- Clipboard ------------------------------- */
|
|
"add_to_history",
|
|
"get_history",
|
|
/* -------------------------------------------------------------------------- */
|
|
/* Utils */
|
|
/* -------------------------------------------------------------------------- */
|
|
"plist_to_json",
|
|
/* -------------------------------------------------------------------------- */
|
|
/* Security */
|
|
/* -------------------------------------------------------------------------- */
|
|
"verify_auth",
|
|
"request_screen_capture_access",
|
|
"check_screen_capture_access",
|
|
/* -------------------------------------------------------------------------- */
|
|
/* MDNS */
|
|
/* -------------------------------------------------------------------------- */
|
|
"get_peers",
|
|
/* -------------------------------------------------------------------------- */
|
|
/* File Transfer */
|
|
/* -------------------------------------------------------------------------- */
|
|
"get_file_transfer_bucket_keys",
|
|
"get_file_transfer_bucket_by_key",
|
|
"local_net_send_file",
|
|
"download_files",
|
|
"file_transfer_preview_bucket",
|
|
];
|
|
|
|
fn main() {
|
|
// SSL Cert
|
|
let cert_pem = match std::env::var("CERT_PEM") {
|
|
Ok(cert) => cert.into_bytes(),
|
|
Err(_) => include_bytes!("./self_signed_certs/cert.pem").to_vec(),
|
|
};
|
|
let key_pem = match std::env::var("KEY_PEM") {
|
|
Ok(key) => key.into_bytes(),
|
|
Err(_) => include_bytes!("./self_signed_certs/key.pem").to_vec(),
|
|
};
|
|
|
|
println!(
|
|
"cargo:rustc-env=BASE64_CERT_PEM={}",
|
|
BASE64_STANDARD.encode(cert_pem)
|
|
);
|
|
println!(
|
|
"cargo:rustc-env=BASE64_KEY_PEM={}",
|
|
BASE64_STANDARD.encode(key_pem)
|
|
);
|
|
|
|
// GRPC
|
|
let out_dir = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap());
|
|
tonic_build::configure()
|
|
.file_descriptor_set_path(out_dir.join("kk_grpc.bin"))
|
|
.compile(
|
|
&[
|
|
"../../grpc/protos/file-transfer.proto",
|
|
"../../grpc/protos/kunkun.proto",
|
|
],
|
|
&["../../grpc/protos"],
|
|
)
|
|
.expect("Failed to compile protos");
|
|
|
|
// Server Public Key
|
|
let raw_server_public_key = include_bytes!("./keys/server_public_key.pem").to_vec();
|
|
println!(
|
|
"cargo:rustc-env=BASE64_SERVER_PUBLIC_KEY={}",
|
|
BASE64_STANDARD.encode(raw_server_public_key)
|
|
);
|
|
|
|
tauri_plugin::Builder::new(COMMANDS)
|
|
.android_path("android")
|
|
.ios_path("ios")
|
|
.build();
|
|
}
|