mirror of
https://github.com/zarfadev/WinRAR-Keygen.git
synced 2026-07-15 15:18:49 +00:00
v1.0
This commit is contained in:
@@ -72,9 +72,15 @@ document.addEventListener('alpine:init', () => {
|
||||
// Generate the raw license string
|
||||
const keyData = generateWinRARLicense(this.userName, this.licenseType);
|
||||
|
||||
// Use Data URI instead of Blob to prevent UUID filenames on file:// protocol
|
||||
// Use Uint8Array and Blob to prevent double-encoding of UTF-8 characters by the browser
|
||||
const bytes = new Uint8Array(keyData.length);
|
||||
for (let i = 0; i < keyData.length; i++) {
|
||||
bytes[i] = keyData.charCodeAt(i);
|
||||
}
|
||||
const blob = new Blob([bytes], { type: "application/octet-stream" });
|
||||
|
||||
const link = document.createElement("a");
|
||||
link.setAttribute("href", "data:application/octet-stream;charset=utf-8," + encodeURIComponent(keyData));
|
||||
link.setAttribute("href", URL.createObjectURL(blob));
|
||||
link.setAttribute("download", "rarreg.key");
|
||||
|
||||
// Programmatically trigger download
|
||||
@@ -82,6 +88,9 @@ document.addEventListener('alpine:init', () => {
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
|
||||
// Keep memory clean
|
||||
setTimeout(() => URL.revokeObjectURL(link.href), 100);
|
||||
|
||||
this.showToast(this.t.successMsg);
|
||||
} catch (err) {
|
||||
console.error("Error generating key:", err);
|
||||
|
||||
+20
-1
@@ -1,4 +1,23 @@
|
||||
window.generateWinRARLicense = function(username, licenseType) {
|
||||
window.generateWinRARLicense = function(raw_username, raw_licenseType) {
|
||||
function encodeForWinRAR(str) {
|
||||
var hasNonAscii = false;
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
if (str.charCodeAt(i) > 127) { hasNonAscii = true; break; }
|
||||
}
|
||||
if (hasNonAscii && !str.startsWith("utf8:")) {
|
||||
str = "utf8:" + str;
|
||||
}
|
||||
var bytes = new TextEncoder().encode(str);
|
||||
var res = "";
|
||||
for (var i = 0; i < bytes.length; i++) {
|
||||
res += String.fromCharCode(bytes[i]);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
var username = encodeForWinRAR(raw_username);
|
||||
var licenseType = encodeForWinRAR(raw_licenseType);
|
||||
|
||||
let $ = function f() {
|
||||
let $ = new Uint32Array(32767), e = 1;
|
||||
$[0] = 1;
|
||||
|
||||
Reference in New Issue
Block a user