Add import to webui
This commit is contained in:
parent
1bb00df760
commit
e7d655aa58
@ -34,6 +34,9 @@ webuiRouter.get("/webui/settings", (_req, res) => {
|
||||
webuiRouter.get("/webui/cheats", (_req, res) => {
|
||||
res.sendFile(path.join(rootDir, "static/webui/index.html"));
|
||||
});
|
||||
webuiRouter.get("/webui/import", (_req, res) => {
|
||||
res.sendFile(path.join(rootDir, "static/webui/index.html"));
|
||||
});
|
||||
|
||||
// Serve static files
|
||||
webuiRouter.use("/webui", express.static(path.join(rootDir, "static/webui")));
|
||||
|
@ -64,6 +64,9 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/webui/cheats" data-bs-dismiss="offcanvas" data-bs-target="#sidebar">Cheats</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/webui/import" data-bs-dismiss="offcanvas" data-bs-target="#sidebar">Import</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -492,6 +495,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-route="/webui/import" data-title="Import | OpenWF WebUI">
|
||||
<p>You can provide a full or partial inventory response (client respresentation) here. All fields that are supported by the importer <b>will be overwritten</b> in your account.</p>
|
||||
<textarea class="form-control" id="import-inventory"></textarea>
|
||||
<button class="btn btn-primary mt-3" onclick="doImport();">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<datalist id="datalist-Suits"></datalist>
|
||||
|
@ -1083,3 +1083,17 @@ function doPopArchonCrystalUpgrade(type) {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function doImport() {
|
||||
revalidateAuthz(() => {
|
||||
$.post({
|
||||
url: "/custom/import?" + window.authz,
|
||||
contentType: "text/plain",
|
||||
data: JSON.stringify({
|
||||
inventory: JSON.parse($("#import-inventory").val())
|
||||
})
|
||||
}).then(function() {
|
||||
updateInventory();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user