Skip to content

Commit

Permalink
Merge pull request #138 from DIG-Network/release/v0.0.1-alpha.153
Browse files Browse the repository at this point in the history
Release/v0.0.1 alpha.153
  • Loading branch information
MichaelTaylor3D authored Oct 6, 2024
2 parents d69e5a8 + 72d9ace commit 617131d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.0.1-alpha.153](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.152...v0.0.1-alpha.153) (2024-10-06)


### Features

* support hostnames in publicip env ([dcfb9ef](https://github.com/DIG-Network/dig-chia-sdk/commit/dcfb9ef1c22d4a4aa702b8ef2d3b7d9d649ddeda))
* support hostnames in publicip env ([8eb5a52](https://github.com/DIG-Network/dig-chia-sdk/commit/8eb5a52584b8b027163582f1e43fe72c686e68e8))

### [0.0.1-alpha.152](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.151...v0.0.1-alpha.152) (2024-10-06)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dignetwork/dig-sdk",
"version": "0.0.1-alpha.152",
"version": "0.0.1-alpha.153",
"description": "",
"type": "commonjs",
"main": "./dist/index.js",
Expand Down
6 changes: 3 additions & 3 deletions src/blockchain/ServerCoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,9 @@ export class ServerCoin {
blacklist: string[] = []
): Promise<string[]> {
// We dont want our own IP to be included
const myIp = await getPublicHost();
if (myIp) {
blacklist.push(myIp);
const host = await getPublicHost();
if (host) {
blacklist.push(host);
}

const serverCoinPeers = await this.getAllEpochPeers(epoch, blacklist);
Expand Down
6 changes: 4 additions & 2 deletions src/utils/Environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export class Environment {
// Hostname regex (simple, allows subdomains but not special characters)
const hostnamePattern =
/^(([a-zA-Z0-9](-*[a-zA-Z0-9])*)\.)*([a-zA-Z0-9](-*[a-zA-Z0-9])*)\.?$/;
return this.isValidIp(hostname) || hostnamePattern.test(hostname);
const ipv6Pattern =
/^(([0-9a-fA-F]{1,4}:){7}([0-9a-fA-F]{1,4}|:)|(([0-9a-fA-F]{1,4}:){1,7}|:):(([0-9a-fA-F]{1,4}:){1,6}|:):([0-9a-fA-F]{1,4}|:):([0-9a-fA-F]{1,4}|:)|::)$/;
return this.isValidIp(hostname) || ipv6Pattern.test(hostname) || hostnamePattern.test(hostname);
}

// Helper to validate if a number is a valid port (between 1 and 65535)
Expand Down Expand Up @@ -63,7 +65,7 @@ export class Environment {
// Static getter for PUBLIC_IP (valid IP)
static get PUBLIC_IP(): string | undefined {
const value = process.env["PUBLIC_IP"];
return value && this.isValidIp(value) ? value : undefined;
return value && this.isValidHostnameOrIp(value) ? value : undefined;
}

// Static getter for DISK_SPACE_LIMIT_BYTES (number, optional)
Expand Down

0 comments on commit 617131d

Please sign in to comment.