ani-cli-npm
Version:
ani-cli tool rewritten as npm package
100 lines (98 loc) • 3.31 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.config_ = void 0;
const chalk = require("chalk");
const input_1 = require("./input");
const configs = [
(async (temp) => {
temp.player = [
"VLC",
"BROWSER",
"MPV",
"W2G",
"LINK",
][await (0, input_1.selection)([
"VLC - VLC media player",
"Browser - Play in default browser",
"MPV - MPV media player",
"w2g.tv - Watch together with friends in browser (Specify api token to create rooms linked to your account)",
"Link - Simply display the link in console"
], [], ((item) => { return chalk.cyan(item); }), ((item) => { return chalk.cyan(item); }))];
// @ts-ignore
return temp, 0;
}),
(async (temp) => {
console.log(chalk.cyan("New Proxy;"));
temp.proxy = (await ((0, input_1.input)())).replaceAll(" ", "");
// @ts-ignore
return temp, 0;
}),
(async (temp) => {
console.log(chalk.cyan("New User Agent"));
temp.user_agent = await ((0, input_1.input)());
// @ts-ignore
return temp, 0;
}),
(async (temp) => {
console.log(chalk.cyan("New Downloads Folder"));
temp.download_folder = await ((0, input_1.input)());
// @ts-ignore
return temp, 0;
}),
(async (temp) => {
console.log(chalk.cyan("New socket file"));
temp.mpv_socket_path = await ((0, input_1.input)());
// @ts-ignore
return temp, 0;
}),
(async (temp) => {
console.log(chalk.cyan("New VLC socket"));
temp.vlc_socket = await ((0, input_1.input)());
// @ts-ignore
return temp, 0;
}),
(async (temp) => {
console.log(chalk.cyan("New VLC password"));
temp.vlc_pass = await ((0, input_1.input)());
// @ts-ignore
return temp, 0;
}),
(async (temp) => {
console.log(chalk.cyan("New w2g.tv api token"));
temp.w2g_api_key = await ((0, input_1.input)());
// @ts-ignore
return temp, 0;
}),
(async (temp) => {
// @ts-ignore
return temp, 1;
}),
(async (temp) => {
// @ts-ignore
return temp, 2;
})
];
async function config_(temp) {
/*
## Lets user change a single attribute of config. Returns new config object, and an exit code
### 0 to continue (generic return)
### 1 To confirm (Save and exit)
### 2 to cancel (exit without saving changes)
*/
console.clear();
console.log(chalk.blue("ANI-CLI-NPM \n"));
console.log(chalk.yellow("Config:\n"));
return configs[await (0, input_1.selection)([
"Player; " + temp.player,
"Proxy; " + temp.proxy,
"User agent; " + temp.user_agent,
"Downloads folder; " + temp.download_folder,
"Mpv socket connection file; " + temp.mpv_socket_path,
"VLC socket; " + temp.vlc_socket,
"VLC pass; " + temp.vlc_pass,
"W2G api token: " + temp.w2g_api_key,
"Save and exit",
"Exit without saving"
], [], ((item) => { return chalk.cyan(item); }), ((item) => { return chalk.cyan(item); }))](temp);
}
exports.config_ = config_;
;