-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinventory.php
94 lines (88 loc) · 4 KB
/
inventory.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!doctype html>
<html lang="en" data-bs-theme="dark">
<head>
<title>Inventory | browse.wf</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<link rel="icon" href="https://browse.wf/Lotus/Interface/Icons/Categories/GrimoireModIcon.png">
</head>
<body data-bs-theme="dark">
<?php require "components/navbar.php"; ?>
<div class="container pt-3">
<p>If you play Warframe on PC, you can sync your inventory with browse.wf for some extra features and information. The data stays in your browser.</p>
<h3>Upload your lastData.dat</h3>
<ul>
<li>If you use AlecaFrame, you can find this in the <code>%localappdata%/AlecaFrame</code> folder.</li>
<li>Alternatively, you can get a fresh copy by running the <a href="https://github.com/Sainan/warframe-api-helper/releases/download/2123bfd/warframe-api-helper.exe" download>warframe-api-helper</a> while the game is running & you're logged in.</li>
</ul>
<input type="file" class="form-control" />
<p id="status" class="d-none mt-2 mb-0">Your inventory data is currently as of <b id="sync-time"></b>. <a href="#" onclick="event.preventDefault();localStorage.removeItem('inventory');location.reload();">Want to remove it again?</a></p>
<a id="donebtn" class="d-none mt-3 btn btn-secondary"></a>
</div>
<?php require "components/commonjs.html"; ?>
<script src="https://pluto-lang.org/wasm-builds/out/libpluto/0.9.5/libpluto.js"></script>
<script src="https://pluto-lang.org/PlutoScript/plutoscript.js"></script>
<script>
function get_uploaded()
{
return new Promise((resolve, reject) =>
{
if (document.querySelector("input").files.length)
{
document.querySelector("input").files[0].arrayBuffer().then(ab =>
{
pluto_give_file("lastData.dat", new Uint8Array(ab));
resolve(true);
});
}
else
{
resolve(false);
}
});
}
function onInventoryUploaded(data)
{
localStorage.setItem("inventory", data);
onGotInventory();
}
function onGotInventory()
{
const inventory = JSON.parse(localStorage.getItem("inventory"));
document.getElementById("status").classList.remove("d-none");
document.getElementById("sync-time").textContent = new Date(parseInt(inventory.LastInventorySync.$oid.substr(0, 8), 16) * 1000).toLocaleString();
document.getElementById("donebtn").classList.remove("btn-secondary");
document.getElementById("donebtn").classList.add("btn-primary");
document.getElementById("donebtn").classList.remove("mt-3");
document.getElementById("donebtn").classList.add("mt-2");
}
if (location.hash == "#for=invigorations")
{
document.getElementById("donebtn").textContent = "Back to Invigorations";
document.getElementById("donebtn").href = "/invigorations";
document.getElementById("donebtn").classList.remove("d-none");
}
if (localStorage.getItem("inventory"))
{
onGotInventory();
}
</script>
<script type="pluto">
local { crypto, json } = require "*"
document.querySelector("input[type=file]"):addEventListener("change", function()
if js_invoke("get_uploaded") then
local key <const> = "LEO-ALEC\tEO-ALEC"
local iv <const> = "\49\50\70\71\66\51\54\45\76\69\51\45\113\61\57\0"
local data = io.contents("lastData.dat")
|> crypto.decrypt|"aes-cbc-pkcs7", key, iv|
|> json.decode|json.withnull + json.withorder|
if data.InventoryJson then
data = json.decode(data.InventoryJson, json.withnull + json.withorder)
end
js_invoke("onInventoryUploaded", json.encode(data))
end
end)
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</body>
</html>