Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM node:24-alpine

RUN apk add --no-cache jq

WORKDIR /app
COPY . .

Expand All @@ -13,3 +15,5 @@ RUN chmod +x /app/docker/entrypoint.sh
RUN ln -s '/app/bin/run.js' /usr/local/bin/internxt

ENTRYPOINT ["/app/docker/entrypoint.sh"]

HEALTHCHECK --interval=60s --timeout=20s --start-period=30s --retries=3 CMD /app/docker/health_check.sh
53 changes: 27 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ $ npm install -g @internxt/cli
$ internxt COMMAND
running command...
$ internxt (--version)
@internxt/cli/1.5.5 win32-x64 node-v23.7.0
@internxt/cli/1.5.6 win32-x64 node-v23.7.0
$ internxt --help [COMMAND]
USAGE
$ internxt COMMAND
Expand Down Expand Up @@ -120,7 +120,7 @@ EXAMPLES
$ internxt add-cert
```

_See code: [src/commands/add-cert.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/add-cert.ts)_
_See code: [src/commands/add-cert.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/add-cert.ts)_

## `internxt autocomplete [SHELL]`

Expand Down Expand Up @@ -171,7 +171,7 @@ EXAMPLES
$ internxt config
```

_See code: [src/commands/config.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/config.ts)_
_See code: [src/commands/config.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/config.ts)_

## `internxt create-folder`

Expand Down Expand Up @@ -200,7 +200,7 @@ EXAMPLES
$ internxt create-folder
```

_See code: [src/commands/create-folder.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/create-folder.ts)_
_See code: [src/commands/create-folder.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/create-folder.ts)_

## `internxt delete-permanently-file`

Expand Down Expand Up @@ -230,7 +230,7 @@ EXAMPLES
$ internxt delete-permanently-file
```

_See code: [src/commands/delete-permanently-file.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/delete-permanently-file.ts)_
_See code: [src/commands/delete-permanently-file.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/delete-permanently-file.ts)_

## `internxt delete-permanently-folder`

Expand Down Expand Up @@ -260,7 +260,7 @@ EXAMPLES
$ internxt delete-permanently-folder
```

_See code: [src/commands/delete-permanently-folder.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/delete-permanently-folder.ts)_
_See code: [src/commands/delete-permanently-folder.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/delete-permanently-folder.ts)_

## `internxt delete permanently file`

Expand Down Expand Up @@ -349,7 +349,7 @@ EXAMPLES
$ internxt download-file
```

_See code: [src/commands/download-file.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/download-file.ts)_
_See code: [src/commands/download-file.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/download-file.ts)_

## `internxt download file`

Expand Down Expand Up @@ -408,7 +408,7 @@ EXAMPLES
$ internxt list
```

_See code: [src/commands/list.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/list.ts)_
_See code: [src/commands/list.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/list.ts)_

## `internxt login`

Expand Down Expand Up @@ -439,7 +439,7 @@ EXAMPLES
$ internxt login
```

_See code: [src/commands/login.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/login.ts)_
_See code: [src/commands/login.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/login.ts)_

## `internxt logout`

Expand All @@ -459,7 +459,7 @@ EXAMPLES
$ internxt logout
```

_See code: [src/commands/logout.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/logout.ts)_
_See code: [src/commands/logout.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/logout.ts)_

## `internxt logs`

Expand All @@ -479,7 +479,7 @@ EXAMPLES
$ internxt logs
```

_See code: [src/commands/logs.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/logs.ts)_
_See code: [src/commands/logs.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/logs.ts)_

## `internxt move-file`

Expand Down Expand Up @@ -511,7 +511,7 @@ EXAMPLES
$ internxt move-file
```

_See code: [src/commands/move-file.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/move-file.ts)_
_See code: [src/commands/move-file.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/move-file.ts)_

## `internxt move-folder`

Expand Down Expand Up @@ -543,7 +543,7 @@ EXAMPLES
$ internxt move-folder
```

_See code: [src/commands/move-folder.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/move-folder.ts)_
_See code: [src/commands/move-folder.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/move-folder.ts)_

## `internxt move file`

Expand Down Expand Up @@ -634,7 +634,7 @@ EXAMPLES
$ internxt rename-file
```

_See code: [src/commands/rename-file.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/rename-file.ts)_
_See code: [src/commands/rename-file.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/rename-file.ts)_

## `internxt rename-folder`

Expand Down Expand Up @@ -665,7 +665,7 @@ EXAMPLES
$ internxt rename-folder
```

_See code: [src/commands/rename-folder.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/rename-folder.ts)_
_See code: [src/commands/rename-folder.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/rename-folder.ts)_

## `internxt rename file`

Expand Down Expand Up @@ -753,7 +753,7 @@ EXAMPLES
$ internxt trash-clear
```

_See code: [src/commands/trash-clear.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/trash-clear.ts)_
_See code: [src/commands/trash-clear.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/trash-clear.ts)_

## `internxt trash-file`

Expand Down Expand Up @@ -783,7 +783,7 @@ EXAMPLES
$ internxt trash-file
```

_See code: [src/commands/trash-file.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/trash-file.ts)_
_See code: [src/commands/trash-file.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/trash-file.ts)_

## `internxt trash-folder`

Expand Down Expand Up @@ -813,7 +813,7 @@ EXAMPLES
$ internxt trash-folder
```

_See code: [src/commands/trash-folder.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/trash-folder.ts)_
_See code: [src/commands/trash-folder.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/trash-folder.ts)_

## `internxt trash-list`

Expand All @@ -839,7 +839,7 @@ EXAMPLES
$ internxt trash-list
```

_See code: [src/commands/trash-list.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/trash-list.ts)_
_See code: [src/commands/trash-list.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/trash-list.ts)_

## `internxt trash-restore-file`

Expand Down Expand Up @@ -870,7 +870,7 @@ EXAMPLES
$ internxt trash-restore-file
```

_See code: [src/commands/trash-restore-file.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/trash-restore-file.ts)_
_See code: [src/commands/trash-restore-file.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/trash-restore-file.ts)_

## `internxt trash-restore-folder`

Expand Down Expand Up @@ -901,7 +901,7 @@ EXAMPLES
$ internxt trash-restore-folder
```

_See code: [src/commands/trash-restore-folder.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/trash-restore-folder.ts)_
_See code: [src/commands/trash-restore-folder.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/trash-restore-folder.ts)_

## `internxt trash clear`

Expand Down Expand Up @@ -1098,7 +1098,7 @@ EXAMPLES
$ internxt upload-file
```

_See code: [src/commands/upload-file.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/upload-file.ts)_
_See code: [src/commands/upload-file.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/upload-file.ts)_

## `internxt upload file`

Expand Down Expand Up @@ -1153,18 +1153,19 @@ EXAMPLES
$ internxt webdav status
```

_See code: [src/commands/webdav.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/webdav.ts)_
_See code: [src/commands/webdav.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/webdav.ts)_

## `internxt webdav-config`

Edit the configuration of the Internxt CLI WebDav server as the port or the protocol.

```
USAGE
$ internxt webdav-config [--json] [-p <value>] [-s | -h] [-t <value>]
$ internxt webdav-config [--json] [-l <value>] [-p <value>] [-s | -h] [-t <value>]

FLAGS
-h, --http Configures the WebDAV server to use insecure plain HTTP.
-l, --host=<value> The listening host for the WebDAV server.
-p, --port=<value> The new port for the WebDAV server.
-s, --https Configures the WebDAV server to use HTTPS with self-signed certificates.
-t, --timeout=<value> Configures the WebDAV server to use this timeout in minutes.
Expand All @@ -1179,7 +1180,7 @@ EXAMPLES
$ internxt webdav-config
```

_See code: [src/commands/webdav-config.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/webdav-config.ts)_
_See code: [src/commands/webdav-config.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/webdav-config.ts)_

## `internxt whoami`

Expand All @@ -1199,7 +1200,7 @@ EXAMPLES
$ internxt whoami
```

_See code: [src/commands/whoami.ts](https://github.com/internxt/cli/blob/v1.5.5/src/commands/whoami.ts)_
_See code: [src/commands/whoami.ts](https://github.com/internxt/cli/blob/v1.5.6/src/commands/whoami.ts)_
<!-- commandsstop -->

# Current Limitations
Expand Down
19 changes: 19 additions & 0 deletions docker/health_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

set -e

# Check login
WHOAMI_OUTPUT=$(internxt whoami --json 2>/dev/null || true)
WHOAMI_EMAIL=$(echo "$WHOAMI_OUTPUT" | jq -r '.login.user.email // empty')

# Check WebDAV status
STATUS_OUTPUT=$(internxt webdav status --json 2>/dev/null || true)
WEBDAV_STATUS=$(echo "$STATUS_OUTPUT" | jq -r '.message | split(" ") | last // empty')

if [ "$WHOAMI_EMAIL" = "$INXT_USER" ] && [ "$WEBDAV_STATUS" = "online" ]; then
echo "Healthcheck passed. User: $INXT_USER, WebDAV status: $WEBDAV_STATUS"
exit 0
else
echo "Healthcheck failed. Expected user: $INXT_USER, got: $WHOAMI_EMAIL. WebDAV status: $WEBDAV_STATUS"
exit 1
fi
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"author": "Internxt <hello@internxt.com>",
"version": "1.5.5",
"version": "1.5.6",
"description": "Internxt CLI to manage your encrypted storage",
"scripts": {
"build": "yarn clean && tsc",
Expand Down Expand Up @@ -47,7 +47,7 @@
"body-parser": "2.2.0",
"cli-progress": "3.12.0",
"dayjs": "1.11.18",
"dotenv": "17.2.2",
"dotenv": "17.2.3",
"express": "5.1.0",
"express-async-handler": "1.2.0",
"fast-xml-parser": "5.2.5",
Expand All @@ -58,7 +58,7 @@
"range-parser": "1.2.1",
"selfsigned": "3.0.1",
"tty-table": "4.2.3",
"winston": "3.17.0"
"winston": "3.18.3"
},
"devDependencies": {
"@internxt/eslint-config-internxt": "2.0.1",
Expand All @@ -79,7 +79,7 @@
"prettier": "3.6.2",
"rimraf": "6.0.1",
"ts-node": "10.9.2",
"typescript": "5.9.2",
"typescript": "5.9.3",
"vitest": "3.2.4",
"vitest-mock-express": "2.2.0"
},
Expand Down
10 changes: 10 additions & 0 deletions src/commands/webdav-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ export default class WebDAVConfig extends Command {
static readonly aliases = [];
static readonly examples = ['<%= config.bin %> <%= command.id %>'];
static readonly flags = {
host: Flags.string({
char: 'l',
description: 'The listening host for the WebDAV server.',
required: false,
}),
port: Flags.string({
char: 'p',
description: 'The new port for the WebDAV server.',
Expand Down Expand Up @@ -40,6 +45,11 @@ export default class WebDAVConfig extends Command {
const { flags } = await this.parse(WebDAVConfig);
const webdavConfig = await ConfigService.instance.readWebdavConfig();

const host = flags['host'];
if (host) {
webdavConfig['host'] = host;
}

const port = flags['port'];
if (port) {
if (ValidationService.instance.validateTCPIntegerPort(port)) {
Expand Down
10 changes: 3 additions & 7 deletions src/commands/webdav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,11 @@ export default class Webdav extends Command {
const webdavConfigs = await ConfigService.instance.readWebdavConfig();

if (status === 'online') {
// eslint-disable-next-line max-len
const message = `Internxt WebDav server started successfully at ${webdavConfigs.protocol}://${ConfigService.WEBDAV_LOCAL_URL}:${webdavConfigs.port}`;
const message =
'Internxt WebDav server started successfully at ' +
`${webdavConfigs.protocol}://${webdavConfigs.host}:${webdavConfigs.port}`;
CLIUtils.log(this.log.bind(this), `\nWebDav server status: ${ux.colorize('green', 'online')}\n`);
CLIUtils.success(this.log.bind(this), message);
CLIUtils.log(
this.log.bind(this),
// eslint-disable-next-line max-len
`\n[If the above URL is not working, the WebDAV server can be accessed directly via your localhost IP at: ${webdavConfigs.protocol}://127.0.0.1:${webdavConfigs.port} ]\n`,
);
return message;
} else {
const message = `WebDav server status: ${ux.colorize('red', status)}`;
Expand Down
16 changes: 12 additions & 4 deletions src/commands/whoami.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CLIUtils } from '../utils/cli.utils';
import { ConfigService } from '../services/config.service';
import { ValidationService } from '../services/validation.service';
import { LoginCredentials } from '../types/command.types';
import { AuthService } from '../services/auth.service';

export default class Whoami extends Command {
static readonly args = {};
Expand All @@ -20,12 +21,19 @@ export default class Whoami extends Command {
return { success: false, message };
} else {
const validCreds = this.checkUserAndTokens(userCredentials);
if (!validCreds) {
if (!validCreds.valid) {
const message = 'Your session has expired. You have been logged out. Please log in again.';
await ConfigService.instance.clearUser();
CLIUtils.error(this.log.bind(this), message);
return { success: false, message };
} else {
if (validCreds.refreshRequired) {
try {
await AuthService.instance.refreshUserToken(userCredentials);
} catch {
/* noop */
}
}
const message = `You are logged in as: ${userCredentials.user.email}.`;
CLIUtils.success(this.log.bind(this), message);
return { success: true, message, login: userCredentials };
Expand All @@ -45,14 +53,14 @@ export default class Whoami extends Command {
this.exit(1);
};

private checkUserAndTokens = (loginCreds: LoginCredentials): boolean => {
private checkUserAndTokens = (loginCreds: LoginCredentials): { valid: boolean; refreshRequired: boolean } => {
if (!(loginCreds?.token && loginCreds?.user?.mnemonic)) {
return false;
return { valid: false, refreshRequired: false };
}
const tokenDetails = ValidationService.instance.validateTokenAndCheckExpiration(loginCreds.token);
const goodMnemonic = ValidationService.instance.validateMnemonic(loginCreds.user.mnemonic);
const goodToken = tokenDetails.isValid && !tokenDetails.expiration.expired;

return goodToken && goodMnemonic;
return { valid: goodToken && goodMnemonic, refreshRequired: tokenDetails.expiration.refreshRequired };
};
}
Loading