Windows-এ Tauri 2 প্রজেক্ট তৈরি
WebView2, Rust এবং MinGW-w64 ইনস্টল করুন। SDK 0.11.9-এর জন্য x86_64-pc-windows-gnu টার্গেট ও মিল থাকা শেয়ারড libcurl ডেভেলপমেন্ট প্যাকেজ নিন। পথগুলো আপনার ইনস্টল অনুযায়ী বদলান।
npm create tauri-app@4.7.5 licensed-tauri -- --template vanilla --identifier com.example.licensedtauri --manager npm --yes
cd licensed-tauri
npm install
rustup toolchain install stable-x86_64-pc-windows-gnu
$env:RUSTUP_TOOLCHAIN = 'stable-x86_64-pc-windows-gnu'
$MinGW = 'C:\path\to\mingw64'
$env:LICENTIVO_CURL_ROOT = 'C:\path\to\curl-dev'
$env:CC = Join-Path $MinGW "bin\gcc.exe"
$env:CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER = $env:CC
$env:Path = "$MinGW\bin;$env:LICENTIVO_CURL_ROOT\bin;$env:Path"
cargo add --manifest-path src-tauri/Cargo.toml "licentivo@=0.11.8"Rust কমান্ডে লাইসেন্স পরীক্ষা
নিচের তিনটি ফাইল বদলান। lib.rs-এ পণ্য ID এবং সব পাবলিক সাইনিং কী দিন। WebView export_report ডাকে। স্থানীয় অ্যাপ ডেটায় লেখার আগে Rust export পরীক্ষা করে।
use licentivo::Client;
use std::{path::PathBuf, sync::Mutex};
use tauri::{AppHandle, Manager, RunEvent, WebviewWindow};
const PRODUCT_ID: &str = "YOUR_PRODUCT_ID";
const TRUSTED_KEYS: &str = r#"{"YOUR_KEY_ID":"YOUR_PUBLIC_KEY"}"#;
struct Licensing {
client: Mutex<Option<Client>>,
report: PathBuf,
}
#[tauri::command]
async fn export_report(app: AppHandle, window: WebviewWindow) -> Result<(), String> {
if window.label() != "main" {
return Err("This window cannot export reports.".into());
}
tauri::async_runtime::spawn_blocking(move || {
let state = app.state::<Licensing>();
let mut guard = state.client.lock().map_err(|_| "License client unavailable.")?;
let client = guard.as_mut().ok_or("License client is closed.")?;
client.run_feature("export", || {
std::fs::write(&state.report, "Licensed export\n")?;
Ok(())
}).map_err(|_| "Export denied or unavailable.".to_owned())
}).await.map_err(|_| "The export task did not complete.")?
}
pub fn run() {
let app = tauri::Builder::default()
.setup(|app| {
let key = std::env::var("LICENTIVO_LICENSE_KEY").unwrap_or_default();
let client = Client::open_product(PRODUCT_ID, TRUSTED_KEYS, &key)?;
let directory = app.path().app_local_data_dir()?;
std::fs::create_dir_all(&directory)?;
app.manage(Licensing {
client: Mutex::new(Some(client)),
report: directory.join("licensed-report.txt"),
});
Ok(())
})
.invoke_handler(tauri::generate_handler![export_report])
.build(tauri::generate_context!())
.expect("Could not start the licensed application");
app.run(|app, event| {
if matches!(event, RunEvent::Exit) {
let state = app.state::<Licensing>();
if let Ok(mut client) = state.client.lock() {
client.take();
};
}
});
}<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Licensed export</title>
<script src="./main.js" type="module"></script>
</head>
<body>
<h1>Licensed export</h1>
<button type="button" id="export-report">Export report</button>
<p id="result" role="status"></p>
</body>
</html>const button = document.querySelector("#export-report");
const result = document.querySelector("#result");
button.addEventListener("click", async () => {
button.disabled = true;
try {
await window.__TAURI__.core.invoke("export_report");
result.textContent = "Report saved in application data.";
} catch (error) {
result.textContent = String(error);
} finally {
button.disabled = false;
}
});Windows অ্যাপ বিল্ড ও যাচাই
সীমিত অফলাইন ব্যবহার ও export সহ ডিভাইস-বাঁধা লাইসেন্স দিয়ে Release ফাইল চালান। Export report চাপুন, বন্ধ করুন এবং কী ছাড়া আবার চালু করুন। নতুন প্রোফাইলে export ছাড়া লাইসেন্স দিয়ে প্রত্যাখ্যান যাচাই করুন। প্রোগ্রামের পাশে WebView2Loader.dll রাখুন এবং মিল থাকা libcurl DLL দিন।
১৯ নভেম্বর ২০২৬-এ Windows x64-এ Tauri 2.12.7, WebView2 এবং SDK 0.11.8 দিয়ে পরীক্ষা হয়েছে। Release প্রোগ্রাম অ্যাক্টিভেশন ও কী ছাড়া পুনরায় চালুর পর রপ্তানি করেছে। export না থাকলে প্রত্যাখ্যান দেখিয়েছে এবং ফাইল তৈরি করেনি।
npm run tauri build -- --target x86_64-pc-windows-gnu --no-bundle
if ($LASTEXITCODE -ne 0) { throw 'Tauri build failed.' }
$env:LICENTIVO_LICENSE_KEY = 'YOUR_LICENSE_KEY'
$app = ".\src-tauri\target\x86_64-pc-windows-gnu\release\licensed-tauri.exe"
Start-Process -FilePath (Resolve-Path $app).Path -Wait
Remove-Item Env:LICENTIVO_LICENSE_KEY
Start-Process -FilePath (Resolve-Path $app).Path -WaitRust সফটওয়্যার লাইসেন্সিং: সক্রিয়করণ ও ফিচার যাচাই
Licentivo SDK দিয়ে আপনার Rust অ্যাপে লাইসেন্স কী যাচাই, ডিভাইসের সঙ্গে লাইসেন্স যুক্ত করা এবং ফিচারের অনুমতি পরীক্ষা যোগ করুন। কোডের উদাহরণসহ ইনস্টলেশন, অ্যাক্টিভেশন, অফলাইন যাচাই ও ত্রুটি সামলানোর ধাপ দেখুন।
C++ অফলাইন লাইসেন্স সক্রিয়করণ
ইন্টারনেট থেকে বিচ্ছিন্ন কম্পিউটারে C++ সফটওয়্যারের অফলাইন লাইসেন্স অ্যাক্টিভেশন চালু করুন। অনুরোধ ও উত্তর ফাইল বিনিময় করে স্বাক্ষর যাচাই করুন এবং লাইসেন্সটি ডিভাইসের সঙ্গে যুক্ত করুন। লক্ষ্য কম্পিউটারে ইন্টারনেট লাগে না।