Commit graph

57 commits

Author SHA1 Message Date
bohwaz 7f0a87be44 Allow to empty trash from users page 2023-12-31 16:53:00 +01:00
bohwaz ef96655277 Make sure we create directories in the right place, fix #46 2023-12-31 16:41:12 +01:00
bohwaz f9ae56c3b0 Don't try to touch after rename 2023-12-31 16:23:09 +01:00
bohwaz b5aeb7903f Adjust Storage according to new WebDAV library changes 2023-12-31 15:49:00 +01:00
bohwaz 30c342316b Fix creating a file was creating a directory 2023-10-15 14:58:34 +02:00
bohwaz 18bb00057b Implement trashbin support 2023-09-11 16:38:07 +02:00
bohwaz dc065255e8 Fix bug where NC Android didn't want to allow file/directory creation 2023-09-11 01:37:05 +02:00
bohwaz ef2a3eeea6 Fix glob return 2023-09-11 00:48:59 +02:00
bohwaz f58482b053 Use file inode for file ID 2023-09-11 00:23:14 +02:00
bohwaz 8b09483ea7 Update deps: NextCloud desktop client crashes if fileId is not returned 2023-06-12 00:03:40 +02:00
bohwaz d456ba6764 Changes for KD2 lib API change 2023-06-11 23:43:29 +02:00
bohwaz 661c2edfaa Fix auth_callback return, provide namespace in example callback 2023-05-12 10:53:58 +02:00
bohwaz d2f57e3fdc Implement auth callback fix #33 2023-05-11 01:54:43 +02:00
lubiana e736dfc86d
add nullable user property to nextcloud class (#32)
this fixes a deprecation notices on php8.2 which results in an error and
therefore inability to register on nextcloud client

ErrorReport:
```
[24-Apr-2023 19:07:01 UTC] =========== Error ref. 25qisnme ===========

ErrorException: Deprecated: Creation of dynamic property KaraDAV\NextCloud::$user is deprecated in /home/lubiana/dev/private/karadav/lib/KaraDAV/NextCloud.php:33
Stack trace:
#0 /home/lubiana/dev/private/karadav/lib/KaraDAV/NextCloud.php(33): KD2\ErrorManager::errorHandler(8192, '...', '...', 33)
#1 /home/lubiana/dev/private/karadav/lib/KD2/WebDAV/NextCloud.php(380): KaraDAV\NextCloud->auth('...', '...')
#2 /home/lubiana/dev/private/karadav/lib/KD2/WebDAV/NextCloud.php(559): KD2\WebDAV\NextCloud->requireAuth()
#3 /home/lubiana/dev/private/karadav/lib/KD2/WebDAV/NextCloud.php(317): KD2\WebDAV\NextCloud->nc_user('...')
#4 /home/lubiana/dev/private/karadav/lib/KaraDAV/Server.php(44): KD2\WebDAV\NextCloud->route('...')
#5 /home/lubiana/dev/private/karadav/www/_router.php(47): KaraDAV\Server->route('...')
#6 {main}

<errorReport>
{
    "errors": [
        {
            "message": "Deprecated: Creation of dynamic property KaraDAV\\NextCloud::$user is deprecated",
            "errorCode": 0,
            "type": "PHP error",
            "backtrace": [
                {
                    "file": "\/home\/lubiana\/dev\/private\/karadav\/lib\/KaraDAV\/NextCloud.php",
                    "line": 33,
                    "code": {
                        "29": "\t\tif (!$user) {",
                        "30": "\t\t\treturn false;",
                        "31": "\t\t}",
                        "32": "",
                        "33": "\t\t$this->user = $user;",
                        "34": "",
                        "35": "\t\treturn true;",
                        "36": "\t}",
                        "37": ""
                    }
                },
                {
                    "function": "KaraDAV\\NextCloud->auth",
                    "file": "\/home\/lubiana\/dev\/private\/karadav\/lib\/KD2\/WebDAV\/NextCloud.php",
                    "line": 380,
                    "args": {
                        "$login": "string(7) \"lubiana\"",
                        "$password": "string(33) \"redacted\""
                    },
                    "code": {
                        "376": "\t}",
                        "377": "",
                        "378": "\tprotected function requireAuth(): void",
                        "379": "\t{",
                        "380": "\t\tif (!$this->auth($_SERVER['PHP_AUTH_USER'] ?? null, $_SERVER['PHP_AUTH_PW'] ?? null)) {",
                        "381": "\t\t\theader('WWW-Authenticate: Basic realm=\"Please login\"');",
                        "382": "\t\t\tthrow new Exception('Please login to access this resource', 401);",
                        "383": "\t\t}",
                        "384": "\t}"
                    }
                },
                {
                    "function": "KD2\\WebDAV\\NextCloud->requireAuth",
                    "file": "\/home\/lubiana\/dev\/private\/karadav\/lib\/KD2\/WebDAV\/NextCloud.php",
                    "line": 559,
                    "code": {
                        "555": "\t}",
                        "556": "",
                        "557": "\tpublic function nc_user(): array",
                        "558": "\t{",
                        "559": "\t\t$this->requireAuth();",
                        "560": "",
                        "561": "\t\t$quota = $this->getUserQuota();",
                        "562": "\t\t$user = $this->getUserName() ?? 'null';",
                        "563": ""
                    }
                },
                {
                    "function": "KD2\\WebDAV\\NextCloud->nc_user",
                    "file": "\/home\/lubiana\/dev\/private\/karadav\/lib\/KD2\/WebDAV\/NextCloud.php",
                    "line": 317,
                    "args": [
                        "string(21) \"ocs\/v1.php\/cloud\/user\""
                    ],
                    "code": {
                        "313": "\t\t$method = $_SERVER['REQUEST_METHOD'] ?? null;",
                        "314": "\t\t$this->server->log('NC <= %s %s => routed to: %s', $method, $uri, $route);",
                        "315": "",
                        "316": "\t\ttry {",
                        "317": "\t\t\t$v = $this->{'nc_' . $route}($uri);",
                        "318": "\t\t}",
                        "319": "\t\tcatch (Exception $e) {",
                        "320": "\t\t\t$this->server->log('NC => %d - %s', $e->getCode(), $e->getMessage());",
                        "321": "\t\t\thttp_response_code($e->getCode());"
                    }
                },
                {
                    "function": "KD2\\WebDAV\\NextCloud->route",
                    "file": "\/home\/lubiana\/dev\/private\/karadav\/lib\/KaraDAV\/Server.php",
                    "line": 44,
                    "args": {
                        "$uri": "string(21) \"ocs\/v1.php\/cloud\/user\""
                    },
                    "code": {
                        "40": "\t\t}",
                        "41": "",
                        "42": "\t\t$this->nc->setServer($this->dav);",
                        "43": "",
                        "44": "\t\tif ($r = $this->nc->route($uri)) {",
                        "45": "\t\t\t\/\/ NextCloud route already replied something, stop here",
                        "46": "\t\t\treturn true;",
                        "47": "\t\t}",
                        "48": ""
                    }
                },
                {
                    "function": "KaraDAV\\Server->route",
                    "file": "...\/_router.php",
                    "line": 47,
                    "args": {
                        "$uri": "string(22) \"\/ocs\/v1.php\/cloud\/user\""
                    },
                    "code": {
                        "43": "if (isset($_SERVER['REDIRECT_REQUEST_METHOD'])) {",
                        "44": "\t$_SERVER['REQUEST_METHOD'] = $_SERVER['REDIRECT_REQUEST_METHOD'];",
                        "45": "}",
                        "46": "",
                        "47": "if (!$s->route($uri)) {",
                        "48": "\tif (PHP_SAPI == 'cli-server') {",
                        "49": "\t\t$s->dav->log(\"ROUTER: => Route is not managed: 404\");",
                        "50": "\t}",
                        "51": ""
                    }
                }
            ]
        }
    ],
    "context": {
        "date": "2023-04-24T19:07:01+00:00",
        "duration": 155.84897994995117,
        "environment": "development",
        "hostname": "0.0.0.0",
        "http_files": "array(0) {\n}",
        "http_method": "GET",
        "http_post": "array(0) {\n}",
        "http_user_agent": "Mozilla\/5.0 (Linux) mirall\/3.8.1git (Nextcloud, arch-6.2.12-arch1-1 ClientArchitecture: x86_64 OsArchitecture: x86_64)",
        "id": "25qisnme",
        "language": "PHP 8.2.5",
        "memory_peak": 2097152,
        "memory_used": 2097152,
        "os": "Linux",
        "php_sapi": "cli-server",
        "remote_ip": "127.0.0.1",
        "root_directory": "\/home\/lubiana\/dev\/private\/karadav\/www",
        "user_addr": "127.0.0.1",
        "url": "http:\/\/127.0.0.1:8080\/ocs\/v1.php\/cloud\/user?format=json"
    }
}
</errorReport>
```
2023-04-24 21:54:47 +02:00
bohwaz ec518aed1d Allow to install in a subdirectory 2023-03-12 20:40:55 +01:00
bohwaz 7b5ca7914f Allow to disable slow file operations (directory size / mtime) 2023-03-12 15:34:04 +01:00
bohwaz a1dfe67638 Add support for ownCloud/NextCloud checksum verification 2023-02-14 13:27:19 +01:00
bohwaz 6386bba8ac * Change methods to get recursive directory size and to delete a directory recursively
* Allow "unlimited" disk quota
2023-02-14 12:15:15 +01:00
bohwaz 94635065b3 Fix #25 undefined property 2023-02-11 15:28:57 +01:00
bohwaz b9e765be83 Update dependencies 2023-01-28 03:11:31 +01:00
bohwaz 42b9c0b602 Update dependencies, split NextCloud permissions 2022-11-27 06:54:44 +01:00
bohwaz 5d34c4d996 Fix #20: use a temporary storage path inside the users storage path, fix missing path prefix in $tmp_file 2022-11-23 00:42:59 +01:00
bohwaz b3d7e5e628 Fix #21 typo in method name 2022-11-23 00:10:50 +01:00
bohwaz 68cb4e8cc4 Raise errors if the user does not have access to a directory or file 2022-11-21 18:18:04 +01:00
bohwaz b2c97b0d55 Handle non-writeable and non-readable files 2022-11-21 18:05:55 +01:00
bohwaz 97cbdd15c9 * Fix issues with brackets in directory names
* Update dependencies
2022-11-15 13:10:52 +01:00
bohwaz 60acfc6117 Update dependencies 2022-11-14 01:53:25 +01:00
bohwaz 3d1af68671 Fix issue with NextCloud direct URLs crashing 2022-11-04 20:52:02 +01:00
bohwaz 7356c8a574 Various security enhancements:
* forbid XML with DOCTYPE
* use a common HMAC method for consistency
* Generate a secret key and store it in local config if it does not exist
2022-10-30 00:52:35 +02:00
bohwaz 1c59441101 Use hash_hmac, it makes it clearer what this code does 2022-10-29 21:26:34 +02:00
bohwaz 7dfa0af73b Only set Access-Control-Allow-Origin to '*' when you actually want it 2022-10-28 23:57:47 +02:00
bohwaz c82952de75 Add CSRF stateless protection to forms 2022-10-28 23:42:55 +02:00
bohwaz 9b1059f307 Don't account for file overwrite for quota, as it can lead to getting over quota. Fix #2 2022-10-27 15:38:22 +02:00
bohwaz 1455e8c426 Don't use properties to store WOPI tokens, instead just create a time-limited hash 2022-10-26 01:01:01 +02:00
bohwaz 12f5d7cfbd Move ownCloud client condition from Storage to Server 2022-10-25 16:29:42 +02:00
bohwaz 8763deedd2 Add LDAP support 2022-10-25 00:35:52 +02:00
bohwaz c20dd69f8d Use user ID instead of user login 2022-10-25 00:34:50 +02:00
bohwaz 64822ba486 Add screenshots, nicer UI, users management 2022-10-24 19:06:00 +02:00
bohwaz 806a194245 Log HTTP requests and responses 2022-10-21 18:21:38 +02:00
bohwaz 4b30a2c550 Add more logging, extend WOPI token TTL 2022-10-21 17:34:08 +02:00
bohwaz 07c3711d65 Add WOPI support, tested with Collabora 2022-10-15 02:15:39 +02:00
bohwaz d9986c5434 Move JS client to a separate repo 2022-10-10 14:01:20 +02:00
bohwaz 8b32a745a4 Fix around bugs of ownCloud Android app 2022-10-03 04:44:20 +02:00
bohwaz 1448093f49 Implement NextCloud previews, thumbnails and rich workspace, fix issues on Android 2022-10-03 03:03:19 +02:00
bohwaz 40fb05debb Always try user/login before app session, useful for nextcloudcmd 2022-10-02 03:27:19 +02:00
bohwaz a050022daf Fix NextCloud support for chunked file upload 2022-10-02 02:41:46 +02:00
bohwaz 27548b45db Passing most litmus compliance tests 2022-09-30 19:35:04 +02:00
bohwaz d38e45b015 Implement chunk upload 2022-09-30 15:17:47 +02:00
bohwaz b93f8fa553 Refactor properties handling 2022-09-30 15:17:02 +02:00
bohwaz b4819c5c88 Implement Content-MD5 and digest 2022-09-30 02:42:21 +02:00