- Fix trailing whitespace in kex.rs and s3.rs - Add missing KexProposal import in kex_complete.rs - Auto-fix clippy warnings across all crates - All 153 tests pass
142 lines
4.8 KiB
Rust
142 lines
4.8 KiB
Rust
// Warning System - Legal and Technical Warnings for Optional Formats
|
|
|
|
use log::{info, warn};
|
|
|
|
use crate::archive::config::ArchiveConfig;
|
|
|
|
/// Show RAR legal risk warning
|
|
pub fn show_rar_legal_warning() {
|
|
warn!("");
|
|
warn!("⚠️ ⚠️ ⚠️ RAR FORMAT LEGAL WARNING ⚠️ ⚠️ ⚠️");
|
|
warn!("");
|
|
warn!("By enabling RAR format support, you acknowledge:");
|
|
warn!(" 1. RAR compression algorithm is patented by RARLAB");
|
|
warn!(" 2. Commercial use requires license purchase (approx $1000+)");
|
|
warn!(" 3. You assume ALL legal responsibility for patent compliance");
|
|
warn!(" 4. MarkBase provides RAR decompression only, NO compression");
|
|
warn!(" 5. unrar library is free for personal use only");
|
|
warn!("");
|
|
warn!("License info: https://rarlab.com/license.htm");
|
|
warn!("");
|
|
warn!("⚠️ User accepts legal risk by enabling enable_rar = true in config");
|
|
warn!("");
|
|
}
|
|
|
|
/// Show XZ external dependency warning
|
|
pub fn show_xz_dependency_warning() {
|
|
warn!("");
|
|
warn!("⚠️ ⚠️ ⚠️ XZ FORMAT DEPENDENCY WARNING ⚠️ ⚠️ ⚠️");
|
|
warn!("");
|
|
warn!("XZ format requires external liblzma library (non-pure Rust)");
|
|
warn!("");
|
|
warn!("Installation instructions:");
|
|
warn!(" macOS: brew install xz");
|
|
warn!(" Linux: apt install liblzma-dev (Debian/Ubuntu)");
|
|
warn!(" yum install xz-devel (CentOS/RHEL)");
|
|
warn!(" Windows: Manual installation required (complex)");
|
|
warn!(" Download from: https://tukaani.org/xz/");
|
|
warn!("");
|
|
warn!("⚠️ XZ format disabled if liblzma not found");
|
|
warn!("");
|
|
}
|
|
|
|
/// Show 7z library stability warning
|
|
pub fn show_7z_stability_warning() {
|
|
warn!("");
|
|
warn!("⚠️ ⚠️ ⚠️ 7Z FORMAT STABILITY WARNING ⚠️ ⚠️ ⚠️");
|
|
warn!("");
|
|
warn!("sevenz-rust library (v0.21.0) is under active development:");
|
|
warn!(" 1. Some compression algorithms not yet supported");
|
|
warn!(" 2. Production stability may be limited");
|
|
warn!(" 3. Performance optimization ongoing");
|
|
warn!(" 4. API may change in future versions");
|
|
warn!("");
|
|
warn!("Recommended: Wait for library maturity before production use");
|
|
warn!("GitHub: https://github.com/frogmoreltd/sevenz-rust");
|
|
warn!("");
|
|
warn!("⚠️ Use with caution in production environments");
|
|
warn!("");
|
|
}
|
|
|
|
/// Show startup warnings for optional formats
|
|
pub fn show_startup_warnings(config: &ArchiveConfig) {
|
|
if config.enable_rar {
|
|
show_rar_legal_warning();
|
|
}
|
|
|
|
if config.enable_xz {
|
|
// Dependency check happens in ProcessorRegistry
|
|
}
|
|
|
|
if config.enable_7z {
|
|
show_7z_stability_warning();
|
|
}
|
|
|
|
// Show summary of enabled formats
|
|
let enabled_optional = [config.enable_rar, config.enable_xz, config.enable_7z]
|
|
.iter()
|
|
.filter(|&x| *x)
|
|
.count();
|
|
|
|
if enabled_optional > 0 {
|
|
info!("");
|
|
info!(
|
|
"⚠️ {} optional format(s) enabled with warnings shown above",
|
|
enabled_optional
|
|
);
|
|
info!("Core formats (9): ZIP, TAR, GZIP, ZSTD, BZIP2, LZ4, TAR.GZ, TAR.BZ2, TAR.ZST");
|
|
info!("");
|
|
}
|
|
}
|
|
|
|
/// Generate user-facing legal disclaimer text
|
|
pub fn generate_rar_legal_disclaimer() -> String {
|
|
"RAR FORMAT LEGAL DISCLAIMER
|
|
|
|
IMPORTANT WARNING:
|
|
|
|
By enabling RAR format support in MarkBase, you acknowledge and agree to the following:
|
|
|
|
1. RAR COMPRESSION ALGORITHM PATENT
|
|
- RAR compression algorithm is patented by RARLAB (Eugene Roshal)
|
|
- Patent protection applies to commercial use
|
|
- Personal/non-commercial use may be free (check RARLAB license)
|
|
|
|
2. LICENSE REQUIREMENTS
|
|
- Commercial use requires purchasing license from RARLAB
|
|
- License cost: approximately $1000+ (contact RARLAB for exact pricing)
|
|
- License info: https://rarlab.com/license.htm
|
|
|
|
3. MARKBASE LIABILITY DISCLAIMER
|
|
- MarkBase provides RAR DECOMPRESSION only (no compression)
|
|
- MarkBase uses unrar library (free for personal use)
|
|
- MarkBase DOES NOT provide RAR compression functionality
|
|
- MarkBase DOES NOT assume any legal liability for RAR patent issues
|
|
|
|
4. USER RESPONSIBILITY
|
|
- You are solely responsible for verifying legal compliance
|
|
- If commercial use, you must purchase RARLAB license
|
|
- You accept all legal risks by enabling enable_rar = true
|
|
- MarkBase is not liable for any patent infringement
|
|
|
|
5. USAGE GUIDELINES
|
|
- Personal use: Free (符合unrar免费许可)
|
|
- Commercial use: License required
|
|
- Distribution: Contact RARLAB for distribution license
|
|
|
|
ENABLE RAR FORMAT:
|
|
Modify config.toml:
|
|
enable_rar = false # Default disabled
|
|
enable_rar = true # ⚠️ User accepts legal risk
|
|
|
|
CONTACT:
|
|
- RARLAB: https://rarlab.com
|
|
- License: support@rarlab.com
|
|
- MarkBase: your-markbase-support
|
|
|
|
Last Updated: 2026-06-10
|
|
Version: 1.0
|
|
Legal Consultation: [Please consult professional lawyer for commercial use]
|
|
".to_string()
|
|
}
|