Skip to content

Commit

Permalink
webui/js: request api in mmrl alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
KOWX712 committed Feb 10, 2025
1 parent 74b9e02 commit 020856a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions module/webroot/scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ cronContainer.addEventListener('click', async function () {

// Initial load
window.onload = () => {
adjustHeaderForMMRL();
checkMMRL();
["custom", "sources", "blacklist", "whitelist"].forEach(loadFile);
attachAddButtonListeners();
attachHelpButtonListeners();
Expand All @@ -725,12 +725,22 @@ document.addEventListener('DOMContentLoaded', async () => {
});

// Function to check if running in MMRL
function adjustHeaderForMMRL() {
function checkMMRL() {
if (typeof ksu !== 'undefined' && ksu.mmrl) {
console.log("Running in MMRL");
// Adjust inset
header.style.top = 'var(--window-inset-top)';
actionButton.style.bottom = 'calc(var(--window-inset-bottom) + 25px)';
headerBlock.style.display = 'block';

// Request API permission
try {
$bindhosts.requestAdvancedKernelSUAPI();
$bindhosts.requestFileSystemAPI();
} catch (error) {
console.log("Error requesting API:", error);
}
} else {
console.log("Not running in MMRL environment.");
}
}

Expand Down

0 comments on commit 020856a

Please sign in to comment.