1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
const qoa = require('qoa');
qoa.config({
prefix: '>',
underlineQuery: false
});
async function start() {
const confirm = await qoa.confirm({
type: 'confirm',
query: 'Would you like to run the setup wizard now?',
handle: 'run',
accept: 'y',
deny: 'n'
});
if (!confirm.run) process.exit(0);
const wizard = [
{
type: 'input',
query: 'Port to run the API in:',
handle: 'serverPort'
},
{
type: 'input',
query: 'Port to run the Website in:',
handle: 'websitePort'
},
{
type: 'input',
query: 'Full domain this instance is gonna be running on (Ex: https://lolisafe.moe):',
handle: 'fullDomain'
},
{
type: 'input',
query: 'Maximum allowed upload file size in MB (Ex: 100):',
handle: 'maxSize'
},
{
type: 'confirm',
query: 'Generate thumbnails for images/videos? (Requires ffmpeg installed and in your PATH)',
handle: 'generateThumbnails',
accept: 'y',
deny: 'n'
},
{
type: 'confirm',
query: 'Allow users to download entire albums in ZIP format?',
handle: 'generateZips',
accept: 'y',
deny: 'n'
},
{
type: 'interactive',
query: 'How would you like to serve the uploaded files?',
handle: 'serveWithNode',
menu: [
'With NGINX (Faster but needs a bit more setup)',
'With node'
]
},
{
type: 'confirm',
query: 'Run lolisafe in public mode?',
handle: 'publicMode',
accept: 'y',
deny: 'n'
},
{
type: 'confirm',
query: 'Enable user signup for new accounts?',
handle: 'enableUserAccounts',
accept: 'y',
deny: 'n'
},
{
type: 'secure',
query: 'Type a secure password for the root user:',
handle: 'rootPassword'
}
];
const response = await qoa.prompt(wizard);
console.log(response);
}
start();
|