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 55 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
55 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
8b09173
✨ front, back: Adding auto device creation, settings in dark mode, re…
ericlinagora Oct 12, 2024
e130ef8
🧑‍💻 back: cleaner webdav login, better mongo logs, removed sematicall…
ericlinagora Oct 12, 2024
fcc7c0f
♻️ back: renamed fileresource file
ericlinagora Oct 12, 2024
ea1bf42
🩹 back: restore CORS plugin
ericlinagora Oct 12, 2024
02f5640
🔀 Merge remote-tracking branch 'origin/main' into webdav-express
ericlinagora Oct 12, 2024
386eb47
🌐 front: webdav settings page ~translations
ericlinagora Oct 12, 2024
27f181d
💚 backend: build without `--experimental-vm-modules`
ericlinagora Oct 12, 2024
6dc9a7e
✅ back: deactivate device-centric tests for further discussion of use…
ericlinagora Oct 12, 2024
5aa434a
🩹🚧 back: fix for webdav properties, very WIP
ericlinagora Oct 12, 2024
131d804
🩹🚧 back: webdav: loading nephele from a separate file and refactor to…
ericlinagora Oct 12, 2024
215be97
♻️ back: removing asserts that should be runtime errors
ericlinagora Oct 12, 2024
2b9f166
♻️ back: refactoring webdav service to extract nephele adapter implem…
ericlinagora Oct 12, 2024
416707c
♻️ back: webdav: moving nephele adapter to own folder, separating ser…
ericlinagora Oct 12, 2024
5aee799
♻️ back: webdav: extract nephele authenticator implementation to own …
ericlinagora Oct 13, 2024
a671ba3
♻️ back: webdav: refactor to use prototype chain, minor renaming and …
ericlinagora Oct 13, 2024
0478634
🩹 back: webdav: Make CORS plugin leniant and continue evaluation, add…
ericlinagora Oct 13, 2024
f065a02
⬆️ front: fix a lot source map related warnings related to react-zoom…
ericlinagora Oct 15, 2024
2914e56
🩹 back: webdav now accepts PUTs of files
ericlinagora Oct 15, 2024
56c6446
🐛fix: get last modified date formatting
MontaGhanmy Oct 16, 2024
3a923af
♻️ back: rename properties without service, make loading more homogen…
ericlinagora Oct 16, 2024
8e569f2
🔀 Merge branch 'main' into webdav-express
ericlinagora Nov 1, 2024
53236a7
🔀 merge origin/main into webdav-express
ericlinagora Nov 20, 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
ericlinagora marked this conversation as resolved.
Show resolved Hide resolved
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
Loading