Your ROOT_URL in app.ini is https://bdgit.educoder.net/ but you are visiting http://bdgit.educoder.net/plf32upqf/CyberLantingAssignments/src/commit/a78360e4677f5d9376d61046239853e8c4520e5c/Assignment2/frontend/todo-list/node_modules/run-applescript/index.js You should set ROOT_URL correctly, otherwise the web may not work correctly.

33 lines
910 B

import process from 'node:process';
import {promisify} from 'node:util';
import {execFile, execFileSync} from 'node:child_process';
const execFileAsync = promisify(execFile);
export async function runAppleScript(script, {humanReadableOutput = true} = {}) {
if (process.platform !== 'darwin') {
throw new Error('macOS only');
}
const outputArguments = humanReadableOutput ? [] : ['-ss'];
const {stdout} = await execFileAsync('osascript', ['-e', script, outputArguments]);
return stdout.trim();
}
export function runAppleScriptSync(script, {humanReadableOutput = true} = {}) {
if (process.platform !== 'darwin') {
throw new Error('macOS only');
}
const outputArguments = humanReadableOutput ? [] : ['-ss'];
const stdout = execFileSync('osascript', ['-e', script, ...outputArguments], {
encoding: 'utf8',
stdio: ['ignore', 'pipe', 'ignore'],
timeout: 500,
});
return stdout.trim();
}