Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Webdav connector to the Twake Drive #643

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
61c1fdd
🌟Creating adapter implementation for the nephele server ,authenticati…
rumata-feathers Jul 29, 2024
b043c3c
🌟Defining copy, move, find functions for documents service
rumata-feathers Jul 29, 2024
b0f7a55
🌟Creating properties service
rumata-feathers Jul 29, 2024
ae0f0b5
🌟Creating file - resource service
rumata-feathers Jul 29, 2024
af92790
🐛 Add error handling
rumata-feathers Jul 29, 2024
ead2adf
🐛 Connect webdav service
rumata-feathers Jul 29, 2024
ab4fc40
🌟Implementation of MCKOL method and handling errors as instances
rumata-feathers Jul 30, 2024
863f867
🌟Implementation of COPY and MOVE methods
rumata-feathers Jul 31, 2024
04875fb
🌟Implementation of PUT and GET methods
rumata-feathers Aug 5, 2024
441e25d
🐛Add config
rumata-feathers Aug 7, 2024
d787fc1
♻️ backend: change how stream size is calculated to prevent starting …
ericlinagora Aug 8, 2024
c01f47d
🐛 Fixed PUT method (setStream and getStream functions)
rumata-feathers Aug 13, 2024
4c6d0d2
🌟 Generate device id
rumata-feathers Aug 16, 2024
d720b47
♻️Improved Stream uploading
rumata-feathers Aug 20, 2024
e8fd313
🌟Implementing locks and adding new properties handling
rumata-feathers Aug 20, 2024
2620d44
🌟Implementing device handling
rumata-feathers Aug 20, 2024
0dc90e0
♻️Added company information to device
rumata-feathers Aug 22, 2024
325928e
♻️Updates packages and dependencies needed for webdav
rumata-feathers Aug 22, 2024
e73e907
♻️Clean-ups
rumata-feathers Aug 27, 2024
694ec1b
♻️Adding mime-type for files
rumata-feathers Aug 27, 2024
bf014de
♻️Adding documentation
rumata-feathers Aug 27, 2024
36857f6
✅ github actions: adding flag to load module dynamically
ericlinagora Aug 28, 2024
044979b
Merge branch 'main' into webdav-express
ericlinagora Aug 28, 2024
06749f6
✅ github actions: testing different quoting
ericlinagora Aug 28, 2024
fdd5404
♻️Prettifying
rumata-feathers Aug 27, 2024
7354874
♻️Beatifying with lint
rumata-feathers Aug 28, 2024
7f43084
♻️fixing tests
rumata-feathers Aug 29, 2024
d233eec
♻️fixed documentation
rumata-feathers Aug 29, 2024
662eae8
♻️Adding testing
rumata-feathers Aug 30, 2024
1b22ff3
♻ Fixing testing
rumata-feathers Sep 2, 2024
fc0219c
🎨🔇♻️⚰️ backend: minor cleanup (#573)
ericlinagora Sep 3, 2024
4462866
🐛 backend: Adding vital routing code back, lest we get 404s (#573)
ericlinagora Oct 1, 2024
41b8472
⬆️ Update of package.json files (#573)
ericlinagora Oct 1, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- name: e2e-mongo-s3-test
run: |
cd tdrive
docker compose -f docker-compose.tests.yml run --rm -e NODE_OPTIONS=--unhandled-rejections=warn -e SEARCH_DRIVER=mongodb -e DB_DRIVER=mongodb -e PUBSUB_TYPE=local node npm run test:all
docker compose -f docker-compose.tests.yml run --rm -e "NODE_OPTIONS=--unhandled-rejections=warn --experimental-vm-modules" -e SEARCH_DRIVER=mongodb -e DB_DRIVER=mongodb -e PUBSUB_TYPE=local node npm run test:all
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still needed after the eval evil hack ?

docker compose -f docker-compose.tests.yml down
- name: e2e-opensearch-test
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class DriveFile {
size: number;
last_version_cache: Partial<FileVersion>;
scope: DriveScope;
locks: DriveLock[];
}

type AccessInformation = {
Expand Down Expand Up @@ -87,3 +88,21 @@ type DriveFileThumbnail = {
full_url?: string;
};
```

**DriveLock**
```Typescript
export class DriveLock {
company_id: string;
user_id: string;
id: string;
drive_file_id: string;
token: string;
created_at: number;
timeout: number;
scope: "exclusive" | "shared";
depth: "0" | "infinity";
provisional: boolean;
owner: any;
principal: string;
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# WebDAV Adapter

The Adapter component serves as the interface between the Nephele WebDAV library and Twake Drive's file system. It handles resource location, authorization, and provides methods for creating and retrieving resources.

Key features:
- Implements the `Adapter` interface from Nephele
- Manages URL to file path conversion
- Handles authorization checks
- Creates and retrieves `ResourceService` instances

For implementation details, refer to `Adapter.ts`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# DriveLock

The DriveLock component implements locking mechanisms for WebDAV resources in Twake Drive.

Key features:
- Creation and management of exclusive and shared locks
- Lock timeout handling
- Integration with Twake Drive's file structure for lock storage

For implementation details, refer to `DriveLock.ts`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# PropertiesService

The PropertiesService manages WebDAV properties for resources in Twake Drive's file system.

Key features:
- Retrieval of standard WebDAV properties (e.g., creationdate, displayname, getcontentlength)
- Custom property management
- Property listing and modification

For implementation details, refer to `Properties.ts`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# WebDAV Service for TDrive

This document provides an overview of the WebDAV service implementation for Twake Drive, which allows users to access and manipulate their files using the WebDAV protocol.

## Table of Contents

1. [Overview](#overview)
2. [Components](#components)
3. [Setup and Configuration](#setup-and-configuration)
4. [Usage](#usage)
5. [Authentication](#authentication)
6. [Limitations and Considerations](#limitations-and-considerations)

## Overview

The WebDAV service is implemented using the Nephele library and integrates with Twake Drive's existing file storage and permission system. It provides standard WebDAV functionality, including file operations (read, write, delete), directory listings, and locking mechanisms.

## Components

The WebDAV service consists of several key components:

1. [Adapter](Adapter.md): Interfaces between Nephele and Twake Drive's file system.
2. [ResourceService](ResourceService.md): Implements the Resource interface, handling file and directory operations.
3. [PropertiesService](PropertiesService.md): Manages WebDAV properties for resources.
4. [DriveLock](DriveLock.md): Implements locking mechanisms for WebDAV resources.

## Setup and Configuration

To set up the WebDAV service:

1. Ensure all dependencies are installed.
2. Configure the `routes.ts` file to set up the WebDAV endpoint (default: `internal/services/webdav/v1/webdav`).

## Usage

Once set up, users can connect to the WebDAV service using any WebDAV-compatible client. The service supports standard WebDAV operations such as:

- Browsing directories
- Uploading and downloading files
- Creating and deleting directories
- Moving and copying files/directories
- Setting and retrieving file properties
- Locking and unlocking resources

## Authentication

The service uses Basic Authentication. Users need to provide their device ID as the username and device password as the password.

Example:
```
Authorization: Basic base64(device_id:device_password)
```

## Limitations and Considerations

- Locks are stored within the DriveFile object to maintain database compatibility.
- Performance may vary depending on the size and number of files being accessed.

For more detailed information on each component, please refer to their respective documentation files.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ResourceService

The ResourceService implements the `Resource` interface from Nephele, providing methods for file and directory operations within Twake Drive's file system.

Key features:
- File and directory CRUD operations
- Stream handling for file content
- Lock management
- Property management
- Internal member (child resource) handling

For implementation details, refer to `fileResource.ts`.
3 changes: 2 additions & 1 deletion tdrive/backend/node/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@
"documents",
"applications",
"applications-api",
"tags"
"tags",
"webdav"
]
}
Loading