Nextcloud link share download counter
Перейти к файлу
Nextcloud bot 73326f5fd2
Fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2024-11-21 00:47:14 +00:00
.github
.tx
LICENSES
appinfo
css
js
l10n Fix(l10n): Update translations from Transifex 2024-11-21 00:47:14 +00:00
lib
src
templates
tests
.eslintrc.cjs
.gitattributes
.gitignore
.l10nignore
.php-cs-fixer.dist.php
AUTHORS.md
LICENSE
Makefile
README.md
REUSE.toml
composer.json
composer.lock
package-lock.json
package.json
psalm.xml
tsconfig.json
vite.config.ts

README.md

Files download limit

REUSE status Node GitHub Action Lint GitHub Action

This app allows limiting the number of downloads for external link shares.


API

The examples below can be run using hurl.

[!TIP] To ignore assertions pass the --ignore-asserts flag.

External share limit

An external share limit may be queried by its token.

Get

hurl get.hurl --variable token='2Nyq27RKT7Jw9q3'

get.hurl

GET https://nextcloud.local/ocs/v2.php/apps/files_downloadlimit/api/v1/{{token}}/limit

OCS-APIRequest: true
Accept: application/json

[BasicAuth]
alice: alice

HTTP 200
[Asserts]
jsonpath "$.ocs.data.limit" exists
jsonpath "$.ocs.data.count" exists

PropFind

hurl propfind.hurl --variable owner=admin --variable path=/welcome.txt

propfind.hurl

PROPFIND https://nextcloud.local/remote.php/dav/files/{{owner}}/{{path}}

[BasicAuth]
{{owner}}: {{owner}}

```xml
<?xml version="1.0"?>
<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns">
	<d:prop>
		<oc:fileid />
		<d:displayname />
		<d:getlastmodified />
		<d:getcontenttype />
		<oc:size />
		<oc:owner-id />
		<oc:share-types />
		<nc:sharees />
		<nc:share-download-limits />
	</d:prop>
</d:propfind>
```

HTTP 207
[Asserts]
xpath "//nc:share-download-limits" isCollection

Set

hurl set.hurl --variable token='2Nyq27RKT7Jw9q3' --variable limit=5

set.hurl

PUT https://nextcloud.local/ocs/v2.php/apps/files_downloadlimit/api/v1/{{token}}/limit

OCS-APIRequest: true
Accept: application/json

[BasicAuth]
alice: alice

{
	"limit": {{limit}}
}

HTTP 200
[Asserts]
jsonpath "$.ocs.data" isEmpty

Remove

hurl remove.hurl --variable token='2Nyq27RKT7Jw9q3'

remove.hurl

DELETE https://nextcloud.local/ocs/v2.php/apps/files_downloadlimit/api/v1/{{token}}/limit

OCS-APIRequest: true
Accept: application/json

[BasicAuth]
alice: alice

HTTP 200
[Asserts]
jsonpath "$.ocs.data" isEmpty

Default limit

Admins may set a default limit.

hurl set-default.hurl --variable limit=1

set-default.hurl

PUT https://nextcloud.local/ocs/v2.php/apps/files_downloadlimit/api/v1/limit

OCS-APIRequest: true
Accept: application/json

[BasicAuth]
admin: admin

{
    "limit": {{limit}}
}

HTTP 200
[Asserts]
jsonpath "$.ocs.data" isEmpty