u2a 3.5.5 → 3.5.6
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 +9 -4
- package/src/utils/config.js +3 -3
- package/src/utils/logger.js +1 -1
- package/src/utils/settings.js +1 -1
- package/src/utils/url.js +12 -9
- package/.github/workflows/npm-publish.yml +0 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "u2a",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.6",
|
|
4
4
|
"description": "URL to App - Turn any URL into a desktop application",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"start": "node src/index.js",
|
|
11
|
-
"postinstall": "node src/utils/postinstall.js"
|
|
11
|
+
"postinstall": "node src/utils/postinstall.js",
|
|
12
|
+
"test": "jest",
|
|
13
|
+
"wta": "jest --watchAll --verbose"
|
|
12
14
|
},
|
|
13
15
|
"keywords": [
|
|
14
16
|
"cli",
|
|
@@ -28,10 +30,13 @@
|
|
|
28
30
|
"electron": "^22.0.0",
|
|
29
31
|
"icojs": "^0.19.5",
|
|
30
32
|
"inquirer": "^8.2.5",
|
|
33
|
+
"is-admin": "^3.0.0",
|
|
31
34
|
"open": "^8.4.0",
|
|
32
35
|
"png-to-ico": "^2.1.8",
|
|
33
|
-
"sharp": "^0.33.5"
|
|
34
|
-
|
|
36
|
+
"sharp": "^0.33.5"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"jest": "^29.7.0"
|
|
35
40
|
},
|
|
36
41
|
"homepage": "https://urltoapp.xyz",
|
|
37
42
|
"repository": {
|
package/src/utils/config.js
CHANGED
|
@@ -2,6 +2,7 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const os = require('os');
|
|
4
4
|
|
|
5
|
+
|
|
5
6
|
const CONFIG_DIR = path.join(os.homedir(), '.u2a');
|
|
6
7
|
const APPS_DIR = path.join(CONFIG_DIR, 'apps');
|
|
7
8
|
const LOGS_DIR = path.join(CONFIG_DIR, 'logs');
|
|
@@ -34,11 +35,10 @@ function writeDB(data) {
|
|
|
34
35
|
fs.writeFileSync(DB_PATH, JSON.stringify(data, null, 2));
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
function addAppToDB(
|
|
38
|
+
function addAppToDB(appName, appData) {
|
|
38
39
|
const db = readDB();
|
|
39
|
-
db[
|
|
40
|
+
db[appName] = appData;
|
|
40
41
|
writeDB(db);
|
|
41
|
-
logger.debug(`Application recorded in the database:`, domain);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
module.exports = {
|
package/src/utils/logger.js
CHANGED
package/src/utils/settings.js
CHANGED
|
@@ -22,7 +22,7 @@ function initSettings(reset = false) {
|
|
|
22
22
|
currentSettings = JSON.parse(fs.readFileSync(SETTINGS_PATH, 'utf8'));
|
|
23
23
|
logger.debug('Existing settings loaded');
|
|
24
24
|
} catch (err) {
|
|
25
|
-
logger.debug(`Error reading existing settings.json, will
|
|
25
|
+
logger.debug(`Error reading existing settings.json, will reset`, err.message);
|
|
26
26
|
currentSettings = {};
|
|
27
27
|
}
|
|
28
28
|
}
|
package/src/utils/url.js
CHANGED
|
@@ -2,15 +2,18 @@ const axios = require('axios');
|
|
|
2
2
|
const { sanitizeInput } = require('./sanitize');
|
|
3
3
|
|
|
4
4
|
async function normalizeUrl(url) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
const sanitizedUrl = sanitizeInput(url);
|
|
6
|
+
|
|
7
|
+
if (sanitizedUrl.startsWith('http://') || sanitizedUrl.startsWith('https://')) {
|
|
8
|
+
return sanitizedUrl;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
await axios.get('https://' + sanitizedUrl);
|
|
13
|
+
return 'https://' + sanitizedUrl;
|
|
14
|
+
} catch (error) {
|
|
15
|
+
return 'http://' + sanitizedUrl;
|
|
12
16
|
}
|
|
13
|
-
return sanitizeInput(url);
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
function getDomainName(url) {
|
|
@@ -25,4 +28,4 @@ function getDomainName(url) {
|
|
|
25
28
|
module.exports = {
|
|
26
29
|
normalizeUrl,
|
|
27
30
|
getDomainName
|
|
28
|
-
};
|
|
31
|
+
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: Node.js Package
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
paths:
|
|
6
|
-
- 'package.json'
|
|
7
|
-
branches:
|
|
8
|
-
- main
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
|
|
12
|
-
publish-npm:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v4
|
|
16
|
-
- uses: actions/setup-node@v4
|
|
17
|
-
with:
|
|
18
|
-
node-version: 20
|
|
19
|
-
registry-url: https://registry.npmjs.org/
|
|
20
|
-
- run: npm publish
|
|
21
|
-
env:
|
|
22
|
-
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
|