diff --git a/ui/media/js/plugins.js b/ui/media/js/plugins.js index d0511ab7..972f0d7b 100644 --- a/ui/media/js/plugins.js +++ b/ui/media/js/plugins.js @@ -85,946 +85,946 @@ async function loadUIPlugins() { /* PLUGIN MANAGER */ /* plugin tab */ -document.querySelector('.tab-container')?.insertAdjacentHTML('beforeend', ` -
-`) - -document.querySelector('#tab-content-wrapper')?.insertAdjacentHTML('beforeend', ` -(Plugin developers, add your plugins to plugins.json)
`) -const refreshPlugins = document.getElementById("refresh-plugins") -refreshPlugins.addEventListener("click", async function (event) { - event.preventDefault() - await initPlugins(true) -}) - -function showPluginToast(message, duration = 5000, error = false, addNotification = true) { - if (addNotification === true) { - addPluginNotification(pluginNotifications, message, error) - } - try { - showToast(message, duration, error) - } catch (error) { - console.error('Error while trying to show toast:', error); - } -} - -function matchPluginFileNames(fileName1, fileName2) { - const regex = /^(.+?)(?:-\d+(\.\d+)*)?\.plugin\.js$/; - const match1 = fileName1.match(regex); - const match2 = fileName2.match(regex); - - if (match1 && match2 && match1[1] === match2[1]) { - return true; // the two file names match - } else { - return false; // the two file names do not match - } -} - -function extractFilename(filepath) { - // Normalize the path separators to forward slashes and make the file names lowercase - const normalizedFilePath = filepath.replace(/\\/g, "/").toLowerCase(); - - // Strip off the path from the file name - const fileName = normalizedFilePath.substring(normalizedFilePath.lastIndexOf("/") + 1); - - return fileName -} - -function checkFileNameInArray(paths, filePath) { - // Strip off the path from the file name - const fileName = extractFilename(filePath); - - // Check if the file name exists in the array of paths - return paths.some(path => { - // Strip off the path from the file name - const baseName = extractFilename(path); - - // Check if the file names match and return the result as a boolean - return matchPluginFileNames(fileName, baseName); - }); -} - -function isGitHub(url) { - return url.startsWith("https://raw.githubusercontent.com/") === true -} - -/* fill in the plugins table */ -function getIncompatiblePlugins(pluginId) { - const enabledPlugins = plugins.filter(plugin => plugin.enabled && plugin.id !== pluginId); - const incompatiblePlugins = enabledPlugins.filter(plugin => plugin.compatIssueIds?.includes(pluginId)); - const pluginNames = incompatiblePlugins.map(plugin => plugin.name); - if (pluginNames.length === 0) { - return null; - } - const pluginNamesList = pluginNames.map(name => `(Plugin developers, add your plugins to plugins.json)
`) +// const refreshPlugins = document.getElementById("refresh-plugins") +// refreshPlugins.addEventListener("click", async function (event) { +// event.preventDefault() +// await initPlugins(true) +// }) + +// function showPluginToast(message, duration = 5000, error = false, addNotification = true) { +// if (addNotification === true) { +// addPluginNotification(pluginNotifications, message, error) +// } +// try { +// showToast(message, duration, error) +// } catch (error) { +// console.error('Error while trying to show toast:', error); +// } +// } + +// function matchPluginFileNames(fileName1, fileName2) { +// const regex = /^(.+?)(?:-\d+(\.\d+)*)?\.plugin\.js$/; +// const match1 = fileName1.match(regex); +// const match2 = fileName2.match(regex); + +// if (match1 && match2 && match1[1] === match2[1]) { +// return true; // the two file names match +// } else { +// return false; // the two file names do not match +// } +// } + +// function extractFilename(filepath) { +// // Normalize the path separators to forward slashes and make the file names lowercase +// const normalizedFilePath = filepath.replace(/\\/g, "/").toLowerCase(); + +// // Strip off the path from the file name +// const fileName = normalizedFilePath.substring(normalizedFilePath.lastIndexOf("/") + 1); + +// return fileName +// } + +// function checkFileNameInArray(paths, filePath) { +// // Strip off the path from the file name +// const fileName = extractFilename(filePath); + +// // Check if the file name exists in the array of paths +// return paths.some(path => { +// // Strip off the path from the file name +// const baseName = extractFilename(path); + +// // Check if the file names match and return the result as a boolean +// return matchPluginFileNames(fileName, baseName); +// }); +// } + +// function isGitHub(url) { +// return url.startsWith("https://raw.githubusercontent.com/") === true +// } + +// /* fill in the plugins table */ +// function getIncompatiblePlugins(pluginId) { +// const enabledPlugins = plugins.filter(plugin => plugin.enabled && plugin.id !== pluginId); +// const incompatiblePlugins = enabledPlugins.filter(plugin => plugin.compatIssueIds?.includes(pluginId)); +// const pluginNames = incompatiblePlugins.map(plugin => plugin.name); +// if (pluginNames.length === 0) { +// return null; +// } +// const pluginNamesList = pluginNames.map(name => `