Compare commits
40
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a85e174c35 | ||
|
|
31e1d03a38 | ||
|
|
e10d5822bb | ||
|
|
b95f4a05cf | ||
|
|
1128490ba0 | ||
|
|
698f9ba93d | ||
|
|
81bac5e97f | ||
|
|
dfb53fc52b | ||
|
|
a2d4db4ae0 | ||
|
|
bc5ab41402 | ||
|
|
a4eb34628f | ||
|
|
328579186a | ||
|
|
819cf505f8 | ||
|
|
86ec03dac5 | ||
|
|
0eeee16b1d | ||
|
|
0da7a4c668 | ||
|
|
743b10c323 | ||
|
|
d72e21bf2b | ||
|
|
6f327cc2ae | ||
|
|
7992a495eb | ||
|
|
af437186fc | ||
|
|
2f2f4d574d | ||
|
|
c75d47a75d | ||
|
|
62b7f45026 | ||
|
|
df545583d1 | ||
|
|
ce92021fea | ||
|
|
caa83ab952 | ||
|
|
be983bb96b | ||
|
|
e3c48f164a | ||
|
|
b74af1e785 | ||
|
|
dff6990e15 | ||
|
|
08c6f41fc8 | ||
|
|
a544de75c4 | ||
|
|
8e0f3b9e1c | ||
|
|
f54a6e424d | ||
|
|
dd3ad75c00 | ||
|
|
e6894474be | ||
|
|
032f5afd58 | ||
|
|
5d41175b12 | ||
|
|
ff856b3f30 |
No files matched your search
+22
-23
@@ -33,7 +33,7 @@ REDIS = "redis:6-alpine"
|
||||
SELENIUM_STANDALONE_CHROME = "selenium/standalone-chrome:104.0-20220812"
|
||||
SONARSOURCE_SONAR_SCANNER_CLI = "sonarsource/sonar-scanner-cli:5.0"
|
||||
|
||||
DEFAULT_PHP_VERSION = "7.4"
|
||||
DEFAULT_PHP_VERSION = "8.2"
|
||||
DEFAULT_NODEJS_VERSION = "18"
|
||||
|
||||
dirs = {
|
||||
@@ -238,18 +238,17 @@ def main(ctx):
|
||||
|
||||
pipelines = []
|
||||
|
||||
build_release_helpers = [
|
||||
changelog(),
|
||||
docs(),
|
||||
licenseCheck(ctx),
|
||||
]
|
||||
build_release_helpers = \
|
||||
changelog() + \
|
||||
docs() + \
|
||||
licenseCheck(ctx)
|
||||
|
||||
test_pipelines = \
|
||||
codestyle(ctx) + \
|
||||
checkTestSuitesInExpectedFailures(ctx) + \
|
||||
buildWebCache(ctx) + \
|
||||
getGoBinForTesting(ctx) + \
|
||||
[buildOcisBinaryForTesting(ctx)] + \
|
||||
buildOcisBinaryForTesting(ctx) + \
|
||||
checkStarlark() + \
|
||||
build_release_helpers + \
|
||||
testOcisAndUploadResults(ctx) + \
|
||||
@@ -543,7 +542,7 @@ def scanOcis(ctx):
|
||||
}
|
||||
|
||||
def buildOcisBinaryForTesting(ctx):
|
||||
return {
|
||||
return [{
|
||||
"kind": "pipeline",
|
||||
"type": "docker",
|
||||
"name": "build_ocis_binary_for_testing",
|
||||
@@ -563,7 +562,7 @@ def buildOcisBinaryForTesting(ctx):
|
||||
],
|
||||
},
|
||||
"volumes": [pipelineVolumeGo],
|
||||
}
|
||||
}]
|
||||
|
||||
def uploadScanResults(ctx):
|
||||
sonar_env = {
|
||||
@@ -817,7 +816,7 @@ def localApiTestPipeline(ctx):
|
||||
localApiTests(suite, storage, params["extraEnvironment"]) +
|
||||
logRequests(),
|
||||
"services": emailService() if params["emailNeeded"] else [] + clamavService() if params["antivirusNeeded"] else [],
|
||||
"depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)]),
|
||||
"depends_on": getPipelineNames(buildOcisBinaryForTesting(ctx)),
|
||||
"trigger": {
|
||||
"ref": [
|
||||
"refs/heads/stable-*",
|
||||
@@ -877,7 +876,7 @@ def cs3ApiTests(ctx, storage, accounts_hash_difficulty = 4):
|
||||
],
|
||||
},
|
||||
],
|
||||
"depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)]),
|
||||
"depends_on": getPipelineNames(buildOcisBinaryForTesting(ctx)),
|
||||
"trigger": {
|
||||
"ref": [
|
||||
"refs/heads/stable-*",
|
||||
@@ -984,7 +983,7 @@ def wopiValidatorTests(ctx, storage, accounts_hash_difficulty = 4):
|
||||
},
|
||||
] +
|
||||
validatorTests,
|
||||
"depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)]),
|
||||
"depends_on": getPipelineNames(buildOcisBinaryForTesting(ctx)),
|
||||
"trigger": {
|
||||
"ref": [
|
||||
"refs/heads/stable-*",
|
||||
@@ -1033,7 +1032,7 @@ def coreApiTests(ctx, part_number = 1, number_of_parts = 1, storage = "ocis", ac
|
||||
] +
|
||||
logRequests(),
|
||||
"services": redisForOCStorage(storage),
|
||||
"depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)]),
|
||||
"depends_on": getPipelineNames(buildOcisBinaryForTesting(ctx)),
|
||||
"trigger": {
|
||||
"ref": [
|
||||
"refs/heads/stable-*",
|
||||
@@ -1079,7 +1078,7 @@ def uiTests(ctx):
|
||||
|
||||
# For ordinary PRs, always run the "minimal" UI test pipeline
|
||||
# That has its own expected-failures file, and we always want to know that it is correct,
|
||||
if (ctx.build.event != "tag"):
|
||||
if (ctx.build.event != "tag" and ctx.build.event != "cron" and "full-ci" not in ctx.build.title.lower()):
|
||||
pipelines.append(uiTestPipeline(ctx, filterTags, 1, 2, "ocis", "smoke"))
|
||||
pipelines.append(uiTestPipeline(ctx, filterTags, 2, 2, "ocis", "smoke"))
|
||||
|
||||
@@ -1157,7 +1156,7 @@ def uiTestPipeline(ctx, filterTags, runPart = 1, numberOfParts = 1, storage = "o
|
||||
"name": "uploads",
|
||||
"temp": {},
|
||||
}],
|
||||
"depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)] + buildWebCache(ctx)),
|
||||
"depends_on": getPipelineNames(buildOcisBinaryForTesting(ctx) + buildWebCache(ctx)),
|
||||
"trigger": {
|
||||
"ref": [
|
||||
"refs/heads/stable-*",
|
||||
@@ -1242,7 +1241,7 @@ def e2eTests(ctx):
|
||||
"type": "docker",
|
||||
"name": "e2e-tests-%s" % name,
|
||||
"steps": steps,
|
||||
"depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)] + buildWebCache(ctx)),
|
||||
"depends_on": getPipelineNames(buildOcisBinaryForTesting(ctx) + buildWebCache(ctx)),
|
||||
"trigger": e2e_trigger,
|
||||
"volumes": e2e_volumes,
|
||||
})
|
||||
@@ -1564,7 +1563,7 @@ def licenseCheck(ctx):
|
||||
"target": target,
|
||||
}
|
||||
|
||||
return {
|
||||
return [{
|
||||
"kind": "pipeline",
|
||||
"type": "docker",
|
||||
"name": "check-licenses",
|
||||
@@ -1664,7 +1663,7 @@ def licenseCheck(ctx):
|
||||
],
|
||||
},
|
||||
"volumes": [pipelineVolumeGo],
|
||||
}
|
||||
}]
|
||||
|
||||
def releaseDockerManifest():
|
||||
return {
|
||||
@@ -1700,7 +1699,7 @@ def releaseDockerManifest():
|
||||
}
|
||||
|
||||
def changelog():
|
||||
return {
|
||||
return [{
|
||||
"kind": "pipeline",
|
||||
"type": "docker",
|
||||
"name": "changelog",
|
||||
@@ -1766,7 +1765,7 @@ def changelog():
|
||||
"refs/pull/**",
|
||||
],
|
||||
},
|
||||
}
|
||||
}]
|
||||
|
||||
def releaseDockerReadme(ctx):
|
||||
return {
|
||||
@@ -1802,7 +1801,7 @@ def releaseDockerReadme(ctx):
|
||||
}
|
||||
|
||||
def docs():
|
||||
return {
|
||||
return [{
|
||||
"kind": "pipeline",
|
||||
"type": "docker",
|
||||
"name": "docs",
|
||||
@@ -1871,7 +1870,7 @@ def docs():
|
||||
"refs/pull/**",
|
||||
],
|
||||
},
|
||||
}
|
||||
}]
|
||||
|
||||
def makeNodeGenerate(module):
|
||||
if module == "":
|
||||
@@ -2582,7 +2581,7 @@ def litmus(ctx, storage):
|
||||
},
|
||||
],
|
||||
"services": redisForOCStorage(storage),
|
||||
"depends_on": getPipelineNames([buildOcisBinaryForTesting(ctx)]),
|
||||
"depends_on": getPipelineNames(buildOcisBinaryForTesting(ctx)),
|
||||
"trigger": {
|
||||
"ref": [
|
||||
"refs/heads/stable-*",
|
||||
|
||||
+112
-22
@@ -1,6 +1,8 @@
|
||||
# Table of Contents
|
||||
|
||||
* [Changelog for unreleased](#changelog-for-unreleased-unreleased)
|
||||
* [Changelog for 5.0.3](#changelog-for-503-2024-05-02)
|
||||
* [Changelog for 5.0.2](#changelog-for-502-2024-04-17)
|
||||
* [Changelog for 5.0.1](#changelog-for-501-2024-04-10)
|
||||
* [Changelog for 5.0.0](#changelog-for-500-2024-03-18)
|
||||
* [Changelog for 4.0.6](#changelog-for-406-2024-02-07)
|
||||
@@ -13,8 +15,8 @@
|
||||
* [Changelog for 3.0.0](#changelog-for-300-2023-06-06)
|
||||
* [Changelog for 2.0.0](#changelog-for-200-2022-11-30)
|
||||
* [Changelog for 1.20.0](#changelog-for-1200-2022-04-13)
|
||||
* [Changelog for 1.19.1](#changelog-for-1191-2022-03-29)
|
||||
* [Changelog for 1.19.0](#changelog-for-1190-2022-03-29)
|
||||
* [Changelog for 1.19.1](#changelog-for-1191-2022-03-29)
|
||||
* [Changelog for 1.18.0](#changelog-for-1180-2022-03-03)
|
||||
* [Changelog for 1.17.0](#changelog-for-1170-2022-02-16)
|
||||
* [Changelog for 1.16.0](#changelog-for-1160-2021-12-10)
|
||||
@@ -39,7 +41,95 @@
|
||||
|
||||
The following sections list the changes for unreleased.
|
||||
|
||||
[unreleased]: https://github.com/owncloud/ocis/compare/v5.0.1...master
|
||||
[unreleased]: https://github.com/owncloud/ocis/compare/v5.0.3...master
|
||||
|
||||
## Summary
|
||||
|
||||
* Bugfix - Update reva to v2.19.7: [#9011](https://github.com/owncloud/ocis/pull/9011)
|
||||
* Bugfix - Service startup of WOPI example: [#9127](https://github.com/owncloud/ocis/pull/9127)
|
||||
* Bugfix - Nats reconnects: [#9139](https://github.com/owncloud/ocis/pull/9139)
|
||||
|
||||
## Details
|
||||
|
||||
* Bugfix - Update reva to v2.19.7: [#9011](https://github.com/owncloud/ocis/pull/9011)
|
||||
|
||||
We updated reva to v2.19.7
|
||||
|
||||
* Enhancement [cs3org/reva#4673](https://github.com/cs3org/reva/pull/4673): Add virus filter to list uploads sessions
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9011
|
||||
|
||||
* Bugfix - Service startup of WOPI example: [#9127](https://github.com/owncloud/ocis/pull/9127)
|
||||
|
||||
We fixed a bug in the service startup of the appprovider-onlyoffice in the
|
||||
ocis_wopi deployment example.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9127
|
||||
|
||||
* Bugfix - Nats reconnects: [#9139](https://github.com/owncloud/ocis/pull/9139)
|
||||
|
||||
We fixed the reconnect handling of the natjs kv registry.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9139
|
||||
https://github.com/owncloud/ocis/pull/8880
|
||||
|
||||
# Changelog for [5.0.3] (2024-05-02)
|
||||
|
||||
The following sections list the changes for 5.0.3.
|
||||
|
||||
[5.0.3]: https://github.com/owncloud/ocis/compare/v5.0.2...v5.0.3
|
||||
|
||||
## Summary
|
||||
|
||||
* Bugfix - Update the admin user role assignment to enforce the config: [#8918](https://github.com/owncloud/ocis/pull/8918)
|
||||
* Bugfix - Crash when processing crafted TIFF files: [#8981](https://github.com/owncloud/ocis/pull/8981)
|
||||
* Bugfix - Update reva to v2.19.6: [#9011](https://github.com/owncloud/ocis/pull/9011)
|
||||
* Bugfix - Fix infected file handling: [#9011](https://github.com/owncloud/ocis/pull/9011)
|
||||
|
||||
## Details
|
||||
|
||||
* Bugfix - Update the admin user role assignment to enforce the config: [#8918](https://github.com/owncloud/ocis/pull/8918)
|
||||
|
||||
The admin user role assigment was not updated after the first assignment. We now
|
||||
read the assigned role during init and update the admin user ID accordingly if
|
||||
the role is not assigned. This is especially needed when the OCIS_ADMIN_USER_ID
|
||||
is set after the autoprovisioning of the admin user when it originates from an
|
||||
external Identity Provider.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/8918
|
||||
https://github.com/owncloud/ocis/pull/8897
|
||||
|
||||
* Bugfix - Crash when processing crafted TIFF files: [#8981](https://github.com/owncloud/ocis/pull/8981)
|
||||
|
||||
Fix for a vulnerability with low severity in disintegration/imaging.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/8981
|
||||
https://github.com/advisories/GHSA-q7pp-wcgr-pffx
|
||||
|
||||
* Bugfix - Update reva to v2.19.6: [#9011](https://github.com/owncloud/ocis/pull/9011)
|
||||
|
||||
We updated reva to v2.19.6
|
||||
|
||||
* Bugfix [cs3org/reva#4654](https://github.com/cs3org/reva/pull/4654): Write blob based on session id
|
||||
* Bugfix [cs3org/reva#4666](https://github.com/cs3org/reva/pull/4666): Fix uploading via a public link
|
||||
* Bugfix [cs3org/reva#4665](https://github.com/cs3org/reva/pull/4665): Fix creating documents in nested folders of public shares
|
||||
* Enhancement [cs3org/reva#4655](https://github.com/cs3org/reva/pull/4655): Bump mockery to v2.40.2
|
||||
* Enhancement [cs3org/reva#4664](https://github.com/cs3org/reva/pull/4664): Add ScanData to Uploadsession
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9011
|
||||
|
||||
* Bugfix - Fix infected file handling: [#9011](https://github.com/owncloud/ocis/pull/9011)
|
||||
|
||||
Reworks virus handling. Shows scandate and outcome on ocis storage-users uploads
|
||||
sessions. Avoids retrying infected files on ocis postprocessing restart.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9011
|
||||
|
||||
# Changelog for [5.0.2] (2024-04-17)
|
||||
|
||||
The following sections list the changes for 5.0.2.
|
||||
|
||||
[5.0.2]: https://github.com/owncloud/ocis/compare/v5.0.1...v5.0.2
|
||||
|
||||
## Summary
|
||||
|
||||
@@ -7330,7 +7420,7 @@ The following sections list the changes for 2.0.0.
|
||||
|
||||
The following sections list the changes for 1.20.0.
|
||||
|
||||
[1.20.0]: https://github.com/owncloud/ocis/compare/v1.19.1...v1.20.0
|
||||
[1.20.0]: https://github.com/owncloud/ocis/compare/v1.19.0...v1.20.0
|
||||
|
||||
## Summary
|
||||
|
||||
@@ -7504,29 +7594,11 @@ The following sections list the changes for 1.20.0.
|
||||
https://github.com/owncloud/ocis/pull/3509
|
||||
https://github.com/owncloud/web/releases/tag/v5.4.0
|
||||
|
||||
# Changelog for [1.19.1] (2022-03-29)
|
||||
|
||||
The following sections list the changes for 1.19.1.
|
||||
|
||||
[1.19.1]: https://github.com/owncloud/ocis/compare/v1.19.0...v1.19.1
|
||||
|
||||
## Summary
|
||||
|
||||
* Bugfix - Return correct special item urls: [#3419](https://github.com/owncloud/ocis/pull/3419)
|
||||
|
||||
## Details
|
||||
|
||||
* Bugfix - Return correct special item urls: [#3419](https://github.com/owncloud/ocis/pull/3419)
|
||||
|
||||
URLs for Special items (space image, readme) were broken.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/3419
|
||||
|
||||
# Changelog for [1.19.0] (2022-03-29)
|
||||
|
||||
The following sections list the changes for 1.19.0.
|
||||
|
||||
[1.19.0]: https://github.com/owncloud/ocis/compare/v1.18.0...v1.19.0
|
||||
[1.19.0]: https://github.com/owncloud/ocis/compare/v1.19.1...v1.19.0
|
||||
|
||||
## Summary
|
||||
|
||||
@@ -7700,6 +7772,24 @@ The following sections list the changes for 1.19.0.
|
||||
https://github.com/owncloud/ocis/pull/3375
|
||||
https://github.com/owncloud/web/releases/tag/v5.3.0
|
||||
|
||||
# Changelog for [1.19.1] (2022-03-29)
|
||||
|
||||
The following sections list the changes for 1.19.1.
|
||||
|
||||
[1.19.1]: https://github.com/owncloud/ocis/compare/v1.18.0...v1.19.1
|
||||
|
||||
## Summary
|
||||
|
||||
* Bugfix - Return correct special item urls: [#3419](https://github.com/owncloud/ocis/pull/3419)
|
||||
|
||||
## Details
|
||||
|
||||
* Bugfix - Return correct special item urls: [#3419](https://github.com/owncloud/ocis/pull/3419)
|
||||
|
||||
URLs for Special items (space image, readme) were broken.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/3419
|
||||
|
||||
# Changelog for [1.18.0] (2022-03-03)
|
||||
|
||||
The following sections list the changes for 1.18.0.
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
Bugfix: Crash when processing crafted TIFF files
|
||||
|
||||
Fix for a vulnerability with low severity in disintegration/imaging.
|
||||
|
||||
https://github.com/advisories/GHSA-q7pp-wcgr-pffx
|
||||
https://github.com/owncloud/ocis/pull/8981
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Bugfix: Update reva to v2.19.6
|
||||
|
||||
We updated reva to v2.19.6
|
||||
|
||||
* Bugfix [cs3org/reva#4654](https://github.com/cs3org/reva/pull/4654): Write blob based on session id
|
||||
* Bugfix [cs3org/reva#4666](https://github.com/cs3org/reva/pull/4666): Fix uploading via a public link
|
||||
* Bugfix [cs3org/reva#4665](https://github.com/cs3org/reva/pull/4665): Fix creating documents in nested folders of public shares
|
||||
* Enhancement [cs3org/reva#4655](https://github.com/cs3org/reva/pull/4655): Bump mockery to v2.40.2
|
||||
* Enhancement [cs3org/reva#4664](https://github.com/cs3org/reva/pull/4664): Add ScanData to Uploadsession
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9011
|
||||
@@ -0,0 +1,7 @@
|
||||
Bugfix: Update the admin user role assignment to enforce the config
|
||||
|
||||
The admin user role assigment was not updated after the first assignment. We now read the assigned role during init and update the admin user ID accordingly if the role is not assigned.
|
||||
This is especially needed when the OCIS_ADMIN_USER_ID is set after the autoprovisioning of the admin user when it originates from an external Identity Provider.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/8918
|
||||
https://github.com/owncloud/ocis/pull/8897
|
||||
@@ -0,0 +1,5 @@
|
||||
Bugfix: Fix infected file handling
|
||||
|
||||
Reworks virus handling. Shows scandate and outcome on ocis storage-users uploads sessions. Avoids retrying infected files on ocis postprocessing restart.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9011
|
||||
@@ -0,0 +1,7 @@
|
||||
Bugfix: Update reva to v2.19.7
|
||||
|
||||
We updated reva to v2.19.7
|
||||
|
||||
* Enhancement [cs3org/reva#4673](https://github.com/cs3org/reva/pull/4673): Add virus filter to list uploads sessions
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9011
|
||||
@@ -0,0 +1,5 @@
|
||||
Bugfix: Service startup of WOPI example
|
||||
|
||||
We fixed a bug in the service startup of the appprovider-onlyoffice in the ocis_wopi deployment example.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9127
|
||||
@@ -0,0 +1,6 @@
|
||||
Bugfix: Nats reconnects
|
||||
|
||||
We fixed the reconnect handling of the natjs kv registry.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9139
|
||||
https://github.com/owncloud/ocis/pull/8880
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "owncloud/ocis",
|
||||
"config" : {
|
||||
"platform": {
|
||||
"php": "7.4"
|
||||
"php": "8.2"
|
||||
},
|
||||
"vendor-dir": "./vendor-php",
|
||||
"allow-plugins": {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
env:
|
||||
INSECURE: "false"
|
||||
TRAEFIK_ACME_MAIL: mbarz@owncloud.com
|
||||
OCIS_DOCKER_TAG: 5.0.1
|
||||
OCIS_DOCKER_TAG: 5.0.4
|
||||
OCIS_DOMAIN: ocis.ocis-keycloak.released.owncloud.works
|
||||
KEYCLOAK_DOMAIN: keycloak.ocis-keycloak.released.owncloud.works
|
||||
COMPOSE_FILE: docker-compose.yml:monitoring_tracing/docker-compose-additions.yml
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
env:
|
||||
INSECURE: "false"
|
||||
TRAEFIK_ACME_MAIL: mbarz@owncloud.com
|
||||
OCIS_DOCKER_TAG: 5.0.1
|
||||
OCIS_DOCKER_TAG: 5.0.4
|
||||
OCIS_DOMAIN: ocis.ocis-ldap.released.owncloud.works
|
||||
LDAP_MANAGER_DOMAIN: ldap.ocis-ldap.released.owncloud.works
|
||||
COMPOSE_FILE: docker-compose.yml:monitoring_tracing/docker-compose-additions.yml
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
env:
|
||||
INSECURE: "false"
|
||||
TRAEFIK_ACME_MAIL: mbarz@owncloud.com
|
||||
OCIS_DOCKER_TAG: 5.0.1
|
||||
OCIS_DOCKER_TAG: 5.0.4
|
||||
OCIS_DOMAIN: ocis.ocis-traefik.released.owncloud.works
|
||||
DEMO_USERS: "true"
|
||||
INBUCKET_DOMAIN: mail.ocis-traefik.released.owncloud.works
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
env:
|
||||
INSECURE: "false"
|
||||
TRAEFIK_ACME_MAIL: mbarz@owncloud.com
|
||||
OCIS_DOCKER_TAG: 5.0.2-rc.1
|
||||
OCIS_DOCKER_TAG: 5.0.4
|
||||
OCIS_DOMAIN: ocis.ocis-wopi.released.owncloud.works
|
||||
COMPANION_DOMAIN: companion.ocis-wopi.released.owncloud.works
|
||||
COMPANION_IMAGE: owncloud/uppy-companion:3.12.13-owncloud
|
||||
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
apk add curl
|
||||
|
||||
#TODO: app driver itself should try again until OnlyOffice is up...
|
||||
|
||||
retries=10
|
||||
while [[ $retries -gt 0 ]]; do
|
||||
if curl --silent --show-error --fail http://onlyoffice/hosting/discovery > /dev/null; then
|
||||
ocis app-provider server
|
||||
else
|
||||
echo "OnlyOffice is not yet available, trying again in 10 seconds"
|
||||
sleep 10
|
||||
retries=$((retries - 1))
|
||||
fi
|
||||
done
|
||||
echo 'OnlyOffice was not available after 100 seconds'
|
||||
exit 1
|
||||
@@ -1,18 +0,0 @@
|
||||
web:
|
||||
config:
|
||||
external_apps:
|
||||
- id: preview
|
||||
path: web-app-preview
|
||||
config:
|
||||
mimeTypes:
|
||||
- image/tiff
|
||||
- image/bmp
|
||||
- image/x-ms-bmp
|
||||
- id: importer
|
||||
path: web-app-importer
|
||||
config:
|
||||
companionUrl: https://companion.ocis-wopi.latest.owncloud.works
|
||||
supportedClouds:
|
||||
- WebdavPublicLink
|
||||
#- OneDrive # needs a client id and secret
|
||||
#- GoogleDrive # needs a client id and secret and an addition to the DNS zone
|
||||
@@ -1,18 +0,0 @@
|
||||
web:
|
||||
config:
|
||||
external_apps:
|
||||
- id: preview
|
||||
path: web-app-preview
|
||||
config:
|
||||
mimeTypes:
|
||||
- image/tiff
|
||||
- image/bmp
|
||||
- image/x-ms-bmp
|
||||
- id: importer
|
||||
path: web-app-importer
|
||||
config:
|
||||
companionUrl: https://companion.ocis-wopi.released.owncloud.works
|
||||
supportedClouds:
|
||||
- WebdavPublicLink
|
||||
#- OneDrive # needs a client id and secret
|
||||
#- GoogleDrive # needs a client id and secret and an addition to the DNS zone
|
||||
+1
-1
@@ -11,7 +11,7 @@ web:
|
||||
- id: importer
|
||||
path: web-app-importer
|
||||
config:
|
||||
companionUrl: https://companion.ocis-wopi.daily.owncloud.works
|
||||
companionUrl: https://${COMPANION_DOMAIN|companion.owncloud.test}
|
||||
supportedClouds:
|
||||
- WebdavPublicLink
|
||||
#- OneDrive # needs a client id and secret
|
||||
@@ -36,7 +36,7 @@ services:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
||||
- "${DOCKER_SOCKET_PATH:-/var/run/docker.sock}:/var/run/docker.sock:ro"
|
||||
- "certs:/certs"
|
||||
labels:
|
||||
- "traefik.enable=${TRAEFIK_DASHBOARD:-false}"
|
||||
@@ -47,7 +47,7 @@ services:
|
||||
- "traefik.http.routers.traefik.tls.certresolver=http"
|
||||
- "traefik.http.routers.traefik.service=api@internal"
|
||||
logging:
|
||||
driver: "local"
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
|
||||
ocis:
|
||||
@@ -90,7 +90,7 @@ services:
|
||||
NATS_NATS_PORT: 9233
|
||||
volumes:
|
||||
- ./config/ocis/app-registry.yaml:/etc/ocis/app-registry.yaml
|
||||
- ./config/ocis/${COMPANION_WEB_CONFIG_FILE_NAME:-web.yaml}:/etc/ocis/web.yaml
|
||||
- ./config/ocis/web.yaml:/etc/ocis/web.yaml
|
||||
- ocis-config:/etc/ocis
|
||||
- ocis-data:/var/lib/ocis
|
||||
labels:
|
||||
@@ -101,7 +101,7 @@ services:
|
||||
- "traefik.http.routers.ocis.service=ocis"
|
||||
- "traefik.http.services.ocis.loadbalancer.server.port=9200"
|
||||
logging:
|
||||
driver: "local"
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
|
||||
ocis-appprovider-collabora:
|
||||
@@ -110,6 +110,7 @@ services:
|
||||
ocis-net:
|
||||
command: app-provider server
|
||||
environment:
|
||||
OCIS_LOG_LEVEL: ${OCIS_LOG_LEVEL:-info}
|
||||
# use the internal service name of the gateway
|
||||
REVA_GATEWAY: ${REVA_GATEWAY:-com.owncloud.api.gateway}
|
||||
APP_PROVIDER_GRPC_ADDR: 0.0.0.0:9164
|
||||
@@ -129,19 +130,21 @@ services:
|
||||
volumes:
|
||||
- ocis-config:/etc/ocis
|
||||
logging:
|
||||
driver: "local"
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
depends_on:
|
||||
ocis:
|
||||
condition: service_started
|
||||
collabora:
|
||||
condition: service_healthy
|
||||
|
||||
ocis-appprovider-onlyoffice:
|
||||
image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
|
||||
networks:
|
||||
ocis-net:
|
||||
user: "0" # needed for apk add in entrypoint script
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
- /entrypoint-override.sh
|
||||
#command: app-provider server
|
||||
command: app-provider server
|
||||
environment:
|
||||
OCIS_LOG_LEVEL: ${OCIS_LOG_LEVEL:-info}
|
||||
# use the internal service name of the gateway
|
||||
REVA_GATEWAY: ${REVA_GATEWAY:-com.owncloud.api.gateway}
|
||||
APP_PROVIDER_GRPC_ADDR: 0.0.0.0:9164
|
||||
@@ -159,11 +162,15 @@ services:
|
||||
# share the registry with the ocis container
|
||||
MICRO_REGISTRY_ADDRESS: ocis:9233
|
||||
volumes:
|
||||
- ./config/ocis-appprovider-onlyoffice/entrypoint-override.sh:/entrypoint-override.sh
|
||||
- ocis-config:/etc/ocis
|
||||
logging:
|
||||
driver: "local"
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
depends_on:
|
||||
ocis:
|
||||
condition: service_started
|
||||
onlyoffice:
|
||||
condition: service_healthy
|
||||
|
||||
wopiserver:
|
||||
image: cs3org/wopiserver:${WOPISERVER_DOCKER_TAG:-v10.3.0}
|
||||
@@ -188,7 +195,7 @@ services:
|
||||
- "traefik.http.routers.wopiserver.service=wopiserver"
|
||||
- "traefik.http.services.wopiserver.loadbalancer.server.port=8880"
|
||||
logging:
|
||||
driver: "local"
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
|
||||
collabora:
|
||||
@@ -211,8 +218,10 @@ services:
|
||||
- "traefik.http.routers.collabora.service=collabora"
|
||||
- "traefik.http.services.collabora.loadbalancer.server.port=9980"
|
||||
logging:
|
||||
driver: "local"
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:9980/hosting/discovery"]
|
||||
|
||||
onlyoffice:
|
||||
image: onlyoffice/documentserver:7.5.0
|
||||
@@ -238,8 +247,10 @@ services:
|
||||
- "traefik.http.middlewares.onlyoffice.headers.customrequestheaders.X-Forwarded-Proto=https"
|
||||
- "traefik.http.routers.onlyoffice.middlewares=onlyoffice"
|
||||
logging:
|
||||
driver: "local"
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost/hosting/discovery"]
|
||||
|
||||
tika:
|
||||
image: ${TIKA_IMAGE:-apache/tika:latest-full}
|
||||
@@ -270,7 +281,7 @@ services:
|
||||
- "traefik.http.routers.companion.service=companion"
|
||||
- "traefik.http.services.companion.loadbalancer.server.port=3020"
|
||||
logging:
|
||||
driver: "local"
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
|
||||
inbucket:
|
||||
@@ -293,7 +304,7 @@ services:
|
||||
- "traefik.http.routers.inbucket.service=inbucket"
|
||||
- "traefik.http.services.inbucket.loadbalancer.server.port=9000"
|
||||
logging:
|
||||
driver: "local"
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
|
||||
@@ -41,6 +41,7 @@ The last four containers are the WOPI server, Collabora and OnlyOffice.
|
||||
* onlyoffice.* for serving OnlyOffice
|
||||
* wopiserver.* for serving the WOPI server
|
||||
* traefik.* for serving the Traefik dashboard
|
||||
* companion.* for serving the uppy companion app
|
||||
|
||||
See also [example server setup]({{< ref "preparing_server" >}})
|
||||
|
||||
@@ -68,7 +69,7 @@ See also [example server setup]({{< ref "preparing_server" >}})
|
||||
TRAEFIK_DASHBOARD=
|
||||
# Domain of Traefik, where you can find the dashboard. Defaults to "traefik.owncloud.test"
|
||||
TRAEFIK_DOMAIN=
|
||||
# Basic authentication for the dashboard. Defaults to user "admin" and password "admin"
|
||||
# Basic authentication for the dashboard. Defaults to user "admin" and password "admin" (written as: "admin:admin").
|
||||
TRAEFIK_BASIC_AUTH_USERS=
|
||||
# Email address for obtaining LetsEncrypt certificates, needs only be changed if this is a public facing server
|
||||
TRAEFIK_ACME_MAIL=
|
||||
@@ -83,6 +84,8 @@ See also [example server setup]({{< ref "preparing_server" >}})
|
||||
# The demo users should not be created on a production instance
|
||||
# because their passwords are public. Defaults to "false".
|
||||
DEMO_USERS=
|
||||
# Log level for oCIS. Defaults to "info".
|
||||
OCIS_LOG_LEVEL=
|
||||
|
||||
### Wopi server settings ###
|
||||
# cs3org wopi server version. Defaults to "v8.3.3"
|
||||
@@ -95,7 +98,7 @@ See also [example server setup]({{< ref "preparing_server" >}})
|
||||
### Collabora settings ###
|
||||
# Domain of Collabora, where you can find the frontend. Defaults to "collabora.owncloud.test"
|
||||
COLLABORA_DOMAIN=
|
||||
# Admin user for Collabora. Defaults to blank, provide one to enable access
|
||||
# Admin user for Collabora. Defaults to blank, provide one to enable access. Collabora Admin Panel URL: https://{COLLABORA_DOMAIN}/browser/dist/admin/admin.html
|
||||
COLLABORA_ADMIN_USER=
|
||||
# Admin password for Collabora. Defaults to blank, provide one to enable access
|
||||
COLLABORA_ADMIN_PASSWORD=
|
||||
@@ -103,6 +106,27 @@ See also [example server setup]({{< ref "preparing_server" >}})
|
||||
### OnlyOffice settings ###
|
||||
# Domain of OnlyOffice, where you can find the frontend. Defaults to "onlyoffice.owncloud.test"
|
||||
ONLYOFFICE_DOMAIN=
|
||||
|
||||
### Email / Inbucket settings ###
|
||||
# Inbucket / Mail domain. Defaults to "mail.owncloud.test"
|
||||
INBUCKET_DOMAIN=
|
||||
|
||||
### Apache Tika Content analysis toolkit ###
|
||||
# Set the desired docker image tag or digest, defaults to "latest"
|
||||
TIKA_IMAGE=
|
||||
|
||||
# If you want to use debugging and tracing with this stack,
|
||||
# you need uncomment following line. Please see documentation at
|
||||
# https://owncloud.dev/ocis/deployment/monitoring-tracing/
|
||||
#COMPOSE_FILE=docker-compose.yml:monitoring_tracing/docker-compose-additions.yml
|
||||
|
||||
### Uppy Companion settings ###
|
||||
# Domain of Uppy Companion. Defaults to "companion.owncloud.test"
|
||||
COMPANION_IMAGE=
|
||||
COMPANION_DOMAIN=
|
||||
# Provider settings, see https://uppy.io/docs/companion/#provideroptions for reference. Empty by default, which disables providers.
|
||||
COMPANION_ONEDRIVE_KEY=
|
||||
COMPANION_ONEDRIVE_SECRET=
|
||||
```
|
||||
|
||||
You are installing oCIS on a server and Traefik will obtain valid certificates for you so please remove `INSECURE=true` or set it to `false`.
|
||||
@@ -152,6 +176,8 @@ On Linux and macOS you can add them to your `/etc/hosts` file and on Windows to
|
||||
127.0.0.1 collabora.owncloud.test
|
||||
127.0.0.1 onlyoffice.owncloud.test
|
||||
127.0.0.1 wopiserver.owncloud.test
|
||||
127.0.0.1 mail.owncloud.test
|
||||
127.0.0.1 companion.owncloud.test
|
||||
```
|
||||
|
||||
After that you're ready to start the application stack:
|
||||
|
||||
@@ -13,9 +13,8 @@ require (
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible
|
||||
github.com/coreos/go-oidc/v3 v3.9.0
|
||||
github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781
|
||||
github.com/cs3org/reva/v2 v2.19.5
|
||||
github.com/cs3org/reva/v2 v2.19.7
|
||||
github.com/dhowden/tag v0.0.0-20230630033851-978a0926ee25
|
||||
github.com/disintegration/imaging v1.6.2
|
||||
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e
|
||||
github.com/egirna/icap-client v0.1.1
|
||||
github.com/gabriel-vasile/mimetype v1.4.3
|
||||
@@ -54,6 +53,7 @@ require (
|
||||
github.com/jellydator/ttlcache/v3 v3.2.0
|
||||
github.com/jinzhu/now v1.1.5
|
||||
github.com/justinas/alice v1.2.0
|
||||
github.com/kovidgoyal/imaging v1.6.3
|
||||
github.com/leonelquinteros/gotext v1.5.3-0.20230317130943-71a59c05b2c1
|
||||
github.com/libregraph/idm v0.4.1-0.20231213140724-56a222fb4215
|
||||
github.com/libregraph/lico v0.61.3-0.20240322112242-72cf9221d3a7
|
||||
|
||||
@@ -1019,8 +1019,10 @@ github.com/crewjam/saml v0.4.14 h1:g9FBNx62osKusnFzs3QTN5L9CVA/Egfgm+stJShzw/c=
|
||||
github.com/crewjam/saml v0.4.14/go.mod h1:UVSZCf18jJkk6GpWNVqcyQJMD5HsRugBPf4I1nl2mME=
|
||||
github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781 h1:BUdwkIlf8IS2FasrrPg8gGPHQPOrQ18MS1Oew2tmGtY=
|
||||
github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
|
||||
github.com/cs3org/reva/v2 v2.19.5 h1:Qh38wpPovnb0jPpgGR6L6HfbQ8vwObcrB8yUCRJldSw=
|
||||
github.com/cs3org/reva/v2 v2.19.5/go.mod h1:GRUrOp5HbFVwZTgR9bVrMZ/MvVy+Jhxw1PdMmhhKP9E=
|
||||
github.com/cs3org/reva/v2 v2.19.6 h1:n7fsTwdIN20vmQFkfOiJUbF2D7JFMLLMgOnEBRM5OTU=
|
||||
github.com/cs3org/reva/v2 v2.19.6/go.mod h1:GRUrOp5HbFVwZTgR9bVrMZ/MvVy+Jhxw1PdMmhhKP9E=
|
||||
github.com/cs3org/reva/v2 v2.19.7 h1:0hMIbCZq1VBSxAslEvDDkj1Si8RqxbxR0wx3JvIRXTE=
|
||||
github.com/cs3org/reva/v2 v2.19.7/go.mod h1:GRUrOp5HbFVwZTgR9bVrMZ/MvVy+Jhxw1PdMmhhKP9E=
|
||||
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
|
||||
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
|
||||
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
|
||||
@@ -1048,8 +1050,6 @@ github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8
|
||||
github.com/dhowden/tag v0.0.0-20230630033851-978a0926ee25 h1:simG0vMYFvNriGhaaat7QVVkaVkXzvqcohaBoLZl9Hg=
|
||||
github.com/dhowden/tag v0.0.0-20230630033851-978a0926ee25/go.mod h1:Z3Lomva4pyMWYezjMAU5QWRh0p1VvO4199OHlFnyKkM=
|
||||
github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8=
|
||||
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
|
||||
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
|
||||
github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E=
|
||||
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
||||
github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
|
||||
@@ -1601,6 +1601,8 @@ github.com/kolo/xmlrpc v0.0.0-20200310150728-e0350524596b/go.mod h1:o03bZfuBwAXH
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kovidgoyal/imaging v1.6.3 h1:iNPpv7ygiaB/NOztc6APMT7yr9UwBS+rOZwIbAdtyY8=
|
||||
github.com/kovidgoyal/imaging v1.6.3/go.mod h1:sHvcLOOVhJuto2IoNdPLEqnAUoL5ZfHEF0PpNH+882g=
|
||||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
@@ -2190,7 +2192,6 @@ golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86h
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
|
||||
@@ -5,8 +5,10 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
natsjskv "github.com/go-micro/plugins/v4/store/nats-js-kv"
|
||||
@@ -36,12 +38,13 @@ func NewRegistry(opts ...registry.Option) registry.Registry {
|
||||
o(&options)
|
||||
}
|
||||
exp, _ := options.Context.Value(expiryKey{}).(time.Duration)
|
||||
return &storeregistry{
|
||||
n := &storeregistry{
|
||||
opts: options,
|
||||
store: natsjskv.NewStore(storeOptions(options)...),
|
||||
typ: _registryName,
|
||||
expiry: exp,
|
||||
}
|
||||
n.store = natsjskv.NewStore(n.storeOptions(options)...)
|
||||
return n
|
||||
}
|
||||
|
||||
type storeregistry struct {
|
||||
@@ -49,14 +52,19 @@ type storeregistry struct {
|
||||
store store.Store
|
||||
typ string
|
||||
expiry time.Duration
|
||||
lock sync.RWMutex
|
||||
}
|
||||
|
||||
// Init inits the registry
|
||||
func (n *storeregistry) Init(opts ...registry.Option) error {
|
||||
n.lock.Lock()
|
||||
defer n.lock.Unlock()
|
||||
|
||||
for _, o := range opts {
|
||||
o(&n.opts)
|
||||
}
|
||||
return n.store.Init(storeOptions(n.opts)...)
|
||||
n.store = natsjskv.NewStore(n.storeOptions(n.opts)...)
|
||||
return n.store.Init(n.storeOptions(n.opts)...)
|
||||
}
|
||||
|
||||
// Options returns the configured options
|
||||
@@ -66,6 +74,9 @@ func (n *storeregistry) Options() registry.Options {
|
||||
|
||||
// Register adds a service to the registry
|
||||
func (n *storeregistry) Register(s *registry.Service, _ ...registry.RegisterOption) error {
|
||||
n.lock.RLock()
|
||||
defer n.lock.RUnlock()
|
||||
|
||||
if s == nil {
|
||||
return errors.New("wont store nil service")
|
||||
}
|
||||
@@ -82,11 +93,17 @@ func (n *storeregistry) Register(s *registry.Service, _ ...registry.RegisterOpti
|
||||
|
||||
// Deregister removes a service from the registry
|
||||
func (n *storeregistry) Deregister(s *registry.Service, _ ...registry.DeregisterOption) error {
|
||||
n.lock.RLock()
|
||||
defer n.lock.RUnlock()
|
||||
|
||||
return n.store.Delete(s.Name)
|
||||
}
|
||||
|
||||
// GetService gets a specific service from the registry
|
||||
func (n *storeregistry) GetService(s string, _ ...registry.GetOption) ([]*registry.Service, error) {
|
||||
n.lock.RLock()
|
||||
defer n.lock.RUnlock()
|
||||
|
||||
recs, err := n.store.Read(s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -104,6 +121,9 @@ func (n *storeregistry) GetService(s string, _ ...registry.GetOption) ([]*regist
|
||||
|
||||
// ListServices lists all registered services
|
||||
func (n *storeregistry) ListServices(...registry.ListOption) ([]*registry.Service, error) {
|
||||
n.lock.RLock()
|
||||
defer n.lock.RUnlock()
|
||||
|
||||
keys, err := n.store.List()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -132,7 +152,7 @@ func (n *storeregistry) String() string {
|
||||
return n.typ
|
||||
}
|
||||
|
||||
func storeOptions(opts registry.Options) []store.Option {
|
||||
func (n *storeregistry) storeOptions(opts registry.Options) []store.Option {
|
||||
storeoptions := []store.Option{
|
||||
store.Database("service-registry"),
|
||||
store.Table("service-registry"),
|
||||
@@ -150,6 +170,16 @@ func storeOptions(opts registry.Options) []store.Option {
|
||||
natsOptions := nats.GetDefaultOptions()
|
||||
natsOptions.Name = "nats-js-kv-registry"
|
||||
natsOptions.User, natsOptions.Password = getAuth()
|
||||
natsOptions.ReconnectedCB = func(_ *nats.Conn) {
|
||||
if err := n.Init(); err != nil {
|
||||
fmt.Println("cannot reconnect to nats")
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
natsOptions.ClosedCB = func(_ *nats.Conn) {
|
||||
fmt.Println("nats connection closed")
|
||||
os.Exit(1)
|
||||
}
|
||||
storeoptions = append(storeoptions, natsjskv.NatsOptions(natsOptions))
|
||||
|
||||
if so, ok := opts.Context.Value(storeOptionsKey{}).([]store.Option); ok {
|
||||
|
||||
@@ -16,7 +16,7 @@ var (
|
||||
// LatestTag is the latest released version plus the dev meta version.
|
||||
// Will be overwritten by the release pipeline
|
||||
// Needs a manual change for every tagged release
|
||||
LatestTag = "5.0.2+dev"
|
||||
LatestTag = "5.0.4+dev"
|
||||
|
||||
// Date indicates the build date.
|
||||
// This has been removed, it looks like you can only replace static strings with recent go versions
|
||||
|
||||
@@ -146,7 +146,7 @@ func (av Antivirus) processEvent(e events.Event, s events.Publisher) error {
|
||||
}
|
||||
|
||||
if av.c.DebugScanOutcome != "" {
|
||||
av.l.Warn().Str("antivir, clamav", ">>>>>>> ANTIVIRUS_DEBUG_SCAN_OUTCOME IS SET NO ACTUAL VIRUS SCAN IS PERFORMED!")
|
||||
av.l.Warn().Str("antivir, clamav", ">>>>>>> ANTIVIRUS_DEBUG_SCAN_OUTCOME IS SET NO ACTUAL VIRUS SCAN IS PERFORMED!").Send()
|
||||
if err := events.Publish(ctx, s, events.PostprocessingStepFinished{
|
||||
FinishedStep: events.PPStepAntivirus,
|
||||
Outcome: events.PostprocessingOutcome(av.c.DebugScanOutcome),
|
||||
@@ -158,7 +158,6 @@ func (av Antivirus) processEvent(e events.Event, s events.Publisher) error {
|
||||
Description: "DEBUG: forced outcome",
|
||||
Scandate: time.Now(),
|
||||
ResourceID: ev.ResourceID,
|
||||
ErrorMsg: "DEBUG: forced outcome",
|
||||
},
|
||||
}); err != nil {
|
||||
av.l.Fatal().Err(err).Str("uploadid", ev.UploadID).Interface("resourceID", ev.ResourceID).Msg("cannot publish events - exiting")
|
||||
|
||||
@@ -97,6 +97,11 @@ func (cl *ClientlogService) processEvent(event events.Event) {
|
||||
default:
|
||||
err = errors.New("unhandled event")
|
||||
case events.UploadReady:
|
||||
if e.Failed {
|
||||
// we don't inform about failed uploads yet
|
||||
return
|
||||
}
|
||||
|
||||
info, err := utils.GetResource(ctx, e.FileRef, gwc)
|
||||
if err != nil {
|
||||
cl.log.Error().Err(err).Interface("event", event).Msg("error getting resource")
|
||||
|
||||
@@ -21,6 +21,7 @@ type Postprocessing struct {
|
||||
Steps []events.Postprocessingstep
|
||||
Status Status
|
||||
Failures int
|
||||
Finished bool
|
||||
|
||||
config config.Postprocessing
|
||||
}
|
||||
|
||||
@@ -148,8 +148,14 @@ func (pps *PostprocessingService) processEvent(e events.Event) error {
|
||||
next = pp.Delay()
|
||||
case events.UploadReady:
|
||||
if ev.Failed {
|
||||
// the upload failed - let's keep it around for a while
|
||||
return nil
|
||||
// the upload failed - let's keep it around for a while - but mark it as finished
|
||||
pp, err = pps.getPP(pps.store, ev.UploadID)
|
||||
if err != nil {
|
||||
pps.log.Error().Str("uploadID", ev.UploadID).Err(err).Msg("cannot get upload")
|
||||
return fmt.Errorf("%w: cannot get upload", ErrEvent)
|
||||
}
|
||||
pp.Finished = true
|
||||
return storePP(pps.store, pp)
|
||||
}
|
||||
|
||||
// the storage provider thinks the upload is done - so no need to keep it any more
|
||||
@@ -256,6 +262,11 @@ func (pps *PostprocessingService) resumePP(ctx context.Context, uploadID string)
|
||||
return fmt.Errorf("cannot get upload: %w", err)
|
||||
}
|
||||
|
||||
if pp.Finished {
|
||||
// dont retry finished uploads
|
||||
return nil
|
||||
}
|
||||
|
||||
return events.Publish(ctx, pps.pub, pp.CurrentStep())
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"log"
|
||||
"sync"
|
||||
|
||||
"github.com/cs3org/reva/v2/pkg/errtypes"
|
||||
"github.com/cs3org/reva/v2/pkg/storage/utils/metadata"
|
||||
"github.com/gofrs/uuid"
|
||||
olog "github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||
@@ -139,10 +140,20 @@ func (s *Store) initMetadataClient(mdc MetadataClient) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(assIDs) > 0 {
|
||||
|
||||
adminUserID := accountUUID == s.cfg.AdminUserID
|
||||
if len(assIDs) > 0 && !adminUserID {
|
||||
// There is already a role assignment for this ID, skip to the next
|
||||
continue
|
||||
}
|
||||
// for the adminUserID we need to check if the user has the admin role every time
|
||||
if adminUserID {
|
||||
err = s.userMustHaveAdminRole(accountUUID, assIDs, mdc)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
ass := &settingsmsg.UserRoleAssignment{
|
||||
Id: uuid.Must(uuid.NewV4()).String(),
|
||||
@@ -164,6 +175,64 @@ func (s *Store) initMetadataClient(mdc MetadataClient) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Store) userMustHaveAdminRole(accountUUID string, assIDs []string, mdc MetadataClient) error {
|
||||
ctx := context.TODO()
|
||||
var hasAdminRole bool
|
||||
|
||||
// load the assignments from the store and check if the admin role is already assigned
|
||||
for _, assID := range assIDs {
|
||||
b, err := mdc.SimpleDownload(ctx, assignmentPath(accountUUID, assID))
|
||||
switch err.(type) {
|
||||
case nil:
|
||||
// continue
|
||||
case errtypes.NotFound:
|
||||
continue
|
||||
default:
|
||||
return err
|
||||
}
|
||||
|
||||
a := &settingsmsg.UserRoleAssignment{}
|
||||
err = json.Unmarshal(b, a)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if a.RoleId == defaults.BundleUUIDRoleAdmin {
|
||||
hasAdminRole = true
|
||||
}
|
||||
}
|
||||
|
||||
// delete old role assignment and set admin role
|
||||
if !hasAdminRole {
|
||||
err := mdc.Delete(ctx, accountPath(accountUUID))
|
||||
switch err.(type) {
|
||||
case nil:
|
||||
// continue
|
||||
case errtypes.NotFound:
|
||||
// already gone, continue
|
||||
default:
|
||||
return err
|
||||
}
|
||||
|
||||
err = mdc.MakeDirIfNotExist(ctx, accountPath(accountUUID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ass := &settingsmsg.UserRoleAssignment{
|
||||
Id: uuid.Must(uuid.NewV4()).String(),
|
||||
AccountUuid: accountUUID,
|
||||
RoleId: defaults.BundleUUIDRoleAdmin,
|
||||
}
|
||||
b, err := json.Marshal(ass)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return mdc.SimpleUpload(ctx, assignmentPath(accountUUID, ass.Id), b)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
settings.Registry[managerName] = New
|
||||
}
|
||||
@@ -2,10 +2,15 @@ package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/cs3org/reva/v2/pkg/errtypes"
|
||||
. "github.com/onsi/gomega"
|
||||
settingsmsg "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/settings/v0"
|
||||
"github.com/owncloud/ocis/v2/services/settings/pkg/config/defaults"
|
||||
rdefaults "github.com/owncloud/ocis/v2/services/settings/pkg/store/defaults"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -112,3 +117,74 @@ func (m *MockedMetadataClient) IDExists(id string) bool {
|
||||
func (m *MockedMetadataClient) IDHasContent(id string, content []byte) bool {
|
||||
return string(m.data[id]) == string(content)
|
||||
}
|
||||
|
||||
// TestAdminUserIDInit test the happy path during initialization
|
||||
func TestAdminUserIDInit(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
s := &Store{
|
||||
cfg: defaults.DefaultConfig(),
|
||||
}
|
||||
s.cfg.Bundles = rdefaults.GenerateBundlesDefaultRoles()
|
||||
s.cfg.AdminUserID = "admin"
|
||||
|
||||
// the first assignment is always happening during the initialisation of the metadata client
|
||||
err := NewMDC(s)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
assID, err := s.mdc.ReadDir(context.TODO(), accountPath(s.cfg.AdminUserID))
|
||||
Expect(len(assID)).To(Equal(1))
|
||||
ass, err := s.mdc.SimpleDownload(context.TODO(), assignmentPath(s.cfg.AdminUserID, assID[0]))
|
||||
Expect(ass).ToNot(BeNil())
|
||||
|
||||
assignment := &settingsmsg.UserRoleAssignment{}
|
||||
err = json.Unmarshal(ass, assignment)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(assignment.RoleId).To(Equal(rdefaults.BundleUUIDRoleAdmin))
|
||||
}
|
||||
|
||||
// TestAdminUserIDUpdate test the update on following initialisations
|
||||
func TestAdminUserIDUpdate(t *testing.T) {
|
||||
RegisterTestingT(t)
|
||||
s := &Store{
|
||||
cfg: defaults.DefaultConfig(),
|
||||
}
|
||||
s.cfg.Bundles = rdefaults.GenerateBundlesDefaultRoles()
|
||||
s.cfg.AdminUserID = "admin"
|
||||
|
||||
// the first assignment is always happening during the initialisation of the metadata client
|
||||
err := NewMDC(s)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
// read assignment
|
||||
assID, err := s.mdc.ReadDir(context.TODO(), accountPath(s.cfg.AdminUserID))
|
||||
Expect(len(assID)).To(Equal(1))
|
||||
|
||||
// set assignment to user role
|
||||
userRoleAssignment := &settingsmsg.UserRoleAssignment{
|
||||
AccountUuid: s.cfg.AdminUserID,
|
||||
RoleId: rdefaults.BundleUUIDRoleUser,
|
||||
}
|
||||
b, err := json.Marshal(userRoleAssignment)
|
||||
err = s.mdc.Delete(context.TODO(), assignmentPath(s.cfg.AdminUserID, assID[0]))
|
||||
Expect(err).To(BeNil())
|
||||
err = s.mdc.SimpleUpload(context.TODO(), assignmentPath(s.cfg.AdminUserID, assID[0]), b)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
// this happens on every Read / Write on the store
|
||||
// the actual init is only done if the metadata client has not been initialized before
|
||||
// this normally needs a restart of the service
|
||||
err = s.initMetadataClient(s.mdc)
|
||||
Expect(err).To(BeNil())
|
||||
|
||||
// read assignment id, changes every time the assignment is written
|
||||
assID, err = s.mdc.ReadDir(context.TODO(), accountPath(s.cfg.AdminUserID))
|
||||
Expect(len(assID)).To(Equal(1))
|
||||
|
||||
// check if the assignment is the admin role again
|
||||
ass, err := s.mdc.SimpleDownload(context.TODO(), assignmentPath(s.cfg.AdminUserID, assID[0]))
|
||||
Expect(ass).ToNot(BeNil())
|
||||
assignment := &settingsmsg.UserRoleAssignment{}
|
||||
err = json.Unmarshal(ass, assignment)
|
||||
Expect(err).To(BeNil())
|
||||
Expect(assignment.RoleId).To(Equal(rdefaults.BundleUUIDRoleAdmin))
|
||||
}
|
||||
@@ -191,6 +191,7 @@ func ListUploadSessions(cfg *config.Config) *cli.Command {
|
||||
if c.Bool("json") {
|
||||
for _, u := range uploads {
|
||||
ref := u.Reference()
|
||||
sr, sd := u.ScanData()
|
||||
s := struct {
|
||||
ID string `json:"id"`
|
||||
Space string `json:"space"`
|
||||
@@ -201,6 +202,8 @@ func ListUploadSessions(cfg *config.Config) *cli.Command {
|
||||
SpaceOwner *userpb.UserId `json:"spaceowner,omitempty"`
|
||||
Expires time.Time `json:"expires"`
|
||||
Processing bool `json:"processing"`
|
||||
ScanDate time.Time `json:"virus_scan_date"`
|
||||
ScanResult string `json:"virus_scan_result"`
|
||||
}{
|
||||
Space: ref.GetResourceId().GetSpaceId(),
|
||||
ID: u.ID(),
|
||||
@@ -211,6 +214,8 @@ func ListUploadSessions(cfg *config.Config) *cli.Command {
|
||||
SpaceOwner: u.SpaceOwner(),
|
||||
Expires: u.Expires(),
|
||||
Processing: u.IsProcessing(),
|
||||
ScanDate: sd,
|
||||
ScanResult: sr,
|
||||
}
|
||||
j, err := json.Marshal(s)
|
||||
if err != nil {
|
||||
@@ -236,10 +241,11 @@ func ListUploadSessions(cfg *config.Config) *cli.Command {
|
||||
|
||||
// start a table
|
||||
table = tw.NewWriter(os.Stdout)
|
||||
table.SetHeader([]string{"Space", "Upload Id", "Name", "Offset", "Size", "Executant", "Owner", "Expires", "Processing"})
|
||||
table.SetHeader([]string{"Space", "Upload Id", "Name", "Offset", "Size", "Executant", "Owner", "Expires", "Processing", "Scan Date", "Scan Result"})
|
||||
table.SetAutoFormatHeaders(false)
|
||||
|
||||
for _, u := range uploads {
|
||||
sr, sd := u.ScanData()
|
||||
table.Append([]string{
|
||||
u.Reference().ResourceId.GetSpaceId(),
|
||||
u.ID(),
|
||||
@@ -250,6 +256,8 @@ func ListUploadSessions(cfg *config.Config) *cli.Command {
|
||||
u.SpaceOwner().GetOpaqueId(),
|
||||
u.Expires().Format(time.RFC3339),
|
||||
strconv.FormatBool(u.IsProcessing()),
|
||||
sd.Format(time.RFC3339),
|
||||
sr,
|
||||
})
|
||||
|
||||
if c.Bool("restart") {
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"mime"
|
||||
"strings"
|
||||
|
||||
"github.com/disintegration/imaging"
|
||||
"github.com/kovidgoyal/imaging"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/image/font"
|
||||
"golang.org/x/image/font/opentype"
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"image/gif"
|
||||
"strings"
|
||||
|
||||
"github.com/disintegration/imaging"
|
||||
"github.com/kovidgoyal/imaging"
|
||||
)
|
||||
|
||||
// Generator generates a web friendly file version.
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"image"
|
||||
"strings"
|
||||
|
||||
"github.com/disintegration/imaging"
|
||||
"github.com/kovidgoyal/imaging"
|
||||
)
|
||||
|
||||
// Processor processes the thumbnail by applying different transformations to it.
|
||||
@@ -13,7 +13,7 @@ type Processor interface {
|
||||
Process(img image.Image, width, height int, filter imaging.ResampleFilter) *image.NRGBA
|
||||
}
|
||||
|
||||
// DefinableProcessor is the most simple processor, it holds a replaceable image converter function.
|
||||
// DefinableProcessor is the simplest processor, it holds a replaceable image converter function.
|
||||
type DefinableProcessor struct {
|
||||
Slug string
|
||||
Converter func(img image.Image, width, height int, filter imaging.ResampleFilter) *image.NRGBA
|
||||
|
||||
@@ -3,7 +3,7 @@ package thumbnail_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/disintegration/imaging"
|
||||
"github.com/kovidgoyal/imaging"
|
||||
tAssert "github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/owncloud/ocis/v2/services/thumbnails/pkg/thumbnail"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
sonar.projectKey=owncloud_ocis
|
||||
sonar.organization=owncloud-1
|
||||
sonar.projectName=ocis
|
||||
sonar.projectVersion=5.0.1
|
||||
sonar.projectVersion=5.0.4
|
||||
sonar.host.url=https://sonarcloud.io
|
||||
|
||||
# =====================================================
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
services:
|
||||
acceptance-tests:
|
||||
image: owncloudci/php:7.4
|
||||
image: owncloudci/php:8.2
|
||||
working_dir: /drone/src
|
||||
command: /bin/bash /test/run-tests.sh
|
||||
environment:
|
||||
|
||||
@@ -2690,7 +2690,7 @@ trait Sharing {
|
||||
$expectedElementsArray['path'],
|
||||
(string) $elementResponded->path[0],
|
||||
__METHOD__
|
||||
. " Expected '${expectedElementsArray['path']}' but got '"
|
||||
. " Expected '{$expectedElementsArray['path']}' but got '"
|
||||
. $elementResponded->path[0]
|
||||
. "'"
|
||||
);
|
||||
@@ -2698,7 +2698,7 @@ trait Sharing {
|
||||
$expectedElementsArray['permissions'],
|
||||
(string) $elementResponded->permissions[0],
|
||||
__METHOD__
|
||||
. " Expected '${expectedElementsArray['permissions']}' but got '"
|
||||
. " Expected '{$expectedElementsArray['permissions']}' but got '"
|
||||
. $elementResponded->permissions[0]
|
||||
. "'"
|
||||
);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"config" : {
|
||||
"platform": {
|
||||
"php": "7.4"
|
||||
"php": "8.2"
|
||||
},
|
||||
"allow-plugins": {
|
||||
"composer/package-versions-deprecated": true
|
||||
|
||||
+11
-3
@@ -261,7 +261,7 @@ func checkIfNestedResource(ctx context.Context, ref *provider.Reference, parent
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if statResponse.Status.Code != rpc.Code_CODE_OK {
|
||||
if statResponse.GetStatus().GetCode() != rpc.Code_CODE_OK {
|
||||
return false, statuspkg.NewErrorFromCode(statResponse.Status.Code, "auth interceptor")
|
||||
}
|
||||
|
||||
@@ -313,14 +313,22 @@ func checkIfNestedResource(ctx context.Context, ref *provider.Reference, parent
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if childStat.Status.Code != rpc.Code_CODE_OK {
|
||||
if childStat.GetStatus().GetCode() == rpc.Code_CODE_NOT_FOUND && ref.GetPath() != "" && ref.GetPath() != "." {
|
||||
// The resource does not seem to exist (yet?). We might be part of an initiate upload request.
|
||||
// Stat the parent to get its path and check that against the root path.
|
||||
childStat, err = client.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{ResourceId: ref.GetResourceId()}})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
if childStat.GetStatus().GetCode() != rpc.Code_CODE_OK {
|
||||
return false, statuspkg.NewErrorFromCode(childStat.Status.Code, "auth interceptor")
|
||||
}
|
||||
pathResp, err = client.GetPath(ctx, &provider.GetPathRequest{ResourceId: childStat.GetInfo().GetId()})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if pathResp.Status.Code != rpc.Code_CODE_OK {
|
||||
if pathResp.GetStatus().GetCode() != rpc.Code_CODE_OK {
|
||||
return false, statuspkg.NewErrorFromCode(pathResp.Status.Code, "auth interceptor")
|
||||
}
|
||||
childPath = pathResp.Path
|
||||
|
||||
+9
-3
@@ -319,9 +319,15 @@ func (s *svc) handleTusPost(ctx context.Context, w http.ResponseWriter, r *http.
|
||||
w.Header().Set(net.HeaderOCMtime, httpRes.Header.Get(net.HeaderOCMtime))
|
||||
}
|
||||
|
||||
if resid, err := storagespace.ParseID(httpRes.Header.Get(net.HeaderOCFileID)); err == nil {
|
||||
sReq.Ref = &provider.Reference{
|
||||
ResourceId: &resid,
|
||||
if strings.HasPrefix(uReq.GetRef().GetPath(), "/public") && uReq.GetRef().GetResourceId() == nil {
|
||||
// Use the path based request for the public link
|
||||
sReq.Ref.Path = uReq.Ref.GetPath()
|
||||
sReq.Ref.ResourceId = nil
|
||||
} else {
|
||||
if resid, err := storagespace.ParseID(httpRes.Header.Get(net.HeaderOCFileID)); err == nil {
|
||||
sReq.Ref = &provider.Reference{
|
||||
ResourceId: &resid,
|
||||
}
|
||||
}
|
||||
}
|
||||
finishUpload = httpRes.Header.Get(net.HeaderUploadOffset) == r.Header.Get(net.HeaderUploadLength)
|
||||
|
||||
Generated
Vendored
-2
@@ -33,8 +33,6 @@ import (
|
||||
"github.com/jellydator/ttlcache/v2"
|
||||
)
|
||||
|
||||
//go:generate make --no-print-directory -C ../../../.. mockery NAME=UserConverter
|
||||
|
||||
// DBShare stores information about user and public shares.
|
||||
type DBShare struct {
|
||||
ID string
|
||||
|
||||
-2
@@ -37,8 +37,6 @@ import (
|
||||
"github.com/jellydator/ttlcache/v2"
|
||||
)
|
||||
|
||||
//go:generate make --no-print-directory -C ../../../.. mockery NAME=UserConverter
|
||||
|
||||
// DBShare stores information about user and public shares.
|
||||
type DBShare struct {
|
||||
ID string
|
||||
|
||||
-2
@@ -36,8 +36,6 @@ const (
|
||||
NoState collaboration.ShareState = -1
|
||||
)
|
||||
|
||||
//go:generate make --no-print-directory -C ../.. mockery NAME=Manager
|
||||
|
||||
// Metadata contains Metadata for a share
|
||||
type Metadata struct {
|
||||
ETag string
|
||||
|
||||
-2
@@ -54,8 +54,6 @@ func init() {
|
||||
tracer = otel.Tracer("github.com/cs3org/reva/pkg/storage/utils/decomposedfs/tree")
|
||||
}
|
||||
|
||||
//go:generate make --no-print-directory -C ../../../../.. mockery NAME=Blobstore
|
||||
|
||||
// Blobstore defines an interface for storing blobs in a blobstore
|
||||
type Blobstore interface {
|
||||
Upload(node *node.Node, source string) error
|
||||
|
||||
-2
@@ -48,8 +48,6 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
//go:generate make --no-print-directory -C ../../../.. mockery NAME=StorageProviderClient
|
||||
|
||||
func init() {
|
||||
pkgregistry.Register("spaces", NewDefault)
|
||||
}
|
||||
|
||||
+4
@@ -76,6 +76,9 @@ type UploadSession interface {
|
||||
|
||||
// Purge allows completely removing an upload. Should emit a PostprocessingFinished event with a Delete outcome
|
||||
Purge(ctx context.Context) error
|
||||
|
||||
// ScanData returns the scan data for the UploadSession
|
||||
ScanData() (string, time.Time)
|
||||
}
|
||||
|
||||
// UploadSessionFilter can be used to filter upload sessions
|
||||
@@ -83,4 +86,5 @@ type UploadSessionFilter struct {
|
||||
ID *string
|
||||
Processing *bool
|
||||
Expired *bool
|
||||
HasVirus *bool
|
||||
}
|
||||
+16
-3
@@ -310,9 +310,16 @@ func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event) {
|
||||
|
||||
now := time.Now()
|
||||
if failed {
|
||||
// propagate sizeDiff after failed postprocessing
|
||||
if err := fs.tp.Propagate(ctx, n, -session.SizeDiff()); err != nil {
|
||||
log.Error().Err(err).Str("uploadID", ev.UploadID).Msg("could not propagate tree size change")
|
||||
// if no other upload session is in progress (processing id != session id) or has finished (processing id == "")
|
||||
latestSession, err := n.ProcessingID(ctx)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Str("node", n.ID).Str("uploadID", ev.UploadID).Msg("reading node for session failed")
|
||||
}
|
||||
if latestSession == session.ID() {
|
||||
// propagate reverted sizeDiff after failed postprocessing
|
||||
if err := fs.tp.Propagate(ctx, n, -session.SizeDiff()); err != nil {
|
||||
log.Error().Err(err).Str("uploadID", ev.UploadID).Msg("could not propagate tree size change")
|
||||
}
|
||||
}
|
||||
} else if p := getParent(); p != nil {
|
||||
// update parent tmtime to propagate etag change after successful postprocessing
|
||||
@@ -486,6 +493,12 @@ func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event) {
|
||||
log.Error().Err(err).Interface("uploadID", ev.UploadID).Msg("Failed to get node after scan")
|
||||
continue
|
||||
}
|
||||
sublog := log.With().Str("spaceid", session.SpaceID()).Str("nodeid", session.NodeID()).Logger()
|
||||
|
||||
session.SetScanData(res.Description, res.Scandate)
|
||||
if err := session.Persist(ctx); err != nil {
|
||||
sublog.Error().Err(err).Msg("Failed to persist scan results")
|
||||
}
|
||||
}
|
||||
|
||||
if err := n.SetScanData(ctx, res.Description, res.Scandate); err != nil {
|
||||
|
||||
+6
-2
@@ -54,8 +54,6 @@ import (
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
//go:generate make --no-print-directory -C ../../../../.. mockery NAME=Tree
|
||||
|
||||
var tracer trace.Tracer
|
||||
|
||||
func init() {
|
||||
@@ -1278,6 +1276,12 @@ func (n *Node) IsProcessing(ctx context.Context) bool {
|
||||
return err == nil && strings.HasPrefix(v, ProcessingStatus)
|
||||
}
|
||||
|
||||
// ProcessingID returns the latest upload session id
|
||||
func (n *Node) ProcessingID(ctx context.Context) (string, error) {
|
||||
v, err := n.XattrString(ctx, prefixes.StatusPrefix)
|
||||
return strings.TrimPrefix(v, ProcessingStatus), err
|
||||
}
|
||||
|
||||
// IsSpaceRoot checks if the node is a space root
|
||||
func (n *Node) IsSpaceRoot(ctx context.Context) bool {
|
||||
_, err := n.Xattr(ctx, prefixes.SpaceNameAttr)
|
||||
|
||||
Generated
Vendored
-3
@@ -16,9 +16,6 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
//go:generate make --no-print-directory -C ../../../../.. mockery NAME=PermissionsChecker
|
||||
//go:generate make --no-print-directory -C ../../../../.. mockery NAME=CS3PermissionsClient
|
||||
|
||||
var (
|
||||
tracer trace.Tracer
|
||||
)
|
||||
|
||||
-2
@@ -53,8 +53,6 @@ func init() {
|
||||
tracer = otel.Tracer("github.com/cs3org/reva/pkg/storage/utils/decomposedfs/tree")
|
||||
}
|
||||
|
||||
//go:generate make --no-print-directory -C ../../../../.. mockery NAME=Blobstore
|
||||
|
||||
// Blobstore defines an interface for storing blobs in a blobstore
|
||||
type Blobstore interface {
|
||||
Upload(node *node.Node, source string) error
|
||||
|
||||
+7
@@ -376,6 +376,13 @@ func (fs *Decomposedfs) ListUploadSessions(ctx context.Context, filter storage.U
|
||||
}
|
||||
}
|
||||
}
|
||||
if filter.HasVirus != nil {
|
||||
sr, _ := session.ScanData()
|
||||
infected := sr != ""
|
||||
if *filter.HasVirus != infected {
|
||||
continue
|
||||
}
|
||||
}
|
||||
filteredSessions = append(filteredSessions, session)
|
||||
}
|
||||
return filteredSessions, nil
|
||||
|
||||
Generated
Vendored
+23
-1
@@ -297,7 +297,8 @@ func (s *OcisSession) MTime() time.Time {
|
||||
|
||||
// IsProcessing returns true if all bytes have been received. The session then has entered postprocessing state.
|
||||
func (s *OcisSession) IsProcessing() bool {
|
||||
return s.info.Size == s.info.Offset
|
||||
// We might need a more sophisticated way to determine processing status soon
|
||||
return s.info.Size == s.info.Offset && s.info.MetaData["scanResult"] == ""
|
||||
}
|
||||
|
||||
// binPath returns the path to the file storing the binary data.
|
||||
@@ -305,6 +306,27 @@ func (s *OcisSession) binPath() string {
|
||||
return filepath.Join(s.store.root, "uploads", s.info.ID)
|
||||
}
|
||||
|
||||
// InitiatorID returns the id of the initiating client
|
||||
func (s *OcisSession) InitiatorID() string {
|
||||
return s.info.MetaData["initiatorid"]
|
||||
}
|
||||
|
||||
// SetScanData sets virus scan data to the upload session
|
||||
func (s *OcisSession) SetScanData(result string, date time.Time) {
|
||||
s.info.MetaData["scanResult"] = result
|
||||
s.info.MetaData["scanDate"] = date.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
// ScanData returns the virus scan data
|
||||
func (s *OcisSession) ScanData() (string, time.Time) {
|
||||
date := s.info.MetaData["scanDate"]
|
||||
if date == "" {
|
||||
return "", time.Time{}
|
||||
}
|
||||
d, _ := time.Parse(time.RFC3339, date)
|
||||
return s.info.MetaData["scanResult"], d
|
||||
}
|
||||
|
||||
// sessionPath returns the path to the .info file storing the file's info.
|
||||
func sessionPath(root, id string) string {
|
||||
return filepath.Join(root, "uploads", id+".info")
|
||||
|
||||
+9
-1
@@ -205,7 +205,15 @@ func (store OcisStore) CreateNodeForUpload(session *OcisSession, initAttrs node.
|
||||
}
|
||||
|
||||
var f *lockedfile.File
|
||||
if session.NodeExists() {
|
||||
if session.NodeExists() { // TODO this is wrong. The node should be created when the upload starts, the revisions should be created independently of the node
|
||||
// we do not need to propagate a change when a node is created, only when the upload is ready.
|
||||
// that still creates problems for desktop clients because if another change causes propagation it will detects an empty file
|
||||
// so the first upload has to point to the first revision with the expected size. The file cannot be downloaded, but it can be overwritten (which will create a new revision and make the node reflect the latest revision)
|
||||
// any finished postprocessing will not affect the node metadata.
|
||||
// *thinking* but then initializing an upload will lock the file until the upload has finished. That sucks.
|
||||
// so we have to check if the node has been created meanwhile (well, only in case the upload does not know the nodeid ... or the NodeExists array that is checked by session.NodeExists())
|
||||
// FIXME look at the disk again to see if the file has been created in between, or just try initializing a new node and do the update existing node as a fallback. <- the latter!
|
||||
|
||||
f, err = store.updateExistingNode(ctx, session, n, session.SpaceID(), uint64(session.Size()))
|
||||
if f != nil {
|
||||
appctx.GetLogger(ctx).Info().Str("lockfile", f.Name()).Interface("err", err).Msg("got lock file from updateExistingNode")
|
||||
|
||||
+17
-10
@@ -276,14 +276,12 @@ func (session *OcisSession) ConcatUploads(_ context.Context, uploads []tusd.Uplo
|
||||
func (session *OcisSession) Finalize() (err error) {
|
||||
ctx, span := tracer.Start(session.Context(context.Background()), "Finalize")
|
||||
defer span.End()
|
||||
n, err := session.Node(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
revisionNode := &node.Node{SpaceID: session.SpaceID(), BlobID: session.ID(), Blobsize: session.Size()}
|
||||
|
||||
// upload the data to the blobstore
|
||||
_, subspan := tracer.Start(ctx, "WriteBlob")
|
||||
err = session.store.tp.WriteBlob(n, session.binPath())
|
||||
err = session.store.tp.WriteBlob(revisionNode, session.binPath())
|
||||
subspan.End()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to upload file to blobstore")
|
||||
@@ -316,12 +314,12 @@ func (session *OcisSession) Cleanup(revertNodeMetadata, cleanBin, cleanInfo bool
|
||||
ctx := session.Context(context.Background())
|
||||
|
||||
if revertNodeMetadata {
|
||||
n, err := session.Node(ctx)
|
||||
if err != nil {
|
||||
appctx.GetLogger(ctx).Error().Err(err).Str("node", n.ID).Str("sessionid", session.ID()).Msg("reading node for session failed")
|
||||
}
|
||||
if session.NodeExists() {
|
||||
p := session.info.MetaData["versionsPath"]
|
||||
n, err := session.Node(ctx)
|
||||
if err != nil {
|
||||
appctx.GetLogger(ctx).Error().Err(err).Str("sessionid", session.ID()).Msg("reading node for session failed")
|
||||
}
|
||||
if err := session.store.lu.CopyMetadata(ctx, p, n.InternalPath(), func(attributeName string, value []byte) (newValue []byte, copy bool) {
|
||||
return value, strings.HasPrefix(attributeName, prefixes.ChecksumPrefix) ||
|
||||
attributeName == prefixes.TypeAttr ||
|
||||
@@ -337,7 +335,16 @@ func (session *OcisSession) Cleanup(revertNodeMetadata, cleanBin, cleanInfo bool
|
||||
}
|
||||
|
||||
} else {
|
||||
session.removeNode(ctx)
|
||||
// if no other upload session is in progress (processing id != session id) or has finished (processing id == "")
|
||||
latestSession, err := n.ProcessingID(ctx)
|
||||
if err != nil {
|
||||
appctx.GetLogger(ctx).Error().Err(err).Str("node", n.ID).Str("sessionid", session.ID()).Msg("reading processingid for session failed")
|
||||
}
|
||||
if latestSession == session.ID() {
|
||||
// actually delete the node
|
||||
session.removeNode(ctx)
|
||||
}
|
||||
// FIXME else if the upload has become a revision, delete the revision, or if it is the last one, delete the node
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-2
@@ -36,8 +36,6 @@ import (
|
||||
"github.com/cs3org/reva/v2/pkg/storage/utils/sync"
|
||||
)
|
||||
|
||||
//go:generate make --no-print-directory -C ../../../.. mockery NAME=Indexer
|
||||
|
||||
// Indexer is a facade to configure and query over multiple indices.
|
||||
type Indexer interface {
|
||||
AddIndex(t interface{}, indexBy option.IndexBy, pkName, entityDirName, indexType string, bound *option.Bound, caseInsensitive bool) error
|
||||
|
||||
-2
@@ -28,8 +28,6 @@ import (
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
)
|
||||
|
||||
//go:generate make --no-print-directory -C ../../../.. mockery NAME=Storage
|
||||
|
||||
// UploadRequest represents an upload request and its options
|
||||
type UploadRequest struct {
|
||||
Path string
|
||||
|
||||
+340
-5
@@ -16,7 +16,7 @@
|
||||
// granted to it by virtue of its status as an Intergovernmental Organization
|
||||
// or submit itself to any jurisdiction.
|
||||
|
||||
// Code generated by mockery v2.22.1. DO NOT EDIT.
|
||||
// Code generated by mockery v2.40.2. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
|
||||
@@ -35,6 +35,14 @@ type CollaborationAPIClient struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type CollaborationAPIClient_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *CollaborationAPIClient) EXPECT() *CollaborationAPIClient_Expecter {
|
||||
return &CollaborationAPIClient_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// CreateShare provides a mock function with given fields: ctx, in, opts
|
||||
func (_m *CollaborationAPIClient) CreateShare(ctx context.Context, in *collaborationv1beta1.CreateShareRequest, opts ...grpc.CallOption) (*collaborationv1beta1.CreateShareResponse, error) {
|
||||
_va := make([]interface{}, len(opts))
|
||||
@@ -46,6 +54,10 @@ func (_m *CollaborationAPIClient) CreateShare(ctx context.Context, in *collabora
|
||||
_ca = append(_ca, _va...)
|
||||
ret := _m.Called(_ca...)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for CreateShare")
|
||||
}
|
||||
|
||||
var r0 *collaborationv1beta1.CreateShareResponse
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *collaborationv1beta1.CreateShareRequest, ...grpc.CallOption) (*collaborationv1beta1.CreateShareResponse, error)); ok {
|
||||
@@ -68,6 +80,43 @@ func (_m *CollaborationAPIClient) CreateShare(ctx context.Context, in *collabora
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// CollaborationAPIClient_CreateShare_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateShare'
|
||||
type CollaborationAPIClient_CreateShare_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// CreateShare is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - in *collaborationv1beta1.CreateShareRequest
|
||||
// - opts ...grpc.CallOption
|
||||
func (_e *CollaborationAPIClient_Expecter) CreateShare(ctx interface{}, in interface{}, opts ...interface{}) *CollaborationAPIClient_CreateShare_Call {
|
||||
return &CollaborationAPIClient_CreateShare_Call{Call: _e.mock.On("CreateShare",
|
||||
append([]interface{}{ctx, in}, opts...)...)}
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_CreateShare_Call) Run(run func(ctx context.Context, in *collaborationv1beta1.CreateShareRequest, opts ...grpc.CallOption)) *CollaborationAPIClient_CreateShare_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
variadicArgs := make([]grpc.CallOption, len(args)-2)
|
||||
for i, a := range args[2:] {
|
||||
if a != nil {
|
||||
variadicArgs[i] = a.(grpc.CallOption)
|
||||
}
|
||||
}
|
||||
run(args[0].(context.Context), args[1].(*collaborationv1beta1.CreateShareRequest), variadicArgs...)
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_CreateShare_Call) Return(_a0 *collaborationv1beta1.CreateShareResponse, _a1 error) *CollaborationAPIClient_CreateShare_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_CreateShare_Call) RunAndReturn(run func(context.Context, *collaborationv1beta1.CreateShareRequest, ...grpc.CallOption) (*collaborationv1beta1.CreateShareResponse, error)) *CollaborationAPIClient_CreateShare_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetReceivedShare provides a mock function with given fields: ctx, in, opts
|
||||
func (_m *CollaborationAPIClient) GetReceivedShare(ctx context.Context, in *collaborationv1beta1.GetReceivedShareRequest, opts ...grpc.CallOption) (*collaborationv1beta1.GetReceivedShareResponse, error) {
|
||||
_va := make([]interface{}, len(opts))
|
||||
@@ -79,6 +128,10 @@ func (_m *CollaborationAPIClient) GetReceivedShare(ctx context.Context, in *coll
|
||||
_ca = append(_ca, _va...)
|
||||
ret := _m.Called(_ca...)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetReceivedShare")
|
||||
}
|
||||
|
||||
var r0 *collaborationv1beta1.GetReceivedShareResponse
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *collaborationv1beta1.GetReceivedShareRequest, ...grpc.CallOption) (*collaborationv1beta1.GetReceivedShareResponse, error)); ok {
|
||||
@@ -101,6 +154,43 @@ func (_m *CollaborationAPIClient) GetReceivedShare(ctx context.Context, in *coll
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// CollaborationAPIClient_GetReceivedShare_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetReceivedShare'
|
||||
type CollaborationAPIClient_GetReceivedShare_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetReceivedShare is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - in *collaborationv1beta1.GetReceivedShareRequest
|
||||
// - opts ...grpc.CallOption
|
||||
func (_e *CollaborationAPIClient_Expecter) GetReceivedShare(ctx interface{}, in interface{}, opts ...interface{}) *CollaborationAPIClient_GetReceivedShare_Call {
|
||||
return &CollaborationAPIClient_GetReceivedShare_Call{Call: _e.mock.On("GetReceivedShare",
|
||||
append([]interface{}{ctx, in}, opts...)...)}
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_GetReceivedShare_Call) Run(run func(ctx context.Context, in *collaborationv1beta1.GetReceivedShareRequest, opts ...grpc.CallOption)) *CollaborationAPIClient_GetReceivedShare_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
variadicArgs := make([]grpc.CallOption, len(args)-2)
|
||||
for i, a := range args[2:] {
|
||||
if a != nil {
|
||||
variadicArgs[i] = a.(grpc.CallOption)
|
||||
}
|
||||
}
|
||||
run(args[0].(context.Context), args[1].(*collaborationv1beta1.GetReceivedShareRequest), variadicArgs...)
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_GetReceivedShare_Call) Return(_a0 *collaborationv1beta1.GetReceivedShareResponse, _a1 error) *CollaborationAPIClient_GetReceivedShare_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_GetReceivedShare_Call) RunAndReturn(run func(context.Context, *collaborationv1beta1.GetReceivedShareRequest, ...grpc.CallOption) (*collaborationv1beta1.GetReceivedShareResponse, error)) *CollaborationAPIClient_GetReceivedShare_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetShare provides a mock function with given fields: ctx, in, opts
|
||||
func (_m *CollaborationAPIClient) GetShare(ctx context.Context, in *collaborationv1beta1.GetShareRequest, opts ...grpc.CallOption) (*collaborationv1beta1.GetShareResponse, error) {
|
||||
_va := make([]interface{}, len(opts))
|
||||
@@ -112,6 +202,10 @@ func (_m *CollaborationAPIClient) GetShare(ctx context.Context, in *collaboratio
|
||||
_ca = append(_ca, _va...)
|
||||
ret := _m.Called(_ca...)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetShare")
|
||||
}
|
||||
|
||||
var r0 *collaborationv1beta1.GetShareResponse
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *collaborationv1beta1.GetShareRequest, ...grpc.CallOption) (*collaborationv1beta1.GetShareResponse, error)); ok {
|
||||
@@ -134,6 +228,43 @@ func (_m *CollaborationAPIClient) GetShare(ctx context.Context, in *collaboratio
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// CollaborationAPIClient_GetShare_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetShare'
|
||||
type CollaborationAPIClient_GetShare_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetShare is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - in *collaborationv1beta1.GetShareRequest
|
||||
// - opts ...grpc.CallOption
|
||||
func (_e *CollaborationAPIClient_Expecter) GetShare(ctx interface{}, in interface{}, opts ...interface{}) *CollaborationAPIClient_GetShare_Call {
|
||||
return &CollaborationAPIClient_GetShare_Call{Call: _e.mock.On("GetShare",
|
||||
append([]interface{}{ctx, in}, opts...)...)}
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_GetShare_Call) Run(run func(ctx context.Context, in *collaborationv1beta1.GetShareRequest, opts ...grpc.CallOption)) *CollaborationAPIClient_GetShare_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
variadicArgs := make([]grpc.CallOption, len(args)-2)
|
||||
for i, a := range args[2:] {
|
||||
if a != nil {
|
||||
variadicArgs[i] = a.(grpc.CallOption)
|
||||
}
|
||||
}
|
||||
run(args[0].(context.Context), args[1].(*collaborationv1beta1.GetShareRequest), variadicArgs...)
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_GetShare_Call) Return(_a0 *collaborationv1beta1.GetShareResponse, _a1 error) *CollaborationAPIClient_GetShare_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_GetShare_Call) RunAndReturn(run func(context.Context, *collaborationv1beta1.GetShareRequest, ...grpc.CallOption) (*collaborationv1beta1.GetShareResponse, error)) *CollaborationAPIClient_GetShare_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// ListReceivedShares provides a mock function with given fields: ctx, in, opts
|
||||
func (_m *CollaborationAPIClient) ListReceivedShares(ctx context.Context, in *collaborationv1beta1.ListReceivedSharesRequest, opts ...grpc.CallOption) (*collaborationv1beta1.ListReceivedSharesResponse, error) {
|
||||
_va := make([]interface{}, len(opts))
|
||||
@@ -145,6 +276,10 @@ func (_m *CollaborationAPIClient) ListReceivedShares(ctx context.Context, in *co
|
||||
_ca = append(_ca, _va...)
|
||||
ret := _m.Called(_ca...)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for ListReceivedShares")
|
||||
}
|
||||
|
||||
var r0 *collaborationv1beta1.ListReceivedSharesResponse
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *collaborationv1beta1.ListReceivedSharesRequest, ...grpc.CallOption) (*collaborationv1beta1.ListReceivedSharesResponse, error)); ok {
|
||||
@@ -167,6 +302,43 @@ func (_m *CollaborationAPIClient) ListReceivedShares(ctx context.Context, in *co
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// CollaborationAPIClient_ListReceivedShares_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListReceivedShares'
|
||||
type CollaborationAPIClient_ListReceivedShares_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// ListReceivedShares is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - in *collaborationv1beta1.ListReceivedSharesRequest
|
||||
// - opts ...grpc.CallOption
|
||||
func (_e *CollaborationAPIClient_Expecter) ListReceivedShares(ctx interface{}, in interface{}, opts ...interface{}) *CollaborationAPIClient_ListReceivedShares_Call {
|
||||
return &CollaborationAPIClient_ListReceivedShares_Call{Call: _e.mock.On("ListReceivedShares",
|
||||
append([]interface{}{ctx, in}, opts...)...)}
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_ListReceivedShares_Call) Run(run func(ctx context.Context, in *collaborationv1beta1.ListReceivedSharesRequest, opts ...grpc.CallOption)) *CollaborationAPIClient_ListReceivedShares_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
variadicArgs := make([]grpc.CallOption, len(args)-2)
|
||||
for i, a := range args[2:] {
|
||||
if a != nil {
|
||||
variadicArgs[i] = a.(grpc.CallOption)
|
||||
}
|
||||
}
|
||||
run(args[0].(context.Context), args[1].(*collaborationv1beta1.ListReceivedSharesRequest), variadicArgs...)
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_ListReceivedShares_Call) Return(_a0 *collaborationv1beta1.ListReceivedSharesResponse, _a1 error) *CollaborationAPIClient_ListReceivedShares_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_ListReceivedShares_Call) RunAndReturn(run func(context.Context, *collaborationv1beta1.ListReceivedSharesRequest, ...grpc.CallOption) (*collaborationv1beta1.ListReceivedSharesResponse, error)) *CollaborationAPIClient_ListReceivedShares_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// ListShares provides a mock function with given fields: ctx, in, opts
|
||||
func (_m *CollaborationAPIClient) ListShares(ctx context.Context, in *collaborationv1beta1.ListSharesRequest, opts ...grpc.CallOption) (*collaborationv1beta1.ListSharesResponse, error) {
|
||||
_va := make([]interface{}, len(opts))
|
||||
@@ -178,6 +350,10 @@ func (_m *CollaborationAPIClient) ListShares(ctx context.Context, in *collaborat
|
||||
_ca = append(_ca, _va...)
|
||||
ret := _m.Called(_ca...)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for ListShares")
|
||||
}
|
||||
|
||||
var r0 *collaborationv1beta1.ListSharesResponse
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *collaborationv1beta1.ListSharesRequest, ...grpc.CallOption) (*collaborationv1beta1.ListSharesResponse, error)); ok {
|
||||
@@ -200,6 +376,43 @@ func (_m *CollaborationAPIClient) ListShares(ctx context.Context, in *collaborat
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// CollaborationAPIClient_ListShares_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListShares'
|
||||
type CollaborationAPIClient_ListShares_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// ListShares is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - in *collaborationv1beta1.ListSharesRequest
|
||||
// - opts ...grpc.CallOption
|
||||
func (_e *CollaborationAPIClient_Expecter) ListShares(ctx interface{}, in interface{}, opts ...interface{}) *CollaborationAPIClient_ListShares_Call {
|
||||
return &CollaborationAPIClient_ListShares_Call{Call: _e.mock.On("ListShares",
|
||||
append([]interface{}{ctx, in}, opts...)...)}
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_ListShares_Call) Run(run func(ctx context.Context, in *collaborationv1beta1.ListSharesRequest, opts ...grpc.CallOption)) *CollaborationAPIClient_ListShares_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
variadicArgs := make([]grpc.CallOption, len(args)-2)
|
||||
for i, a := range args[2:] {
|
||||
if a != nil {
|
||||
variadicArgs[i] = a.(grpc.CallOption)
|
||||
}
|
||||
}
|
||||
run(args[0].(context.Context), args[1].(*collaborationv1beta1.ListSharesRequest), variadicArgs...)
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_ListShares_Call) Return(_a0 *collaborationv1beta1.ListSharesResponse, _a1 error) *CollaborationAPIClient_ListShares_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_ListShares_Call) RunAndReturn(run func(context.Context, *collaborationv1beta1.ListSharesRequest, ...grpc.CallOption) (*collaborationv1beta1.ListSharesResponse, error)) *CollaborationAPIClient_ListShares_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// RemoveShare provides a mock function with given fields: ctx, in, opts
|
||||
func (_m *CollaborationAPIClient) RemoveShare(ctx context.Context, in *collaborationv1beta1.RemoveShareRequest, opts ...grpc.CallOption) (*collaborationv1beta1.RemoveShareResponse, error) {
|
||||
_va := make([]interface{}, len(opts))
|
||||
@@ -211,6 +424,10 @@ func (_m *CollaborationAPIClient) RemoveShare(ctx context.Context, in *collabora
|
||||
_ca = append(_ca, _va...)
|
||||
ret := _m.Called(_ca...)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for RemoveShare")
|
||||
}
|
||||
|
||||
var r0 *collaborationv1beta1.RemoveShareResponse
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *collaborationv1beta1.RemoveShareRequest, ...grpc.CallOption) (*collaborationv1beta1.RemoveShareResponse, error)); ok {
|
||||
@@ -233,6 +450,43 @@ func (_m *CollaborationAPIClient) RemoveShare(ctx context.Context, in *collabora
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// CollaborationAPIClient_RemoveShare_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveShare'
|
||||
type CollaborationAPIClient_RemoveShare_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// RemoveShare is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - in *collaborationv1beta1.RemoveShareRequest
|
||||
// - opts ...grpc.CallOption
|
||||
func (_e *CollaborationAPIClient_Expecter) RemoveShare(ctx interface{}, in interface{}, opts ...interface{}) *CollaborationAPIClient_RemoveShare_Call {
|
||||
return &CollaborationAPIClient_RemoveShare_Call{Call: _e.mock.On("RemoveShare",
|
||||
append([]interface{}{ctx, in}, opts...)...)}
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_RemoveShare_Call) Run(run func(ctx context.Context, in *collaborationv1beta1.RemoveShareRequest, opts ...grpc.CallOption)) *CollaborationAPIClient_RemoveShare_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
variadicArgs := make([]grpc.CallOption, len(args)-2)
|
||||
for i, a := range args[2:] {
|
||||
if a != nil {
|
||||
variadicArgs[i] = a.(grpc.CallOption)
|
||||
}
|
||||
}
|
||||
run(args[0].(context.Context), args[1].(*collaborationv1beta1.RemoveShareRequest), variadicArgs...)
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_RemoveShare_Call) Return(_a0 *collaborationv1beta1.RemoveShareResponse, _a1 error) *CollaborationAPIClient_RemoveShare_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_RemoveShare_Call) RunAndReturn(run func(context.Context, *collaborationv1beta1.RemoveShareRequest, ...grpc.CallOption) (*collaborationv1beta1.RemoveShareResponse, error)) *CollaborationAPIClient_RemoveShare_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// UpdateReceivedShare provides a mock function with given fields: ctx, in, opts
|
||||
func (_m *CollaborationAPIClient) UpdateReceivedShare(ctx context.Context, in *collaborationv1beta1.UpdateReceivedShareRequest, opts ...grpc.CallOption) (*collaborationv1beta1.UpdateReceivedShareResponse, error) {
|
||||
_va := make([]interface{}, len(opts))
|
||||
@@ -244,6 +498,10 @@ func (_m *CollaborationAPIClient) UpdateReceivedShare(ctx context.Context, in *c
|
||||
_ca = append(_ca, _va...)
|
||||
ret := _m.Called(_ca...)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for UpdateReceivedShare")
|
||||
}
|
||||
|
||||
var r0 *collaborationv1beta1.UpdateReceivedShareResponse
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *collaborationv1beta1.UpdateReceivedShareRequest, ...grpc.CallOption) (*collaborationv1beta1.UpdateReceivedShareResponse, error)); ok {
|
||||
@@ -266,6 +524,43 @@ func (_m *CollaborationAPIClient) UpdateReceivedShare(ctx context.Context, in *c
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// CollaborationAPIClient_UpdateReceivedShare_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateReceivedShare'
|
||||
type CollaborationAPIClient_UpdateReceivedShare_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// UpdateReceivedShare is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - in *collaborationv1beta1.UpdateReceivedShareRequest
|
||||
// - opts ...grpc.CallOption
|
||||
func (_e *CollaborationAPIClient_Expecter) UpdateReceivedShare(ctx interface{}, in interface{}, opts ...interface{}) *CollaborationAPIClient_UpdateReceivedShare_Call {
|
||||
return &CollaborationAPIClient_UpdateReceivedShare_Call{Call: _e.mock.On("UpdateReceivedShare",
|
||||
append([]interface{}{ctx, in}, opts...)...)}
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_UpdateReceivedShare_Call) Run(run func(ctx context.Context, in *collaborationv1beta1.UpdateReceivedShareRequest, opts ...grpc.CallOption)) *CollaborationAPIClient_UpdateReceivedShare_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
variadicArgs := make([]grpc.CallOption, len(args)-2)
|
||||
for i, a := range args[2:] {
|
||||
if a != nil {
|
||||
variadicArgs[i] = a.(grpc.CallOption)
|
||||
}
|
||||
}
|
||||
run(args[0].(context.Context), args[1].(*collaborationv1beta1.UpdateReceivedShareRequest), variadicArgs...)
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_UpdateReceivedShare_Call) Return(_a0 *collaborationv1beta1.UpdateReceivedShareResponse, _a1 error) *CollaborationAPIClient_UpdateReceivedShare_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_UpdateReceivedShare_Call) RunAndReturn(run func(context.Context, *collaborationv1beta1.UpdateReceivedShareRequest, ...grpc.CallOption) (*collaborationv1beta1.UpdateReceivedShareResponse, error)) *CollaborationAPIClient_UpdateReceivedShare_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// UpdateShare provides a mock function with given fields: ctx, in, opts
|
||||
func (_m *CollaborationAPIClient) UpdateShare(ctx context.Context, in *collaborationv1beta1.UpdateShareRequest, opts ...grpc.CallOption) (*collaborationv1beta1.UpdateShareResponse, error) {
|
||||
_va := make([]interface{}, len(opts))
|
||||
@@ -277,6 +572,10 @@ func (_m *CollaborationAPIClient) UpdateShare(ctx context.Context, in *collabora
|
||||
_ca = append(_ca, _va...)
|
||||
ret := _m.Called(_ca...)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for UpdateShare")
|
||||
}
|
||||
|
||||
var r0 *collaborationv1beta1.UpdateShareResponse
|
||||
var r1 error
|
||||
if rf, ok := ret.Get(0).(func(context.Context, *collaborationv1beta1.UpdateShareRequest, ...grpc.CallOption) (*collaborationv1beta1.UpdateShareResponse, error)); ok {
|
||||
@@ -299,13 +598,49 @@ func (_m *CollaborationAPIClient) UpdateShare(ctx context.Context, in *collabora
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
type mockConstructorTestingTNewCollaborationAPIClient interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
// CollaborationAPIClient_UpdateShare_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateShare'
|
||||
type CollaborationAPIClient_UpdateShare_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// UpdateShare is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - in *collaborationv1beta1.UpdateShareRequest
|
||||
// - opts ...grpc.CallOption
|
||||
func (_e *CollaborationAPIClient_Expecter) UpdateShare(ctx interface{}, in interface{}, opts ...interface{}) *CollaborationAPIClient_UpdateShare_Call {
|
||||
return &CollaborationAPIClient_UpdateShare_Call{Call: _e.mock.On("UpdateShare",
|
||||
append([]interface{}{ctx, in}, opts...)...)}
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_UpdateShare_Call) Run(run func(ctx context.Context, in *collaborationv1beta1.UpdateShareRequest, opts ...grpc.CallOption)) *CollaborationAPIClient_UpdateShare_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
variadicArgs := make([]grpc.CallOption, len(args)-2)
|
||||
for i, a := range args[2:] {
|
||||
if a != nil {
|
||||
variadicArgs[i] = a.(grpc.CallOption)
|
||||
}
|
||||
}
|
||||
run(args[0].(context.Context), args[1].(*collaborationv1beta1.UpdateShareRequest), variadicArgs...)
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_UpdateShare_Call) Return(_a0 *collaborationv1beta1.UpdateShareResponse, _a1 error) *CollaborationAPIClient_UpdateShare_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *CollaborationAPIClient_UpdateShare_Call) RunAndReturn(run func(context.Context, *collaborationv1beta1.UpdateShareRequest, ...grpc.CallOption) (*collaborationv1beta1.UpdateShareResponse, error)) *CollaborationAPIClient_UpdateShare_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewCollaborationAPIClient creates a new instance of CollaborationAPIClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
func NewCollaborationAPIClient(t mockConstructorTestingTNewCollaborationAPIClient) *CollaborationAPIClient {
|
||||
// The first argument is typically a *testing.T value.
|
||||
func NewCollaborationAPIClient(t interface {
|
||||
mock.TestingT
|
||||
Cleanup(func())
|
||||
}) *CollaborationAPIClient {
|
||||
mock := &CollaborationAPIClient{}
|
||||
mock.Mock.Test(t)
|
||||
|
||||
|
||||
+3989
-5
File diff suppressed because it is too large.
Load diff
-12
@@ -1,12 +0,0 @@
|
||||
language: go
|
||||
go:
|
||||
- "1.10.x"
|
||||
- "1.11.x"
|
||||
- "1.12.x"
|
||||
|
||||
before_install:
|
||||
- go get github.com/mattn/goveralls
|
||||
|
||||
script:
|
||||
- go test -v -race -cover
|
||||
- $GOPATH/bin/goveralls -service=travis-ci
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
|
||||
dist/
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
# This is an example .goreleaser.yml file with some sensible defaults.
|
||||
# Make sure to check the documentation at https://goreleaser.com
|
||||
|
||||
# The lines below are called `modelines`. See `:help modeline`
|
||||
# Feel free to remove those if you don't want/need to use them.
|
||||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
|
||||
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
|
||||
|
||||
version: 1
|
||||
|
||||
before:
|
||||
hooks:
|
||||
# You may remove this if you don't use go modules.
|
||||
- go mod tidy
|
||||
# you may remove this if you don't need go generate
|
||||
- go generate ./...
|
||||
|
||||
builds:
|
||||
- skip: true
|
||||
|
||||
archives:
|
||||
- format: tar.gz
|
||||
# this name template makes the OS and Arch compatible with the results of `uname`.
|
||||
name_template: >-
|
||||
{{ .ProjectName }}_
|
||||
{{- title .Os }}_
|
||||
{{- if eq .Arch "amd64" }}x86_64
|
||||
{{- else if eq .Arch "386" }}i386
|
||||
{{- else }}{{ .Arch }}{{ end }}
|
||||
{{- if .Arm }}v{{ .Arm }}{{ end }}
|
||||
# use zip for windows archives
|
||||
format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- "^docs:"
|
||||
- "^test:"
|
||||
Generated
Vendored
File renamed without changes.
Generated
Vendored
+15
-10
@@ -1,10 +1,5 @@
|
||||
# Imaging
|
||||
|
||||
[](https://godoc.org/github.com/disintegration/imaging)
|
||||
[](https://travis-ci.org/disintegration/imaging)
|
||||
[](https://coveralls.io/github/disintegration/imaging?branch=master)
|
||||
[](https://goreportcard.com/report/github.com/disintegration/imaging)
|
||||
|
||||
Package imaging provides basic image processing functions (resize, rotate, crop, brightness/contrast adjustments, etc.).
|
||||
|
||||
All the image processing functions provided by the package accept any image type that implements `image.Image` interface
|
||||
@@ -12,11 +7,11 @@ as an input, and return a new image of `*image.NRGBA` type (32bit RGBA colors, n
|
||||
|
||||
## Installation
|
||||
|
||||
go get -u github.com/disintegration/imaging
|
||||
go get -u github.com/kovidgoyal/imaging
|
||||
|
||||
## Documentation
|
||||
|
||||
http://godoc.org/github.com/disintegration/imaging
|
||||
https://pkg.go.dev/github.com/kovidgoyal/imaging
|
||||
|
||||
## Usage examples
|
||||
|
||||
@@ -129,12 +124,22 @@ Original image | Saturation = 30
|
||||
-----------------------------------|----------------------------------------------|---------------------------------------------
|
||||
 |  | 
|
||||
|
||||
### Hue adjustment
|
||||
|
||||
```go
|
||||
dstImage := imaging.AdjustHue(srcImage, 20)
|
||||
```
|
||||
|
||||
Original image | Hue = 60 | Hue = -60
|
||||
-----------------------------------|----------------------------------------------|---------------------------------------------
|
||||
 |  | 
|
||||
|
||||
## FAQ
|
||||
|
||||
### Incorrect image orientation after processing (e.g. an image appears rotated after resizing)
|
||||
|
||||
Most probably, the given image contains the EXIF orientation tag.
|
||||
The stadard `image/*` packages do not support loading and saving
|
||||
The standard `image/*` packages do not support loading and saving
|
||||
this kind of information. To fix the issue, try opening images with
|
||||
the `AutoOrientation` decode option. If this option is set to `true`,
|
||||
the image orientation is changed after decoding, according to the
|
||||
@@ -146,7 +151,7 @@ img, err := imaging.Open("test.jpg", imaging.AutoOrientation(true))
|
||||
|
||||
### What's the difference between `imaging` and `gift` packages?
|
||||
|
||||
[imaging](https://github.com/disintegration/imaging)
|
||||
[imaging](https://github.com/kovidgoyal/imaging)
|
||||
is designed to be a lightweight and simple image manipulation package.
|
||||
It provides basic image processing functions and a few helper functions
|
||||
such as `Open` and `Save`. It consistently returns *image.NRGBA image
|
||||
@@ -168,7 +173,7 @@ import (
|
||||
"image/color"
|
||||
"log"
|
||||
|
||||
"github.com/disintegration/imaging"
|
||||
"github.com/kovidgoyal/imaging"
|
||||
)
|
||||
|
||||
func main() {
|
||||
Generated
Vendored
+44
@@ -62,6 +62,10 @@ func Invert(img image.Image) *image.NRGBA {
|
||||
// dstImage = imaging.AdjustSaturation(srcImage, -10) // Decrease image saturation by 10%.
|
||||
//
|
||||
func AdjustSaturation(img image.Image, percentage float64) *image.NRGBA {
|
||||
if percentage == 0 {
|
||||
return Clone(img)
|
||||
}
|
||||
|
||||
percentage = math.Min(math.Max(percentage, -100), 100)
|
||||
multiplier := 1 + percentage/100
|
||||
|
||||
@@ -76,6 +80,34 @@ func AdjustSaturation(img image.Image, percentage float64) *image.NRGBA {
|
||||
})
|
||||
}
|
||||
|
||||
// AdjustHue changes the hue of the image using the shift parameter (measured in degrees) and returns the adjusted image.
|
||||
// The shift = 0 (or 360 / -360 / etc.) gives the original image.
|
||||
// The shift = 180 (or -180) corresponds to a 180° degree rotation of the color wheel and thus gives the image with its hue inverted for each pixel.
|
||||
//
|
||||
// Examples:
|
||||
// dstImage = imaging.AdjustHue(srcImage, 90) // Shift Hue by 90°.
|
||||
// dstImage = imaging.AdjustHue(srcImage, -30) // Shift Hue by -30°.
|
||||
//
|
||||
func AdjustHue(img image.Image, shift float64) *image.NRGBA {
|
||||
if math.Mod(shift, 360) == 0 {
|
||||
return Clone(img)
|
||||
}
|
||||
|
||||
summand := shift / 360
|
||||
|
||||
return AdjustFunc(img, func(c color.NRGBA) color.NRGBA {
|
||||
h, s, l := rgbToHSL(c.R, c.G, c.B)
|
||||
h += summand
|
||||
h = math.Mod(h, 1)
|
||||
//Adding 1 because Golang's Modulo function behaves differently to similar operators in most other languages.
|
||||
if h < 0 {
|
||||
h++
|
||||
}
|
||||
r, g, b := hslToRGB(h, s, l)
|
||||
return color.NRGBA{r, g, b, c.A}
|
||||
})
|
||||
}
|
||||
|
||||
// AdjustContrast changes the contrast of the image using the percentage parameter and returns the adjusted image.
|
||||
// The percentage must be in range (-100, 100). The percentage = 0 gives the original image.
|
||||
// The percentage = -100 gives solid gray image.
|
||||
@@ -86,6 +118,10 @@ func AdjustSaturation(img image.Image, percentage float64) *image.NRGBA {
|
||||
// dstImage = imaging.AdjustContrast(srcImage, 20) // Increase image contrast by 20%.
|
||||
//
|
||||
func AdjustContrast(img image.Image, percentage float64) *image.NRGBA {
|
||||
if percentage == 0 {
|
||||
return Clone(img)
|
||||
}
|
||||
|
||||
percentage = math.Min(math.Max(percentage, -100.0), 100.0)
|
||||
lut := make([]uint8, 256)
|
||||
|
||||
@@ -114,6 +150,10 @@ func AdjustContrast(img image.Image, percentage float64) *image.NRGBA {
|
||||
// dstImage = imaging.AdjustBrightness(srcImage, 10) // Increase image brightness by 10%.
|
||||
//
|
||||
func AdjustBrightness(img image.Image, percentage float64) *image.NRGBA {
|
||||
if percentage == 0 {
|
||||
return Clone(img)
|
||||
}
|
||||
|
||||
percentage = math.Min(math.Max(percentage, -100.0), 100.0)
|
||||
lut := make([]uint8, 256)
|
||||
|
||||
@@ -134,6 +174,10 @@ func AdjustBrightness(img image.Image, percentage float64) *image.NRGBA {
|
||||
// dstImage = imaging.AdjustGamma(srcImage, 0.7)
|
||||
//
|
||||
func AdjustGamma(img image.Image, gamma float64) *image.NRGBA {
|
||||
if gamma == 1 {
|
||||
return Clone(img)
|
||||
}
|
||||
|
||||
e := 1.0 / math.Max(gamma, 0.0001)
|
||||
lut := make([]uint8, 256)
|
||||
|
||||
Generated
Vendored
File renamed without changes.
Generated
Vendored
File renamed without changes.
Generated
Vendored
File renamed without changes.
Generated
Vendored
File renamed without changes.
Generated
Vendored
File renamed without changes.
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python
|
||||
# License: GPLv3 Copyright: 2024, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
|
||||
def run(*args: str):
|
||||
cp = subprocess.run(args)
|
||||
if cp.returncode != 0:
|
||||
raise SystemExit(cp.returncode)
|
||||
|
||||
|
||||
def main():
|
||||
version = input('Enter the version to publish: ')
|
||||
try:
|
||||
ans = input(f'Publish version \033[91m{version}\033[m (y/n): ')
|
||||
except KeyboardInterrupt:
|
||||
ans = 'n'
|
||||
if ans.lower() != 'y':
|
||||
return
|
||||
os.environ['GITHUB_TOKEN'] = open(os.path.join(os.environ['PENV'], 'github-token')).read().strip()
|
||||
run('git', 'tag', '-a', 'v' + version, '-m', f'version {version}')
|
||||
run('git', 'push')
|
||||
run('goreleaser', 'release')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Generated
Vendored
+6
-4
@@ -87,6 +87,10 @@ func Resize(img image.Image, width, height int, filter ResampleFilter) *image.NR
|
||||
dstH = int(math.Max(1.0, math.Floor(tmpH+0.5)))
|
||||
}
|
||||
|
||||
if srcW == dstW && srcH == dstH {
|
||||
return Clone(img)
|
||||
}
|
||||
|
||||
if filter.Support <= 0 {
|
||||
// Nearest-neighbor special case.
|
||||
return resizeNearest(img, dstW, dstH)
|
||||
@@ -98,10 +102,8 @@ func Resize(img image.Image, width, height int, filter ResampleFilter) *image.NR
|
||||
if srcW != dstW {
|
||||
return resizeHorizontal(img, dstW, filter)
|
||||
}
|
||||
if srcH != dstH {
|
||||
return resizeVertical(img, dstH, filter)
|
||||
}
|
||||
return Clone(img)
|
||||
return resizeVertical(img, dstH, filter)
|
||||
|
||||
}
|
||||
|
||||
func resizeHorizontal(img image.Image, width int, filter ResampleFilter) *image.NRGBA {
|
||||
Generated
Vendored
+1
-1
@@ -18,7 +18,7 @@ func newScanner(img image.Image) *scanner {
|
||||
h: img.Bounds().Dy(),
|
||||
}
|
||||
if img, ok := img.(*image.Paletted); ok {
|
||||
s.palette = make([]color.NRGBA, len(img.Palette))
|
||||
s.palette = make([]color.NRGBA, max(256, len(img.Palette)))
|
||||
for i := 0; i < len(img.Palette); i++ {
|
||||
s.palette[i] = color.NRGBAModel.Convert(img.Palette[i]).(color.NRGBA)
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
" Empty for the moment
|
||||
|
||||
Generated
Vendored
+8
@@ -96,6 +96,10 @@ func Crop(img image.Image, rect image.Rectangle) *image.NRGBA {
|
||||
if r.Empty() {
|
||||
return &image.NRGBA{}
|
||||
}
|
||||
if r.Eq(img.Bounds().Sub(img.Bounds().Min)) {
|
||||
return Clone(img)
|
||||
}
|
||||
|
||||
src := newScanner(img)
|
||||
dst := image.NewNRGBA(image.Rect(0, 0, r.Dx(), r.Dy()))
|
||||
rowSize := r.Dx() * 4
|
||||
@@ -133,6 +137,10 @@ func Paste(background, img image.Image, pos image.Point) *image.NRGBA {
|
||||
if interRect.Empty() {
|
||||
return dst
|
||||
}
|
||||
if interRect.Eq(dst.Bounds()) {
|
||||
return Clone(img)
|
||||
}
|
||||
|
||||
src := newScanner(img)
|
||||
parallel(interRect.Min.Y, interRect.Max.Y, func(ys <-chan int) {
|
||||
for y := range ys {
|
||||
Generated
Vendored
File renamed without changes.
Generated
Vendored
+13
@@ -5,8 +5,17 @@ import (
|
||||
"math"
|
||||
"runtime"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
var maxProcs int64
|
||||
|
||||
// SetMaxProcs limits the number of concurrent processing goroutines to the given value.
|
||||
// A value <= 0 clears the limit.
|
||||
func SetMaxProcs(value int) {
|
||||
atomic.StoreInt64(&maxProcs, int64(value))
|
||||
}
|
||||
|
||||
// parallel processes the data in separate goroutines.
|
||||
func parallel(start, stop int, fn func(<-chan int)) {
|
||||
count := stop - start
|
||||
@@ -15,6 +24,10 @@ func parallel(start, stop int, fn func(<-chan int)) {
|
||||
}
|
||||
|
||||
procs := runtime.GOMAXPROCS(0)
|
||||
limit := int(atomic.LoadInt64(&maxProcs))
|
||||
if procs > limit && limit > 0 {
|
||||
procs = limit
|
||||
}
|
||||
if procs > count {
|
||||
procs = count
|
||||
}
|
||||
Vendored
+4
-4
@@ -359,7 +359,7 @@ github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1
|
||||
github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1
|
||||
github.com/cs3org/go-cs3apis/cs3/tx/v1beta1
|
||||
github.com/cs3org/go-cs3apis/cs3/types/v1beta1
|
||||
# github.com/cs3org/reva/v2 v2.19.5
|
||||
# github.com/cs3org/reva/v2 v2.19.7
|
||||
## explicit; go 1.21
|
||||
github.com/cs3org/reva/v2/cmd/revad/internal/grace
|
||||
github.com/cs3org/reva/v2/cmd/revad/runtime
|
||||
@@ -747,9 +747,6 @@ github.com/dgryski/go-rendezvous
|
||||
# github.com/dhowden/tag v0.0.0-20230630033851-978a0926ee25
|
||||
## explicit; go 1.18
|
||||
github.com/dhowden/tag
|
||||
# github.com/disintegration/imaging v1.6.2
|
||||
## explicit
|
||||
github.com/disintegration/imaging
|
||||
# github.com/dlclark/regexp2 v1.4.0
|
||||
## explicit
|
||||
github.com/dlclark/regexp2
|
||||
@@ -1245,6 +1242,9 @@ github.com/klauspost/compress/s2
|
||||
# github.com/klauspost/cpuid/v2 v2.2.6
|
||||
## explicit; go 1.15
|
||||
github.com/klauspost/cpuid/v2
|
||||
# github.com/kovidgoyal/imaging v1.6.3
|
||||
## explicit; go 1.21
|
||||
github.com/kovidgoyal/imaging
|
||||
# github.com/leodido/go-urn v1.4.0
|
||||
## explicit; go 1.18
|
||||
github.com/leodido/go-urn
|
||||
|
||||
Reference in new issue
Block a user