Made it possible to create links with commands for console page.

This commit is contained in:
Abdulmhsen B. A. A.
2024-06-03 19:25:02 +03:00
parent b2d756aa63
commit 6c08dc4344
2 changed files with 23 additions and 4 deletions

View File

@@ -292,6 +292,13 @@ const copyText = (str) => {
notification('success', 'Success', 'Text copied to clipboard.')
}
const makeConsoleCommand = (cmd) => {
const params = new URLSearchParams();
// -- base64 encode the command to prevent XSS
params.append('cmd', btoa(cmd));
return `/console?${params.toString()}`
}
const stringToRegex = (str) => new RegExp(str.match(/\/(.+)\/.*/)[1], str.match(/\/.+\/(.*)/)[1]);
export {
@@ -304,5 +311,6 @@ export {
makeGUIDLink,
formatDuration,
copyText,
stringToRegex
stringToRegex,
makeConsoleCommand
}