mirror of
https://github.com/unraid/api.git
synced 2025-12-31 13:39:52 -06:00
feat: inject after form
This commit is contained in:
@@ -1,6 +1,10 @@
|
|||||||
import { existsSync } from 'node:fs';
|
import { existsSync } from 'node:fs';
|
||||||
import { copyFile, readFile, rename, unlink, writeFile } from 'node:fs/promises';
|
import { copyFile, readFile, rename, unlink, writeFile } from 'node:fs/promises';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export const setupSso = async () => {
|
export const setupSso = async () => {
|
||||||
const path = '/usr/local/emhttp/plugins/dynamix/include/.login.php';
|
const path = '/usr/local/emhttp/plugins/dynamix/include/.login.php';
|
||||||
|
|
||||||
@@ -52,11 +56,11 @@ function verifyUsernamePasswordAndSSO(string $username, string $password): bool
|
|||||||
'!verifyUsernamePasswordAndSSO($username, $password)'
|
'!verifyUsernamePasswordAndSSO($username, $password)'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Inject the PHP include tag before the closing </body> tag
|
// Inject the PHP include tag after the closing </form> tag
|
||||||
fileContent = fileContent.replace(/<\/body>/i, `${tagToInject}\n</body>`);
|
fileContent = fileContent.replace(/<\/form>/i, `</form>\n${tagToInject}`);
|
||||||
|
|
||||||
// Write the updated content back to the file
|
// Write the updated content back to the file
|
||||||
await writeFile(path, fileContent);
|
await writeFile(path, fileContent);
|
||||||
|
|
||||||
console.log('Function replaced successfully.');
|
console.log('Function replaced successfully.');
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user