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
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $ npm install -g @internxt/cli
$ internxt COMMAND
running command...
$ internxt (--version)
@internxt/cli/1.3.3 darwin-arm64 node-v20.14.0
@internxt/cli/1.3.5 win32-x64 node-v20.2.0
$ internxt --help [COMMAND]
USAGE
$ internxt COMMAND
Expand Down Expand Up @@ -79,7 +79,7 @@ EXAMPLES
$ internxt add-cert
```

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

## `internxt config`

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

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

## `internxt create-folder`

Expand All @@ -129,7 +129,7 @@ EXAMPLES
$ internxt create-folder
```

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

## `internxt download`

Expand All @@ -152,7 +152,7 @@ EXAMPLES
$ internxt download
```

_See code: [src/commands/download.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/download.ts)_
_See code: [src/commands/download.ts](https://github.com/internxt/cli/blob/v1.3.5/src/commands/download.ts)_

## `internxt list`

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

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

## `internxt login`

Expand All @@ -212,7 +212,7 @@ EXAMPLES
$ internxt login
```

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

## `internxt logout`

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

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

## `internxt logs`

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

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

## `internxt move`

Expand All @@ -271,7 +271,7 @@ EXAMPLES
$ internxt move
```

_See code: [src/commands/move.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/move.ts)_
_See code: [src/commands/move.ts](https://github.com/internxt/cli/blob/v1.3.5/src/commands/move.ts)_

## `internxt rename`

Expand All @@ -296,7 +296,7 @@ EXAMPLES
$ internxt rename
```

_See code: [src/commands/rename.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/rename.ts)_
_See code: [src/commands/rename.ts](https://github.com/internxt/cli/blob/v1.3.5/src/commands/rename.ts)_

## `internxt trash`

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

_See code: [src/commands/trash.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/trash.ts)_
_See code: [src/commands/trash.ts](https://github.com/internxt/cli/blob/v1.3.5/src/commands/trash.ts)_

## `internxt trash-clear`

Expand All @@ -347,7 +347,7 @@ EXAMPLES
$ internxt trash-clear
```

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

## `internxt trash-list`

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

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

## `internxt trash-restore`

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

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

## `internxt trash clear`

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

_See code: [src/commands/upload.ts](https://github.com/internxt/cli/blob/v1.3.3/src/commands/upload.ts)_
_See code: [src/commands/upload.ts](https://github.com/internxt/cli/blob/v1.3.5/src/commands/upload.ts)_

## `internxt webdav ACTION`

Expand All @@ -543,7 +543,7 @@ EXAMPLES
$ internxt webdav status
```

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

## `internxt webdav-config ACTION`

Expand Down Expand Up @@ -571,7 +571,7 @@ EXAMPLES
$ internxt webdav-config change-port
```

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

## `internxt whoami`

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

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

# Current Limitations
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"author": "Internxt <[email protected]>",
"version": "1.3.3",
"version": "1.3.5",
"description": "Internxt CLI to manage your encrypted storage",
"scripts": {
"build": "tsc",
Expand All @@ -9,14 +9,15 @@
"posttest": "yarn lint",
"prepack": "yarn build && oclif manifest && oclif readme",
"prepare": "husky || true",
"test": "yarn test:unit",
"test:unit": "nyc --reporter=lcov --reporter=text mocha \"test/**/*.test.ts\" --exit",
"dev:webdav": "nodemon -e ts --exec ts-node src/webdav/index.ts",
"version": "oclif readme && git add README.md",
"pack:win": "oclif pack win",
"migrate": "sequelize db:migrate",
"migrate:undo": "sequelize db:migrate:undo",
"publish:npm": "npm run build && npm publish --scope=@internxt --registry=https://registry.npmjs.org/ --access public",
"publish:github": "npm publish --scope=@internxt --registry=https://npm.pkg.github.com",
"publish:github": "npm run build && npm publish --scope=@internxt --registry=https://npm.pkg.github.com",
"postinstall": "node ./scripts/skip-in-ci.js || internxt webdav restart"
},
"homepage": "https://github.com/internxt/cli",
Expand All @@ -38,28 +39,27 @@
"@internxt/lib": "^1.2.1",
"@internxt/sdk": "^1.5.25",
"@oclif/core": "^3",
"@rudderstack/rudder-sdk-node": "^2.0.7",
"axios": "^1.6.7",
"axios": "^1.7.7",
"bip39": "^3.1.0",
"body-parser": "^1.20.3",
"chalk": "^5.3.0",
"dayjs": "^1.11.13",
"dotenv": "^16.4.5",
"express": "^4.21.0",
"express": "^4.21.1",
"express-async-handler": "^1.2.0",
"express-basic-auth": "^1.2.1",
"fast-xml-parser": "^4.5.0",
"mime-types": "^2.1.35",
"node-fetch": "2",
"node-fetch": "^2",
"openpgp": "^5.11.1",
"pm2": "^5.4.2",
"reflect-metadata": "^0.2.2",
"selfsigned": "^2.4.1",
"sequelize": "^6.37.3",
"sequelize": "^6.37.5",
"sequelize-typescript": "^2.1.6",
"sqlite3": "^5.1.7",
"superagent": "^10.1.0",
"winston": "^3.14.2"
"superagent": "^10.1.1",
"winston": "^3.16.0"
},
"devDependencies": {
"@internxt/eslint-config-internxt": "^1.0.9",
Expand Down
41 changes: 3 additions & 38 deletions src/services/analytics.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { apiObject } from '@rudderstack/rudder-sdk-node';
import { ConfigService } from './config.service';
//import packageJSON from '../../package.json';
//import os from 'os';

export const AnalyticsEvents = {
CLILogin: 'CLI Login',
Expand All @@ -14,43 +11,11 @@ export class AnalyticsService {

constructor(private readonly config: ConfigService) {}

/*private getRudderstack() {
return new Rudderstack(this.config.get('RUDDERSTACK_WRITE_KEY'), {
dataPlaneUrl: this.config.get('RUDDERSTACK_DATAPLANE_URL'),
});
}

private platformShortName(platform: string) {
switch (platform) {
case 'darwin':
return 'MAC';
case 'win32':
return 'WIN';
case 'linux':
return 'LINUX';
default:
return '';
}
}

private platformFamily(platform: string) {
switch (platform) {
case 'darwin':
return 'Mac';
case 'win32':
return 'Windows';
case 'linux':
return 'Linux';
default:
return 'Unknown';
}
}*/

track(
async track(
eventKey: keyof typeof AnalyticsEvents,
options: { app: 'internxt-cli' | 'internxt-webdav'; userId: string },
params: apiObject = {},
params: object = {},
) {
return;
return { eventKey, options, params };
}
}
2 changes: 1 addition & 1 deletion src/utils/webdav.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class WebDavUtils {
} else {
requestUrl = urlObject.url;
}
const decodedUrl = decodeURIComponent(requestUrl);
const decodedUrl = decodeURIComponent(requestUrl).replaceAll('/./', '/');
const parsedPath = path.parse(decodedUrl);
let parentPath = path.dirname(decodedUrl);
if (!parentPath.startsWith('/')) parentPath = '/'.concat(parentPath);
Expand Down
4 changes: 4 additions & 0 deletions src/utils/xml.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ export class XMLUtils {
static addDefaultNamespace(key: string) {
return `${XMLUtils.DEFAULT_NAMESPACE_LETTER}:${key}`;
}

static encodeWebDavUri(uri: string) {
return encodeURIComponent(uri).replaceAll('%2F', '/');
}
}
2 changes: 1 addition & 1 deletion src/webdav/handlers/MOVE.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class MOVERequestHandler implements WebDavMethodHandler {
});
await driveDatabaseManager.createFolder(folder, destinationResource.url);
} else if (resource.type === 'file') {
const newType = destinationResource.path.ext.trim().length > 0 ? destinationResource.path.ext : null;
const newType = destinationResource.path.ext.replace('.', '');
const file = originalDriveItem as DriveFileItem;
await driveFileService.renameFile(file.uuid, {
plainName: newName,
Expand Down
6 changes: 3 additions & 3 deletions src/webdav/handlers/PROPFIND.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export class PROPFINDRequestHandler implements WebDavMethodHandler {
const spaceLimit = await UsageService.instance.fetchSpaceLimit();

const driveFolderXML = {
[XMLUtils.addDefaultNamespace('href')]: encodeURIComponent(relativePath),
[XMLUtils.addDefaultNamespace('href')]: XMLUtils.encodeWebDavUri(relativePath),
[XMLUtils.addDefaultNamespace('propstat')]: {
[XMLUtils.addDefaultNamespace('status')]: 'HTTP/1.1 200 OK',
[XMLUtils.addDefaultNamespace('prop')]: {
Expand Down Expand Up @@ -243,7 +243,7 @@ export class PROPFINDRequestHandler implements WebDavMethodHandler {
const displayName = `${driveFolderItem.name}`;

const driveFolderXML = {
[XMLUtils.addDefaultNamespace('href')]: encodeURIComponent(relativePath),
[XMLUtils.addDefaultNamespace('href')]: XMLUtils.encodeWebDavUri(relativePath),
[XMLUtils.addDefaultNamespace('propstat')]: {
[XMLUtils.addDefaultNamespace('status')]: 'HTTP/1.1 200 OK',
[XMLUtils.addDefaultNamespace('prop')]: {
Expand All @@ -264,7 +264,7 @@ export class PROPFINDRequestHandler implements WebDavMethodHandler {
const displayName = driveFileItem.type ? `${driveFileItem.name}.${driveFileItem.type}` : driveFileItem.name;

const driveFileXML = {
[XMLUtils.addDefaultNamespace('href')]: encodeURIComponent(relativePath),
[XMLUtils.addDefaultNamespace('href')]: XMLUtils.encodeWebDavUri(relativePath),
[XMLUtils.addDefaultNamespace('propstat')]: {
[XMLUtils.addDefaultNamespace('status')]: 'HTTP/1.1 200 OK',
[XMLUtils.addDefaultNamespace('prop')]: {
Expand Down
2 changes: 1 addition & 1 deletion src/webdav/handlers/PUT.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class PUTRequestHandler implements WebDavMethodHandler {

const file = await DriveFileService.instance.createFile({
name: resource.path.name,
type: resource.path.ext.replaceAll('.', ''),
type: resource.path.ext.replace('.', ''),
size: contentLength,
folderId: parentFolderItem.id,
fileId: uploadResult.fileId,
Expand Down
2 changes: 1 addition & 1 deletion test/services/network/download.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('Download Service', () => {
});

sandbox.stub(axios, 'get').callsFake((_, config) => {
config?.onDownloadProgress?.({ loaded: 100, total: 100, bytes: 100 });
config?.onDownloadProgress?.({ loaded: 100, total: 100, bytes: 100, lengthComputable: true });
return Promise.resolve({ data: readableContent });
});

Expand Down
3 changes: 1 addition & 2 deletions test/services/network/network-facade.service.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as NetworkUpload from '@internxt/sdk/dist/network/upload';

import { NetworkFacade } from '../../../src/services/network/network-facade.service';
import { SdkManager } from '../../../src/services/sdk-manager.service';
import path from 'path';
Expand Down Expand Up @@ -217,7 +216,7 @@ describe('Network Facade Service', () => {
const options = { progressCallback: sinon.stub() };

networkFacadeSandbox.stub(axios, 'get').callsFake((_, config) => {
config?.onDownloadProgress?.({ loaded: 100, total: 100, bytes: 100 });
config?.onDownloadProgress?.({ loaded: 100, total: 100, bytes: 100, lengthComputable: true });
return Promise.resolve({ data: readableContent });
});
/* networkFacadeSandbox.stub(superagent, 'get').returns({
Expand Down
Loading