u2a 3.4.6 → 3.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "u2a",
3
- "version": "3.4.6",
3
+ "version": "3.4.9",
4
4
  "description": "URL to App - Turn any URL into a desktop application",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -16,14 +16,11 @@ const { setupConfig } = require('./utils/config');
16
16
  const { checkNotRoot } = require('./utils/noroot');
17
17
 
18
18
  (async () => {
19
- await checkNotRoot();
20
-
21
- setupConfig();
22
-
23
19
  program
24
20
  .name('u2a')
25
21
  .description('Convert websites into desktop applications')
26
- .version(version);
22
+ .version(version)
23
+ .option('--allowroot', 'Allow running the application as root/administrator');
27
24
 
28
25
  program
29
26
  .command('create <url>')
@@ -54,9 +51,14 @@ const { checkNotRoot } = require('./utils/noroot');
54
51
  process.exit(1);
55
52
  });
56
53
 
57
- program.parse(process.argv);
58
-
59
54
  if (process.argv.length <= 2) {
60
55
  program.help();
61
56
  }
62
- })();
57
+
58
+ const parsed = program.parse(process.argv);
59
+ const options = parsed.opts();
60
+
61
+ await checkNotRoot(options.allowroot);
62
+
63
+ setupConfig();
64
+ })();
@@ -4,7 +4,12 @@ const Logger = require('./logger')
4
4
 
5
5
  const logger = new Logger('noroot');
6
6
 
7
- async function checkNotRoot() {
7
+ async function checkNotRoot(allowRoot = false) {
8
+ if (allowRoot) {
9
+ logger.warn('Running with elevated privileges. This is not recommended.', '');
10
+ return;
11
+ }
12
+
8
13
  const platform = os.platform();
9
14
 
10
15
  switch (platform) {