@scrypted/server 0.7.88 → 0.7.90
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.
Potentially problematic release.
This version of @scrypted/server might be problematic. Click here for more details.
@@ -1,7 +1,11 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
6
|
exports.AddressSettings = void 0;
|
4
7
|
const db_types_1 = require("../db-types");
|
8
|
+
const os_1 = __importDefault(require("os"));
|
5
9
|
class AddressSettings {
|
6
10
|
scrypted;
|
7
11
|
constructor(scrypted) {
|
@@ -13,11 +17,24 @@ class AddressSettings {
|
|
13
17
|
localAddresses.value = addresses;
|
14
18
|
await this.scrypted.datastore.upsert(localAddresses);
|
15
19
|
}
|
16
|
-
async getLocalAddresses() {
|
20
|
+
async getLocalAddresses(raw) {
|
17
21
|
const settings = await this.scrypted.datastore.tryGet(db_types_1.Settings, 'localAddresses');
|
18
22
|
if (!settings?.value?.[0])
|
19
23
|
return;
|
20
|
-
|
24
|
+
const ret = [];
|
25
|
+
const networkInterfaces = os_1.default.networkInterfaces();
|
26
|
+
for (const addressOrInterface of settings.value) {
|
27
|
+
const nif = networkInterfaces[addressOrInterface];
|
28
|
+
if (!raw && nif) {
|
29
|
+
for (const addr of nif) {
|
30
|
+
ret.push(addr.address);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
else {
|
34
|
+
ret.push(addressOrInterface);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
return ret;
|
21
38
|
}
|
22
39
|
}
|
23
40
|
exports.AddressSettings = AddressSettings;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../src/services/addresses.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../src/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
"version": "0.7.
|
3
|
+
"version": "0.7.90",
|
4
4
|
"description": "",
|
5
5
|
"dependencies": {
|
6
6
|
"@mapbox/node-pre-gyp": "^1.0.10",
|
@@ -69,8 +69,8 @@
|
|
69
69
|
"prebuild": "rimraf dist",
|
70
70
|
"build": "tsc --outDir dist",
|
71
71
|
"postbuild": "node test/check-build-output.js",
|
72
|
-
"prebeta": "npm version patch && git add package.json && npm run build && git commit -m prebeta",
|
73
72
|
"beta": "npm publish --tag beta",
|
73
|
+
"postbeta": "npm version patch && git add package.json && npm run build && git commit -m postbeta",
|
74
74
|
"release": "npm publish",
|
75
75
|
"prepublish": "npm run build",
|
76
76
|
"postrelease": "git tag v$npm_package_version && git push origin v$npm_package_version && npm version patch && git add package.json && git commit -m postrelease",
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Settings } from "../db-types";
|
2
2
|
import { ScryptedRuntime } from "../runtime";
|
3
|
+
import os from 'os';
|
3
4
|
|
4
5
|
export class AddressSettings {
|
5
6
|
constructor(public scrypted: ScryptedRuntime) {
|
@@ -12,10 +13,25 @@ export class AddressSettings {
|
|
12
13
|
await this.scrypted.datastore.upsert(localAddresses);
|
13
14
|
}
|
14
15
|
|
15
|
-
async getLocalAddresses(): Promise<string[]> {
|
16
|
+
async getLocalAddresses(raw?: boolean): Promise<string[]> {
|
16
17
|
const settings = await this.scrypted.datastore.tryGet(Settings, 'localAddresses');
|
18
|
+
|
17
19
|
if (!settings?.value?.[0])
|
18
20
|
return;
|
19
|
-
|
21
|
+
|
22
|
+
const ret: string[] = [];
|
23
|
+
const networkInterfaces = os.networkInterfaces();
|
24
|
+
for (const addressOrInterface of settings.value) {
|
25
|
+
const nif = networkInterfaces[addressOrInterface];
|
26
|
+
if (!raw && nif) {
|
27
|
+
for (const addr of nif) {
|
28
|
+
ret.push(addr.address);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
else {
|
32
|
+
ret.push(addressOrInterface);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
return ret;
|
20
36
|
}
|
21
37
|
}
|