@bobfrankston/miscassists 1.0.52 → 1.0.54

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/dnsassist.d.ts CHANGED
@@ -16,3 +16,4 @@ interface localIPAndMask {
16
16
  export declare let localIPAndMasks: localIPAndMask[];
17
17
  export declare function isLocalIP(ip: string): boolean;
18
18
  export declare function isThisMachine(ip: string): boolean;
19
+ export declare function getLocalSuffix(): Promise<string | null>;
package/dnsassist.js CHANGED
@@ -1,5 +1,5 @@
1
- import dns from 'dns';
2
- import os from 'os';
1
+ import dnsp from 'node:dns/promises';
2
+ import os from 'node:os';
3
3
  import { default_fqdn } from '@bobfrankston/miscinfo';
4
4
  /***
5
5
  * return IPv4 address giving local addresses priority
@@ -8,16 +8,19 @@ export { default_fqdn };
8
8
  export async function resolve4(name, local) {
9
9
  if (!name?.includes('.'))
10
10
  name += '.' + default_fqdn; // FQDN Hack
11
- return new Promise((resolve, reject) => dns.resolve4(name, (err, ips) => {
12
- if (err)
13
- return resolve(null);
14
- const locals = ips.filter(ip => isLocalIP(ip));
15
- if (locals.length > 0)
16
- return resolve(locals[0]);
17
- if (local)
18
- return resolve(null);
19
- resolve(ips[0]);
20
- }));
11
+ let ips;
12
+ try {
13
+ ips = await dnsp.resolve4(name);
14
+ }
15
+ catch {
16
+ return null;
17
+ }
18
+ const locals = ips.filter(ip => isLocalIP(ip));
19
+ if (locals.length > 0)
20
+ return locals[0];
21
+ if (local)
22
+ return null;
23
+ return ips[0];
21
24
  }
22
25
  export async function resolveLocal4(name) {
23
26
  return await resolve4(name, true);
@@ -94,4 +97,17 @@ export function isThisMachine(ip) {
94
97
  return localIPs.includes(ip);
95
98
  }
96
99
  ;
100
+ export async function getLocalSuffix() {
101
+ try {
102
+ const [server] = dnsp.getServers();
103
+ if (!server)
104
+ return null;
105
+ const [name] = await dnsp.reverse(server);
106
+ const parts = name?.split(".") ?? [];
107
+ return parts.length > 1 ? parts.slice(1).join(".") : null;
108
+ }
109
+ catch {
110
+ return null;
111
+ }
112
+ }
97
113
  //# sourceMappingURL=dnsassist.js.map
package/jserve.d.ts CHANGED
@@ -0,0 +1 @@
1
+ export {};
package/jserve.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";
1
+ export {};
2
2
  //
3
3
  //
4
4
  // // This can be passed via the default value or, better, via the JExport
@@ -10,7 +10,25 @@
10
10
  "settings": {
11
11
  "workbench.colorCustomizations": {
12
12
  "statusBar.noFolderBackground": "#551913",
13
- "statusBar.noFolderForeground": "#FEFCFC"
14
- }
13
+ "statusBar.noFolderForeground": "#FEFCFC",
14
+ "activityBar.background": "#ba8be6",
15
+ "titleBar.activeBackground": "#a161dd",
16
+ "titleBar.activeForeground": "#15202b",
17
+ "titleBar.inactiveBackground": "#a161dd99",
18
+ "titleBar.inactiveForeground": "#15202b99",
19
+ "statusBar.background": "#a161dd",
20
+ "statusBar.foreground": "#15202b",
21
+ "activityBar.activeBackground": "#ba8be6",
22
+ "activityBar.foreground": "#15202b",
23
+ "activityBar.inactiveForeground": "#15202b99",
24
+ "activityBarBadge.background": "#f4e0cb",
25
+ "activityBarBadge.foreground": "#15202b",
26
+ "commandCenter.border": "#15202b99",
27
+ "sash.hoverBorder": "#ba8be6",
28
+ "statusBarItem.hoverBackground": "#8837d4",
29
+ "statusBarItem.remoteBackground": "#a161dd",
30
+ "statusBarItem.remoteForeground": "#15202b"
31
+ },
32
+ "peacock.color": "#a161dd"
15
33
  }
16
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/miscassists",
3
- "version": "1.0.52",
3
+ "version": "1.0.54",
4
4
  "description": "Miscelleanous assists for various tasks including defining port numbers",
5
5
  "main": "index.js",
6
6
  "module": "main.js",
@@ -17,7 +17,7 @@
17
17
  "license": "ISC",
18
18
  "type": "module",
19
19
  "dependencies": {
20
- "@bobfrankston/miscinfo": "^1.0.8",
20
+ "@bobfrankston/miscinfo": "^1.0.10",
21
21
  "esm": "^3.2.25"
22
22
  },
23
23
  "devDependencies": {
@@ -36,7 +36,7 @@
36
36
  },
37
37
  ".transformedSnapshot": {
38
38
  "dependencies": {
39
- "@bobfrankston/miscinfo": "^1.0.8",
39
+ "@bobfrankston/miscinfo": "^1.0.10",
40
40
  "esm": "^3.2.25"
41
41
  }
42
42
  }