-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #173 from dappnode/v0.2.8
v0.2.8 Release
- Loading branch information
Showing
28 changed files
with
154 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Build test | ||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: npx @dappnode/dappnodesdk github-action build | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }} | ||
PINATA_SECRET_API_KEY: ${{ secrets.PINATA_SECRET_API_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { getClient } from "../openvpn"; | ||
|
||
/** | ||
* Returns the credentials file (.ovpn) for device `id` | ||
* @param id "new-device" | ||
*/ | ||
export async function getCredFile({ id }: { id: string }): Promise<string> { | ||
return await getClient(id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
export * from "./addDevice"; | ||
export * from "./getCredFile"; | ||
export * from "./getDeviceCredentials"; | ||
export * from "./getMasterAdminCred"; | ||
export * from "./getStatus"; | ||
export * from "./getVersionData"; | ||
export * from "./listDevices"; | ||
export * from "./removeDevice"; | ||
export * from "./resetDevice"; | ||
export * from "./toggleAdmin"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,13 @@ | ||
import { getUserList, getCCD } from "../openvpn"; | ||
import { VpnDevice, OpenVpnCCDItem } from "../types"; | ||
import { getUserList } from "../openvpn"; | ||
import { VpnDevice } from "../types"; | ||
|
||
/** | ||
* Returns a list of the existing devices, with the admin property | ||
*/ | ||
export async function listDevices(): Promise<VpnDevice[]> { | ||
const userList = await getUserList(); | ||
const ccd = getCCD(); | ||
|
||
const ccdById = ccd.reduce( | ||
(byId, device) => { | ||
return { ...byId, [device.cn]: device }; | ||
}, | ||
{} as { [id: string]: OpenVpnCCDItem } | ||
); | ||
|
||
return userList.map(user => ({ | ||
id: user, | ||
admin: Boolean(ccdById[user]), | ||
ip: (ccdById[user] || {}).ip || "" | ||
id: user | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import ip from "ip"; | ||
import got from "got"; | ||
import { logs } from "../logs"; | ||
import { dappmanagerApiUrlGlobalEnvs, GLOBAL_ENVS_KEYS } from "../params"; | ||
import { config } from "../config"; | ||
|
||
export async function getInternalIpCached(): Promise<string> { | ||
// internal IP is an optional feature for when NAT-Loopback is off | ||
try { | ||
const internalIp = await got(GLOBAL_ENVS_KEYS.INTERNAL_IP, { | ||
throwHttpErrors: true, | ||
prefixUrl: dappmanagerApiUrlGlobalEnvs | ||
}) | ||
.text() | ||
.then(res => res.trim()); | ||
|
||
if (!ip.isV4Format(internalIp)) | ||
throw Error(`Invalid internalIp returned: ${internalIp}`); | ||
|
||
config.internalIp = internalIp; | ||
|
||
return internalIp; | ||
} catch (e) { | ||
logs.warn("Error getting internal IP from DAPPMANAGER", e); | ||
|
||
if (!config.internalIp) throw e; | ||
return config.internalIp; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.