Compare commits
115
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de129fee16 | ||
|
|
ca815b0704 | ||
|
|
c17423adcd | ||
|
|
3f2ba604cc | ||
|
|
46c46eb48c | ||
|
|
e060eb8b44 | ||
|
|
9fc5d89bc7 | ||
|
|
d046d5e726 | ||
|
|
552941184a | ||
|
|
3e40c278a7 | ||
|
|
a2e642aead | ||
|
|
58447b3e96 | ||
|
|
2fbb6c9933 | ||
|
|
c04f3dad0d | ||
|
|
89754fd412 | ||
|
|
ef277d3267 | ||
|
|
94aee2d367 | ||
|
|
ed48814009 | ||
|
|
42e7220528 | ||
|
|
db41f46697 | ||
|
|
621ec66baf | ||
|
|
690175236c | ||
|
|
2b755c39bf | ||
|
|
204ff6574b | ||
|
|
8a1241bb3c | ||
|
|
39ef9d92e1 | ||
|
|
7678fa2f92 | ||
|
|
caecf781e3 | ||
|
|
66c1249921 | ||
|
|
a701bbc8db | ||
|
|
c262be77ec | ||
|
|
79f929236c | ||
|
|
105df0c8e4 | ||
|
|
b4f5957e71 | ||
|
|
263921591b | ||
|
|
5d1059e4ff | ||
|
|
0497062d0d | ||
|
|
23329bc86a | ||
|
|
6496fec15b | ||
|
|
69bdc34b6e | ||
|
|
7d8fe2c44d | ||
|
|
93b14bc454 | ||
|
|
0f89f2b7fd | ||
|
|
0c97d3edd0 | ||
|
|
9355cc5912 | ||
|
|
53553a9bfd | ||
|
|
315f52328d | ||
|
|
f8e5175df5 | ||
|
|
077e56e2c7 | ||
|
|
624f681ce6 | ||
|
|
214491134f | ||
|
|
4a57e98780 | ||
|
|
c443dc68a0 | ||
|
|
f47c387133 | ||
|
|
4e1e529ef0 | ||
|
|
4decd85767 | ||
|
|
4722b63514 | ||
|
|
c74c8d31f3 | ||
|
|
6c246fb56d | ||
|
|
d661296c04 | ||
|
|
a10cfe188d | ||
|
|
5f89a7de98 | ||
|
|
b77ef1a4b2 | ||
|
|
8b846ca1c8 | ||
|
|
63121b7f37 | ||
|
|
f6bd1ad16e | ||
|
|
10c189d86c | ||
|
|
87c3384ab1 | ||
|
|
4ab23b0df5 | ||
|
|
6446f513bb | ||
|
|
14db9274c8 | ||
|
|
58c3caae07 | ||
|
|
c6aab01486 | ||
|
|
dc5b59688d | ||
|
|
f2f558bfa7 | ||
|
|
380435aab4 | ||
|
|
482591ecd1 | ||
|
|
48ab941943 | ||
|
|
4537755ca0 | ||
|
|
47a593766b | ||
|
|
f06d683b70 | ||
|
|
887f41cc3b | ||
|
|
3812f50eba | ||
|
|
959695e8fe | ||
|
|
b35314fb0a | ||
|
|
9b90219a2d | ||
|
|
7756ab9a66 | ||
|
|
2a6b1de60f | ||
|
|
3a1988c351 | ||
|
|
472650d41d | ||
|
|
5a86cf03b2 | ||
|
|
a9bce7c4e3 | ||
|
|
3de2be5caa | ||
|
|
447967b985 | ||
|
|
67f86499ef | ||
|
|
8b9dcc6a84 | ||
|
|
9d02a5a291 | ||
|
|
e97b4592aa | ||
|
|
ed4c69fabd | ||
|
|
b2a4e806c5 | ||
|
|
a85e174c35 | ||
|
|
31e1d03a38 | ||
|
|
e10d5822bb | ||
|
|
b95f4a05cf | ||
|
|
1128490ba0 | ||
|
|
698f9ba93d | ||
|
|
81bac5e97f | ||
|
|
dfb53fc52b | ||
|
|
a2d4db4ae0 | ||
|
|
bc5ab41402 | ||
|
|
a4eb34628f | ||
|
|
328579186a | ||
|
|
819cf505f8 | ||
|
|
86ec03dac5 | ||
|
|
0eeee16b1d |
No files matched your search
+1
-1
@@ -1,3 +1,3 @@
|
||||
# The test runner source for UI tests
|
||||
WEB_COMMITID=97a5cf669626ed83acaeb2f7e8aaf542d42100c2
|
||||
WEB_COMMITID=2095462acf3163569802daef1eba0bc9b17710f4
|
||||
WEB_BRANCH=stable-8.0
|
||||
+133
-236
@@ -18,7 +18,6 @@ OC_CI_PHP = "owncloudci/php:%s"
|
||||
OC_CI_WAIT_FOR = "owncloudci/wait-for:latest"
|
||||
OC_CS3_API_VALIDATOR = "owncloud/cs3api-validator:0.2.1"
|
||||
OC_LITMUS = "owncloudci/litmus:latest"
|
||||
OC_OC_TEST_MIDDLEWARE = "owncloud/owncloud-test-middleware:1.8.8"
|
||||
OC_UBUNTU = "owncloud/ubuntu:20.04"
|
||||
PLUGINS_CODACY = "plugins/codacy:1"
|
||||
PLUGINS_DOCKER = "plugins/docker:latest"
|
||||
@@ -30,7 +29,6 @@ PLUGINS_S3 = "plugins/s3:latest"
|
||||
PLUGINS_S3_CACHE = "plugins/s3-cache:1"
|
||||
PLUGINS_SLACK = "plugins/slack:1"
|
||||
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 = "8.2"
|
||||
@@ -134,16 +132,20 @@ config = {
|
||||
"skip": False,
|
||||
"skipExceptParts": [],
|
||||
},
|
||||
"uiTests": {
|
||||
"filterTags": "@ocisSmokeTest",
|
||||
"skip": False,
|
||||
"skipExceptParts": [],
|
||||
},
|
||||
"e2eTests": {
|
||||
"skip": False,
|
||||
"basic": {
|
||||
"skip": False,
|
||||
"totalParts": 4, # divide and run all suites in parts (divide pipelines)
|
||||
"xsuites": ["search", "app-provider"], # suites to skip
|
||||
},
|
||||
"search": {
|
||||
"skip": False,
|
||||
"suites": ["search"], # suites to run
|
||||
"tikaNeeded": True,
|
||||
},
|
||||
},
|
||||
"rocketchat": {
|
||||
"channel": "infinitescale",
|
||||
"channel": "builds",
|
||||
"channel_cron": "builds",
|
||||
"from_secret": "rocketchat_talk_webhook",
|
||||
},
|
||||
@@ -319,11 +321,19 @@ def buildWebCache(ctx):
|
||||
def testOcisAndUploadResults(ctx):
|
||||
pipeline = testOcis(ctx)
|
||||
|
||||
######################################################################
|
||||
# The triggers have been disabled for now, since the govulncheck can #
|
||||
# not silence single, acceptable vulnerabilities. #
|
||||
# See https://github.com/owncloud/ocis/issues/9527 for more details. #
|
||||
# FIXME: RE-ENABLE THIS ASAP!!! #
|
||||
######################################################################
|
||||
|
||||
scan_result_upload = uploadScanResults(ctx)
|
||||
scan_result_upload["depends_on"] = getPipelineNames([pipeline])
|
||||
|
||||
security_scan = scanOcis(ctx)
|
||||
return [security_scan, pipeline, scan_result_upload]
|
||||
#security_scan = scanOcis(ctx)
|
||||
#return [security_scan, pipeline, scan_result_upload]
|
||||
return [pipeline, scan_result_upload]
|
||||
|
||||
def testPipelines(ctx):
|
||||
pipelines = []
|
||||
@@ -341,11 +351,7 @@ def testPipelines(ctx):
|
||||
if "skip" not in config["apiTests"] or not config["apiTests"]["skip"]:
|
||||
pipelines += apiTests(ctx)
|
||||
|
||||
if "skip" not in config["uiTests"] or not config["uiTests"]["skip"]:
|
||||
pipelines += uiTests(ctx)
|
||||
|
||||
if "skip" not in config["e2eTests"] or not config["e2eTests"]["skip"]:
|
||||
pipelines += e2eTests(ctx)
|
||||
pipelines += e2eTestPipeline(ctx)
|
||||
|
||||
return pipelines
|
||||
|
||||
@@ -948,7 +954,7 @@ def wopiValidatorTests(ctx, storage, accounts_hash_difficulty = 4):
|
||||
[
|
||||
{
|
||||
"name": "wopiserver",
|
||||
"image": "cs3org/wopiserver:v10.3.0",
|
||||
"image": "cs3org/wopiserver:v10.4.0",
|
||||
"detach": True,
|
||||
"commands": [
|
||||
"cp %s/tests/config/drone/wopiserver.conf /etc/wopi/wopiserver.conf" % (dirs["base"]),
|
||||
@@ -1051,134 +1057,13 @@ def apiTests(ctx):
|
||||
|
||||
return pipelines
|
||||
|
||||
def uiTests(ctx):
|
||||
default = {
|
||||
"filterTags": "",
|
||||
def e2eTestPipeline(ctx):
|
||||
defaults = {
|
||||
"skip": False,
|
||||
# only used if 'full-ci' is in build title or if run by cron
|
||||
"numberOfParts": 20,
|
||||
"skipExceptParts": [],
|
||||
}
|
||||
params = {}
|
||||
pipelines = []
|
||||
|
||||
for item in default:
|
||||
params[item] = config["uiTests"][item] if item in config["uiTests"] else default[item]
|
||||
|
||||
filterTags = params["filterTags"]
|
||||
|
||||
if ("full-ci" in ctx.build.title.lower() or ctx.build.event == "cron"):
|
||||
numberOfParts = params["numberOfParts"]
|
||||
skipExceptParts = params["skipExceptParts"]
|
||||
debugPartsEnabled = (len(skipExceptParts) != 0)
|
||||
|
||||
for runPart in range(1, numberOfParts + 1):
|
||||
if (not debugPartsEnabled or (debugPartsEnabled and runPart in skipExceptParts)):
|
||||
pipelines.append(uiTestPipeline(ctx, "", runPart, numberOfParts))
|
||||
|
||||
# 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" 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"))
|
||||
|
||||
return pipelines
|
||||
|
||||
def uiTestPipeline(ctx, filterTags, runPart = 1, numberOfParts = 1, storage = "ocis", uniqueName = "", accounts_hash_difficulty = 4):
|
||||
standardFilterTags = "not @skipOnOCIS and not @skip and not @notToImplementOnOCIS and not @federated-server-needed"
|
||||
if filterTags == "":
|
||||
finalFilterTags = standardFilterTags
|
||||
expectedFailuresFileFilterTags = ""
|
||||
else:
|
||||
finalFilterTags = filterTags + " and " + standardFilterTags
|
||||
expectedFailuresFileFilterTags = "-" + filterTags.lstrip("@")
|
||||
|
||||
if uniqueName == "":
|
||||
uniqueNameString = ""
|
||||
else:
|
||||
finalFilterTags = filterTags + " and " + standardFilterTags
|
||||
uniqueNameString = "-" + uniqueName
|
||||
|
||||
if numberOfParts == 1:
|
||||
pipelineName = "Web-Tests-ocis%s-%s-storage" % (uniqueNameString, storage)
|
||||
else:
|
||||
pipelineName = "Web-Tests-ocis%s-%s-storage-%s" % (uniqueNameString, storage, runPart)
|
||||
|
||||
extra_server_environment = {
|
||||
"OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD": False,
|
||||
"OCIS_PASSWORD_POLICY_MIN_CHARACTERS": 1,
|
||||
"OCIS_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS": 0,
|
||||
"OCIS_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS": 0,
|
||||
"OCIS_PASSWORD_POLICY_MIN_DIGITS": 0,
|
||||
"OCIS_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS": 0,
|
||||
}
|
||||
|
||||
return {
|
||||
"kind": "pipeline",
|
||||
"type": "docker",
|
||||
"name": pipelineName,
|
||||
"platform": {
|
||||
"os": "linux",
|
||||
"arch": "amd64",
|
||||
},
|
||||
"steps": skipIfUnchanged(ctx, "acceptance-tests") +
|
||||
restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin") +
|
||||
restoreWebCache() +
|
||||
restoreWebPnpmCache() +
|
||||
ocisServer(storage, accounts_hash_difficulty, extra_server_environment = extra_server_environment) +
|
||||
waitForSeleniumService() +
|
||||
waitForMiddlewareService() +
|
||||
[
|
||||
{
|
||||
"name": "webUITests",
|
||||
"image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION,
|
||||
"environment": {
|
||||
"SERVER_HOST": "https://ocis-server:9200",
|
||||
"BACKEND_HOST": "https://ocis-server:9200",
|
||||
"OCIS_REVA_DATA_ROOT": "%s" % dirs["ocisRevaDataRoot"],
|
||||
"WEB_UI_CONFIG_FILE": "%s/%s" % (dirs["base"], dirs["ocisConfig"]),
|
||||
"TEST_TAGS": finalFilterTags,
|
||||
"LOCAL_UPLOAD_DIR": "/uploads",
|
||||
"NODE_TLS_REJECT_UNAUTHORIZED": 0,
|
||||
"RUN_PART": runPart,
|
||||
"DIVIDE_INTO_NUM_PARTS": numberOfParts,
|
||||
"EXPECTED_FAILURES_FILE": "/%s/tests/acceptance/expected-failures-webUI-on-%s-storage%s.md" % (dirs["base"], storage.upper(), expectedFailuresFileFilterTags),
|
||||
"MIDDLEWARE_HOST": "http://middleware:3000",
|
||||
},
|
||||
"commands": [
|
||||
"cd %s/tests/acceptance" % dirs["web"],
|
||||
"./run.sh",
|
||||
],
|
||||
},
|
||||
],
|
||||
"services": selenium() + middlewareService(),
|
||||
"volumes": [{
|
||||
"name": "uploads",
|
||||
"temp": {},
|
||||
}],
|
||||
"depends_on": getPipelineNames(buildOcisBinaryForTesting(ctx) + buildWebCache(ctx)),
|
||||
"trigger": {
|
||||
"ref": [
|
||||
"refs/heads/stable-*",
|
||||
"refs/pull/**",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
def e2eTests(ctx):
|
||||
test_suites = {
|
||||
"suite1": {
|
||||
"path": "tests/e2e/cucumber/features/{smoke,journeys}/*.feature",
|
||||
"tikaNeeded": False,
|
||||
},
|
||||
"suite2": {
|
||||
"path": "tests/e2e/cucumber/features/smoke/{spaces,admin-settings}/*.feature",
|
||||
"tikaNeeded": False,
|
||||
},
|
||||
"suite3": {
|
||||
"path": "tests/e2e/cucumber/features/smoke/{search,shares}/*.feature",
|
||||
"tikaNeeded": True,
|
||||
},
|
||||
"suites": [],
|
||||
"xsuites": [],
|
||||
"totalParts": 0,
|
||||
"tikaNeeded": False,
|
||||
}
|
||||
|
||||
extra_server_environment = {
|
||||
@@ -1207,40 +1092,80 @@ def e2eTests(ctx):
|
||||
pipelines = []
|
||||
|
||||
if ("skip-e2e" in ctx.build.title.lower()):
|
||||
return []
|
||||
return pipelines
|
||||
|
||||
for name, suite in test_suites.items():
|
||||
steps = \
|
||||
if (ctx.build.event == "tag"):
|
||||
return pipelines
|
||||
|
||||
for name, suite in config["e2eTests"].items():
|
||||
if "skip" in suite and suite["skip"]:
|
||||
return pipelines
|
||||
|
||||
params = {}
|
||||
for item in defaults:
|
||||
params[item] = suite[item] if item in suite else defaults[item]
|
||||
|
||||
e2e_args = ""
|
||||
if params["totalParts"] > 0:
|
||||
e2e_args = "--total-parts %d" % params["totalParts"]
|
||||
elif params["suites"]:
|
||||
e2e_args = "--suites %s" % ",".join(params["suites"])
|
||||
|
||||
# suites to skip
|
||||
if params["xsuites"]:
|
||||
e2e_args += " --xsuites %s" % ",".join(params["xsuites"])
|
||||
|
||||
steps_before = \
|
||||
skipIfUnchanged(ctx, "e2e-tests") + \
|
||||
restoreBuildArtifactCache(ctx, "ocis-binary-amd64", "ocis/bin/ocis") + \
|
||||
restoreWebCache() + \
|
||||
restoreWebPnpmCache() + \
|
||||
(tikaService() if suite["tikaNeeded"] else []) + \
|
||||
ocisServer("ocis", 4, [], extra_server_environment = extra_server_environment, tika_enabled = suite["tikaNeeded"]) + \
|
||||
[{
|
||||
"name": "e2e-tests",
|
||||
"image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION,
|
||||
"environment": {
|
||||
"BASE_URL_OCIS": "ocis-server:9200",
|
||||
"HEADLESS": "true",
|
||||
"RETRY": "1",
|
||||
"WEB_UI_CONFIG_FILE": "%s/%s" % (dirs["base"], dirs["ocisConfig"]),
|
||||
"LOCAL_UPLOAD_DIR": "/uploads",
|
||||
},
|
||||
"commands": [
|
||||
"cd %s" % dirs["web"],
|
||||
"pnpm test:e2e:cucumber %s" % suite["path"],
|
||||
],
|
||||
}] + \
|
||||
uploadTracingResult(ctx) + \
|
||||
logTracingResults()
|
||||
(tikaService() if params["tikaNeeded"] else []) + \
|
||||
ocisServer("ocis", 4, [], extra_server_environment = extra_server_environment, tika_enabled = params["tikaNeeded"])
|
||||
|
||||
if (ctx.build.event != "tag"):
|
||||
step_e2e = {
|
||||
"name": "e2e-tests",
|
||||
"image": OC_CI_NODEJS % DEFAULT_NODEJS_VERSION,
|
||||
"environment": {
|
||||
"BASE_URL_OCIS": "ocis-server:9200",
|
||||
"HEADLESS": "true",
|
||||
"RETRY": "1",
|
||||
"WEB_UI_CONFIG_FILE": "%s/%s" % (dirs["base"], dirs["ocisConfig"]),
|
||||
"LOCAL_UPLOAD_DIR": "/uploads",
|
||||
},
|
||||
"commands": [
|
||||
"cd %s/tests/e2e" % dirs["web"],
|
||||
],
|
||||
}
|
||||
|
||||
steps_after = uploadTracingResult(ctx) + \
|
||||
logTracingResults()
|
||||
|
||||
if params["totalParts"]:
|
||||
for index in range(params["totalParts"]):
|
||||
run_part = index + 1
|
||||
run_e2e = {}
|
||||
run_e2e.update(step_e2e)
|
||||
run_e2e["commands"] = [
|
||||
"cd %s/tests/e2e" % dirs["web"],
|
||||
"bash run-e2e.sh %s --run-part %d" % (e2e_args, run_part),
|
||||
]
|
||||
pipelines.append({
|
||||
"kind": "pipeline",
|
||||
"type": "docker",
|
||||
"name": "e2e-tests-%s-%s" % (name, run_part),
|
||||
"steps": steps_before + [run_e2e] + steps_after,
|
||||
"depends_on": getPipelineNames(buildOcisBinaryForTesting(ctx) + buildWebCache(ctx)),
|
||||
"trigger": e2e_trigger,
|
||||
"volumes": e2e_volumes,
|
||||
})
|
||||
else:
|
||||
step_e2e["commands"].append("bash run-e2e.sh %s" % e2e_args)
|
||||
pipelines.append({
|
||||
"kind": "pipeline",
|
||||
"type": "docker",
|
||||
"name": "e2e-tests-%s" % name,
|
||||
"steps": steps,
|
||||
"steps": steps_before + [step_e2e] + steps_after,
|
||||
"depends_on": getPipelineNames(buildOcisBinaryForTesting(ctx) + buildWebCache(ctx)),
|
||||
"trigger": e2e_trigger,
|
||||
"volumes": e2e_volumes,
|
||||
@@ -1309,7 +1234,7 @@ def dockerReleases(ctx):
|
||||
for arch in config["dockerReleases"]["architectures"]:
|
||||
pipelines.append(dockerRelease(ctx, arch))
|
||||
|
||||
manifest = releaseDockerManifest()
|
||||
manifest = releaseDockerManifest(ctx)
|
||||
manifest["depends_on"] = getPipelineNames(pipelines)
|
||||
pipelines.append(manifest)
|
||||
|
||||
@@ -1322,7 +1247,7 @@ def dockerReleases(ctx):
|
||||
def dockerRelease(ctx, arch):
|
||||
build_args = [
|
||||
"REVISION=%s" % (ctx.build.commit),
|
||||
"VERSION=%s" % (ctx.build.ref.replace("refs/tags/", "") if ctx.build.event == "tag" else "latest"),
|
||||
"VERSION=%s" % (ctx.build.ref.replace("refs/tags/", "") if ctx.build.event == "tag" else "stable"),
|
||||
]
|
||||
depends_on = getPipelineNames(testOcisAndUploadResults(ctx) + testPipelines(ctx))
|
||||
|
||||
@@ -1665,18 +1590,28 @@ def licenseCheck(ctx):
|
||||
"volumes": [pipelineVolumeGo],
|
||||
}]
|
||||
|
||||
def releaseDockerManifest():
|
||||
return {
|
||||
"kind": "pipeline",
|
||||
"type": "docker",
|
||||
"name": "manifest",
|
||||
"platform": {
|
||||
"os": "linux",
|
||||
"arch": "amd64",
|
||||
def releaseDockerManifest(ctx):
|
||||
steps = [{
|
||||
"name": "execute",
|
||||
"image": PLUGINS_MANIFEST,
|
||||
"settings": {
|
||||
"username": {
|
||||
"from_secret": "docker_username",
|
||||
},
|
||||
"password": {
|
||||
"from_secret": "docker_password",
|
||||
},
|
||||
"spec": "ocis/docker/manifest.tmpl",
|
||||
"auto_tag": True,
|
||||
"ignore_missing": True,
|
||||
},
|
||||
"steps": [
|
||||
}]
|
||||
|
||||
# only create latest tag for stable releases
|
||||
if len(ctx.build.ref.split("-")) == 1:
|
||||
steps.append(
|
||||
{
|
||||
"name": "execute",
|
||||
"name": "execute-latest",
|
||||
"image": PLUGINS_MANIFEST,
|
||||
"settings": {
|
||||
"username": {
|
||||
@@ -1685,12 +1620,27 @@ def releaseDockerManifest():
|
||||
"password": {
|
||||
"from_secret": "docker_password",
|
||||
},
|
||||
"spec": "ocis/docker/manifest.tmpl",
|
||||
"spec": "ocis/docker/manifest-latest.tmpl",
|
||||
"auto_tag": True,
|
||||
"ignore_missing": True,
|
||||
},
|
||||
"when": {
|
||||
"ref": [
|
||||
"refs/tags/v*",
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
)
|
||||
|
||||
return {
|
||||
"kind": "pipeline",
|
||||
"type": "docker",
|
||||
"name": "manifest",
|
||||
"platform": {
|
||||
"os": "linux",
|
||||
"arch": "amd64",
|
||||
},
|
||||
"steps": steps,
|
||||
"trigger": {
|
||||
"ref": [
|
||||
"refs/tags/v*",
|
||||
@@ -1788,7 +1738,7 @@ def releaseDockerReadme(ctx):
|
||||
"from_secret": "docker_password",
|
||||
},
|
||||
"PUSHRM_TARGET": "owncloud/${DRONE_REPO_NAME}",
|
||||
"PUSHRM_SHORT": "Docker images for %s" % (ctx.repo.name),
|
||||
"PUSHRM_SHORT": "Docker images for Infinite Scale stable releases",
|
||||
"PUSHRM_FILE": "README.md",
|
||||
},
|
||||
},
|
||||
@@ -2034,38 +1984,6 @@ def ocisServer(storage, accounts_hash_difficulty = 4, volumes = [], depends_on =
|
||||
wait_for_ocis,
|
||||
]
|
||||
|
||||
def middlewareService():
|
||||
return [{
|
||||
"name": "middleware",
|
||||
"image": OC_OC_TEST_MIDDLEWARE,
|
||||
"environment": {
|
||||
"BACKEND_HOST": "https://ocis-server:9200",
|
||||
"OCIS_REVA_DATA_ROOT": "%s/storage/owncloud/" % dirs["ocis"],
|
||||
"RUN_ON_OCIS": "true",
|
||||
"HOST": "middleware",
|
||||
"REMOTE_UPLOAD_DIR": "/uploads",
|
||||
"NODE_TLS_REJECT_UNAUTHORIZED": "0",
|
||||
"MIDDLEWARE_HOST": "middleware",
|
||||
"TEST_WITH_GRAPH_API": "true",
|
||||
},
|
||||
"volumes": [{
|
||||
"name": "uploads",
|
||||
"path": "/uploads",
|
||||
}, {
|
||||
"name": "gopath",
|
||||
"path": "/srv/app",
|
||||
}],
|
||||
}]
|
||||
|
||||
def waitForMiddlewareService():
|
||||
return [{
|
||||
"name": "wait-for-middleware-service",
|
||||
"image": OC_CI_WAIT_FOR,
|
||||
"commands": [
|
||||
"wait-for -it middleware:3000 -t 300",
|
||||
],
|
||||
}]
|
||||
|
||||
def redis():
|
||||
return [
|
||||
{
|
||||
@@ -2080,27 +1998,6 @@ def redisForOCStorage(storage = "ocis"):
|
||||
else:
|
||||
return
|
||||
|
||||
def selenium():
|
||||
return [
|
||||
{
|
||||
"name": "selenium",
|
||||
"image": SELENIUM_STANDALONE_CHROME,
|
||||
"volumes": [{
|
||||
"name": "uploads",
|
||||
"path": "/uploads",
|
||||
}],
|
||||
},
|
||||
]
|
||||
|
||||
def waitForSeleniumService():
|
||||
return [{
|
||||
"name": "wait-for-selenium-service",
|
||||
"image": OC_CI_WAIT_FOR,
|
||||
"commands": [
|
||||
"wait-for -it selenium:4444 -t 300",
|
||||
],
|
||||
}]
|
||||
|
||||
def build():
|
||||
return [
|
||||
{
|
||||
|
||||
+214
-24
@@ -1,5 +1,9 @@
|
||||
# Table of Contents
|
||||
|
||||
* [Changelog for unreleased](#changelog-for-unreleased-unreleased)
|
||||
* [Changelog for 5.0.6](#changelog-for-506-2024-07-17)
|
||||
* [Changelog for 5.0.5](#changelog-for-505-2024-05-22)
|
||||
* [Changelog for 5.0.4](#changelog-for-504-2024-05-13)
|
||||
* [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)
|
||||
@@ -14,8 +18,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.0](#changelog-for-1190-2022-03-29)
|
||||
* [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.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)
|
||||
@@ -36,6 +40,192 @@
|
||||
* [Changelog for 1.1.0](#changelog-for-110-2021-01-22)
|
||||
* [Changelog for 1.0.0](#changelog-for-100-2020-12-17)
|
||||
|
||||
# Changelog for [unreleased] (UNRELEASED)
|
||||
|
||||
The following sections list the changes for unreleased.
|
||||
|
||||
[unreleased]: https://github.com/owncloud/ocis/compare/v5.0.6...master
|
||||
|
||||
## Summary
|
||||
|
||||
* Enhancement - Add virus filter to sessions command: [#9041](https://github.com/owncloud/ocis/pull/9041)
|
||||
* Enhancement - Assimilate `clean` into `sessions` command: [#9828](https://github.com/owncloud/ocis/pull/9828)
|
||||
* Enhancement - Update web to v8.0.5: [#9958](https://github.com/owncloud/ocis/pull/9958)
|
||||
|
||||
## Details
|
||||
|
||||
* Enhancement - Add virus filter to sessions command: [#9041](https://github.com/owncloud/ocis/pull/9041)
|
||||
|
||||
Allow filtering upload session by virus status (has-virus=true/false)
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9041
|
||||
|
||||
* Enhancement - Assimilate `clean` into `sessions` command: [#9828](https://github.com/owncloud/ocis/pull/9828)
|
||||
|
||||
We deprecated `ocis storage-user uploads clean` and added the same logic to
|
||||
`ocis storage-users uploads session --clean`
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9828
|
||||
|
||||
* Enhancement - Update web to v8.0.5: [#9958](https://github.com/owncloud/ocis/pull/9958)
|
||||
|
||||
Tags: web
|
||||
|
||||
We updated ownCloud Web to v8.0.5. Please refer to the changelog (linked) for
|
||||
details on the web release.
|
||||
|
||||
- Bugfix [owncloud/web#11395](https://github.com/owncloud/web/pull/11395):
|
||||
Missing space members for group memberships - Bugfix
|
||||
[owncloud/web#11263](https://github.com/owncloud/web/pull/11263): Show more
|
||||
toggle in space members view not reactive - Bugfix
|
||||
[owncloud/web#11263](https://github.com/owncloud/web/pull/11263): Space show
|
||||
links from other spaces - Bugfix
|
||||
[owncloud/web#11303](https://github.com/owncloud/web/pull/11303): Uploading
|
||||
nested folders
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9958
|
||||
https://github.com/owncloud/web/releases/tag/v8.0.5
|
||||
|
||||
# Changelog for [5.0.6] (2024-07-17)
|
||||
|
||||
The following sections list the changes for 5.0.6.
|
||||
|
||||
[5.0.6]: https://github.com/owncloud/ocis/compare/v5.0.5...v5.0.6
|
||||
|
||||
## Summary
|
||||
|
||||
* Bugfix - Allow all uploads to restart: [#9506](https://github.com/owncloud/ocis/pull/9506)
|
||||
* Bugfix - Fix the email notification service: [#9514](https://github.com/owncloud/ocis/pull/9514)
|
||||
* Enhancement - Limit concurrent thumbnail requests: [#9199](https://github.com/owncloud/ocis/pull/9199)
|
||||
* Enhancement - Update web to v8.0.4: [#9429](https://github.com/owncloud/ocis/pull/9429)
|
||||
* Enhancement - Add cli to purge revisions: [#9497](https://github.com/owncloud/ocis/pull/9497)
|
||||
|
||||
## Details
|
||||
|
||||
* Bugfix - Allow all uploads to restart: [#9506](https://github.com/owncloud/ocis/pull/9506)
|
||||
|
||||
On postprocessing-restart, allow all uploads to restart even if one fails.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9506
|
||||
|
||||
* Bugfix - Fix the email notification service: [#9514](https://github.com/owncloud/ocis/pull/9514)
|
||||
|
||||
We fixed an error in the notification service that caused the email notification
|
||||
to fail when the user's display name contained special characters.
|
||||
|
||||
https://github.com/owncloud/ocis/issues/9402
|
||||
https://github.com/owncloud/ocis/pull/9514
|
||||
|
||||
* Enhancement - Limit concurrent thumbnail requests: [#9199](https://github.com/owncloud/ocis/pull/9199)
|
||||
|
||||
The number of concurrent requests to the thumbnail service can be limited now to
|
||||
have more control over the consumed system resources.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9199
|
||||
|
||||
* Enhancement - Update web to v8.0.4: [#9429](https://github.com/owncloud/ocis/pull/9429)
|
||||
|
||||
Tags: web
|
||||
|
||||
We updated ownCloud Web to v8.0.4. Please refer to the changelog (linked) for
|
||||
details on the web release.
|
||||
|
||||
- Bugfix [owncloud/web#10814](https://github.com/owncloud/web/issues/10814):
|
||||
Vertical scroll for OcModal on small screens - Bugfix
|
||||
[owncloud/web#10918](https://github.com/owncloud/web/issues/10918): Resource
|
||||
deselection on right-click - Bugfix
|
||||
[owncloud/web#10920](https://github.com/owncloud/web/pull/10920): Resources with
|
||||
name consist of number won't show up in trash bin - Bugfix
|
||||
[owncloud/web#10941](https://github.com/owncloud/web/issues/10941): Space not
|
||||
updating on navigation - Bugfix
|
||||
[owncloud/web#11063](https://github.com/owncloud/web/issues/11063): Enforce
|
||||
shortcut URL protocol - Bugfix
|
||||
[owncloud/web#11092](https://github.com/owncloud/web/issues/11092): Browser
|
||||
confirmation dialog after closing editor - Bugfix
|
||||
[owncloud/web#11091](https://github.com/owncloud/web/issues/11091): Button focus
|
||||
when closing editor - Bugfix
|
||||
[owncloud/web#10942](https://github.com/owncloud/web/issues/10942): Keyboard
|
||||
navigation breaking - Bugfix
|
||||
[owncloud/web#11086](https://github.com/owncloud/web/pull/11086): Opening public
|
||||
links with an expired token
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9429
|
||||
https://github.com/owncloud/ocis/pull/9510
|
||||
https://github.com/owncloud/web/releases/tag/v8.0.3
|
||||
https://github.com/owncloud/web/releases/tag/v8.0.4
|
||||
|
||||
* Enhancement - Add cli to purge revisions: [#9497](https://github.com/owncloud/ocis/pull/9497)
|
||||
|
||||
Adds a cli that allows removing all revisions for a storage-provider.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9497
|
||||
|
||||
# Changelog for [5.0.5] (2024-05-22)
|
||||
|
||||
The following sections list the changes for 5.0.5.
|
||||
|
||||
[5.0.5]: https://github.com/owncloud/ocis/compare/v5.0.4...v5.0.5
|
||||
|
||||
## Summary
|
||||
|
||||
* Enhancement - Update web to v8.0.2: [#9153](https://github.com/owncloud/ocis/pull/9153)
|
||||
|
||||
## Details
|
||||
|
||||
* Enhancement - Update web to v8.0.2: [#9153](https://github.com/owncloud/ocis/pull/9153)
|
||||
|
||||
Tags: web
|
||||
|
||||
We updated ownCloud Web to v8.0.2. Please refer to the changelog (linked) for
|
||||
details on the web release.
|
||||
|
||||
* Bugfix [owncloud/web#10515](https://github.com/owncloud/web/issues/10515): Folder replace
|
||||
* Bugfix [owncloud/web#10598](https://github.com/owncloud/web/issues/10598): Hidden right sidebar on small screens
|
||||
* Bugfix [owncloud/web#10634](https://github.com/owncloud/web/issues/10634): Scope loss when showing search results
|
||||
* Bugfix [owncloud/web#10657](https://github.com/owncloud/web/issues/10657): Theme loading without matching theme
|
||||
* Bugfix [owncloud/web#10763](https://github.com/owncloud/web/pull/10763): Flickering loading indicator
|
||||
* Bugfix [owncloud/web#10810](https://github.com/owncloud/web/issues/10810): Download files with special chars in name
|
||||
* Bugfix [owncloud/web#10881](https://github.com/owncloud/web/pull/10881): IDP logout issues
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9153
|
||||
https://github.com/owncloud/web/releases/tag/v8.0.2
|
||||
|
||||
# Changelog for [5.0.4] (2024-05-13)
|
||||
|
||||
The following sections list the changes for 5.0.4.
|
||||
|
||||
[5.0.4]: https://github.com/owncloud/ocis/compare/v5.0.3...v5.0.4
|
||||
|
||||
## 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.
|
||||
@@ -46,7 +236,7 @@ The following sections list the changes for 5.0.3.
|
||||
|
||||
* 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.5: [#9011](https://github.com/owncloud/ocis/pull/9011)
|
||||
* 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
|
||||
@@ -69,9 +259,9 @@ The following sections list the changes for 5.0.3.
|
||||
https://github.com/owncloud/ocis/pull/8981
|
||||
https://github.com/advisories/GHSA-q7pp-wcgr-pffx
|
||||
|
||||
* Bugfix - Update reva to v2.19.5: [#9011](https://github.com/owncloud/ocis/pull/9011)
|
||||
* Bugfix - Update reva to v2.19.6: [#9011](https://github.com/owncloud/ocis/pull/9011)
|
||||
|
||||
We updated reva to v2.19.5
|
||||
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
|
||||
@@ -7383,7 +7573,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.0...v1.20.0
|
||||
[1.20.0]: https://github.com/owncloud/ocis/compare/v1.19.1...v1.20.0
|
||||
|
||||
## Summary
|
||||
|
||||
@@ -7557,11 +7747,29 @@ 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.19.1...v1.19.0
|
||||
[1.19.0]: https://github.com/owncloud/ocis/compare/v1.18.0...v1.19.0
|
||||
|
||||
## Summary
|
||||
|
||||
@@ -7735,24 +7943,6 @@ 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.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Bugfix: Update reva to v2.19.5
|
||||
Bugfix: Update reva to v2.19.6
|
||||
|
||||
We updated reva to v2.19.5
|
||||
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
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,16 @@
|
||||
Enhancement: Update web to v8.0.2
|
||||
|
||||
Tags: web
|
||||
|
||||
We updated ownCloud Web to v8.0.2. Please refer to the changelog (linked) for details on the web release.
|
||||
|
||||
* Bugfix [owncloud/web#10515](https://github.com/owncloud/web/issues/10515): Folder replace
|
||||
* Bugfix [owncloud/web#10598](https://github.com/owncloud/web/issues/10598): Hidden right sidebar on small screens
|
||||
* Bugfix [owncloud/web#10634](https://github.com/owncloud/web/issues/10634): Scope loss when showing search results
|
||||
* Bugfix [owncloud/web#10657](https://github.com/owncloud/web/issues/10657): Theme loading without matching theme
|
||||
* Bugfix [owncloud/web#10763](https://github.com/owncloud/web/pull/10763): Flickering loading indicator
|
||||
* Bugfix [owncloud/web#10810](https://github.com/owncloud/web/issues/10810): Download files with special chars in name
|
||||
* Bugfix [owncloud/web#10881](https://github.com/owncloud/web/pull/10881): IDP logout issues
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9153
|
||||
https://github.com/owncloud/web/releases/tag/v8.0.2
|
||||
@@ -0,0 +1,7 @@
|
||||
Bugfix: Fix the email notification service
|
||||
|
||||
We fixed an error in the notification service that caused the email notification to fail when the user's display name contained special characters.
|
||||
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9514
|
||||
https://github.com/owncloud/ocis/issues/9402
|
||||
@@ -0,0 +1,5 @@
|
||||
Bugfix: Allow all uploads to restart
|
||||
|
||||
On postprocessing-restart, allow all uploads to restart even if one fails.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9506
|
||||
@@ -0,0 +1,5 @@
|
||||
Enhancement: Add cli to purge revisions
|
||||
|
||||
Adds a cli that allows removing all revisions for a storage-provider.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9497
|
||||
@@ -0,0 +1,6 @@
|
||||
Enhancement: Limit concurrent thumbnail requests
|
||||
|
||||
The number of concurrent requests to the thumbnail service can be limited now
|
||||
to have more control over the consumed system resources.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9199
|
||||
@@ -0,0 +1,20 @@
|
||||
Enhancement: Update web to v8.0.4
|
||||
|
||||
Tags: web
|
||||
|
||||
We updated ownCloud Web to v8.0.4. Please refer to the changelog (linked) for details on the web release.
|
||||
|
||||
- Bugfix [owncloud/web#10814](https://github.com/owncloud/web/issues/10814): Vertical scroll for OcModal on small screens
|
||||
- Bugfix [owncloud/web#10918](https://github.com/owncloud/web/issues/10918): Resource deselection on right-click
|
||||
- Bugfix [owncloud/web#10920](https://github.com/owncloud/web/pull/10920): Resources with name consist of number won't show up in trash bin
|
||||
- Bugfix [owncloud/web#10941](https://github.com/owncloud/web/issues/10941): Space not updating on navigation
|
||||
- Bugfix [owncloud/web#11063](https://github.com/owncloud/web/issues/11063): Enforce shortcut URL protocol
|
||||
- Bugfix [owncloud/web#11092](https://github.com/owncloud/web/issues/11092): Browser confirmation dialog after closing editor
|
||||
- Bugfix [owncloud/web#11091](https://github.com/owncloud/web/issues/11091): Button focus when closing editor
|
||||
- Bugfix [owncloud/web#10942](https://github.com/owncloud/web/issues/10942): Keyboard navigation breaking
|
||||
- Bugfix [owncloud/web#11086](https://github.com/owncloud/web/pull/11086): Opening public links with an expired token
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9429
|
||||
https://github.com/owncloud/ocis/pull/9510
|
||||
https://github.com/owncloud/web/releases/tag/v8.0.3
|
||||
https://github.com/owncloud/web/releases/tag/v8.0.4
|
||||
@@ -0,0 +1,5 @@
|
||||
Enhancement: Add virus filter to sessions command
|
||||
|
||||
Allow filtering upload session by virus status (has-virus=true/false)
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9041
|
||||
@@ -0,0 +1,5 @@
|
||||
Enhancement: Assimilate `clean` into `sessions` command
|
||||
|
||||
We deprecated `ocis storage-user uploads clean` and added the same logic to `ocis storage-users uploads session --clean`
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9828
|
||||
@@ -0,0 +1,13 @@
|
||||
Enhancement: Update web to v8.0.5
|
||||
|
||||
Tags: web
|
||||
|
||||
We updated ownCloud Web to v8.0.5. Please refer to the changelog (linked) for details on the web release.
|
||||
|
||||
- Bugfix [owncloud/web#11395](https://github.com/owncloud/web/pull/11395): Missing space members for group memberships
|
||||
- Bugfix [owncloud/web#11263](https://github.com/owncloud/web/pull/11263): Show more toggle in space members view not reactive
|
||||
- Bugfix [owncloud/web#11263](https://github.com/owncloud/web/pull/11263): Space show links from other spaces
|
||||
- Bugfix [owncloud/web#11303](https://github.com/owncloud/web/pull/11303): Uploading nested folders
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9958
|
||||
https://github.com/owncloud/web/releases/tag/v8.0.5
|
||||
@@ -32,7 +32,7 @@
|
||||
env:
|
||||
INSECURE: "false"
|
||||
TRAEFIK_ACME_MAIL: mbarz@owncloud.com
|
||||
OCIS_DOCKER_TAG: 5.0.3
|
||||
OCIS_DOCKER_TAG: 5.0.5
|
||||
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.3
|
||||
OCIS_DOCKER_TAG: 5.0.5
|
||||
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.3
|
||||
OCIS_DOCKER_TAG: 5.0.5
|
||||
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.3
|
||||
OCIS_DOCKER_TAG: 5.0.7
|
||||
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
|
||||
|
||||
@@ -1,66 +1,214 @@
|
||||
# If you're on a internet facing server please comment out following line.
|
||||
# It skips certificate validation for various parts of oCIS and is needed if you use self signed certificates.
|
||||
# Define the docker compose log driver used.
|
||||
# Defaults to local
|
||||
LOG_DRIVER=
|
||||
|
||||
# If you're on an internet facing server. comment out following line.
|
||||
# It skips certificate validation for various parts of Infinite Scale and is
|
||||
# needed when self signed certificates are used.
|
||||
INSECURE=true
|
||||
|
||||
### Traefik settings ###
|
||||
# Serve Traefik dashboard. Defaults to "false".
|
||||
|
||||
### Traefik Settings ###
|
||||
|
||||
# Serve Traefik dashboard.
|
||||
# Defaults to "false".
|
||||
TRAEFIK_DASHBOARD=
|
||||
# Domain of Traefik, where you can find the dashboard. Defaults to "traefik.owncloud.test"
|
||||
|
||||
# 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" (written as: "admin:admin").
|
||||
|
||||
# Basic authentication for the traefik 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
|
||||
|
||||
# Email address for obtaining LetsEncrypt certificates.
|
||||
# Needs only be changed if this is a public facing server.
|
||||
TRAEFIK_ACME_MAIL=
|
||||
|
||||
### oCIS settings ###
|
||||
# oCIS version. Defaults to "latest"
|
||||
# Set to the following for testing to check the certificate process:
|
||||
# "https://acme-staging-v02.api.letsencrypt.org/directory"
|
||||
# With staging configured, there will be an SSL error in the browser.
|
||||
# When certificates are displayed and are emitted by # "Fake LE Intermediate X1",
|
||||
# the process went well and the envvar can be reset to empty to get valid certificates.
|
||||
TRAEFIK_ACME_CASERVER=
|
||||
|
||||
|
||||
### Infinite Scale Settings ###
|
||||
|
||||
# Beside Traefik, this service must stay enabled.
|
||||
# Disable only for testing purposes.
|
||||
OCIS=:ocis.yml
|
||||
|
||||
# The oCIS container image.
|
||||
# Defaults to "owncloud/ocis" which contains the production releases.
|
||||
OCIS_DOCKER_IMAGE=
|
||||
|
||||
# The oCIS container version.
|
||||
# Defaults to "latest". This will point to the latest production tag.
|
||||
OCIS_DOCKER_TAG=
|
||||
# Domain of oCIS, where you can find the frontend. Defaults to "ocis.owncloud.test"
|
||||
|
||||
# Domain of oCIS, where you can find the frontend.
|
||||
# Defaults to "ocis.owncloud.test"
|
||||
OCIS_DOMAIN=
|
||||
|
||||
# oCIS admin user password. Defaults to "admin".
|
||||
ADMIN_PASSWORD=
|
||||
# The demo users should not be created on a production instance
|
||||
|
||||
# Demo users should not be created on a production instance,
|
||||
# because their passwords are public. Defaults to "false".
|
||||
# Also see: https://doc.owncloud.com/ocis/latest/deployment/general/general-info.html#demo-users-and-groups
|
||||
DEMO_USERS=
|
||||
|
||||
### Wopi server settings ###
|
||||
# cs3org wopi server version. Defaults to "v8.3.3"
|
||||
WOPISERVER_DOCKER_TAG=
|
||||
# cs3org wopi server domain. Defaults to "wopiserver.owncloud.test"
|
||||
WOPISERVER_DOMAIN=
|
||||
# JWT secret which is used for the documents to be request by the Wopi client from the cs3org Wopi server. Must be change in order to have a secure Wopi server. Defaults to "LoremIpsum567"
|
||||
WOPI_JWT_SECRET=
|
||||
# Define the loglevel used.
|
||||
# For more details see:
|
||||
# https://doc.owncloud.com/ocis/latest/deployment/services/env-vars-special-scope.html
|
||||
LOG_LEVEL=
|
||||
|
||||
### 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. 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=
|
||||
# Define the oCIS storage location. Set the paths for config and data to a local path.
|
||||
# Note that especially the data directory can grow big.
|
||||
# Leaving it default stores data in docker internal volumes.
|
||||
# For more details see:
|
||||
# https://doc.owncloud.com/ocis/next/deployment/general/general-info.html#default-paths
|
||||
# OCIS_CONFIG_DIR=/your/local/ocis/config
|
||||
# OCIS_DATA_DIR=/your/local/ocis/data
|
||||
|
||||
### OnlyOffice settings ###
|
||||
# Domain of OnlyOffice, where you can find the frontend. Defaults to "onlyoffice.owncloud.test"
|
||||
ONLYOFFICE_DOMAIN=
|
||||
# Define SMPT settings if you would like to send Infinite Scale email notifications.
|
||||
# For more details see:
|
||||
# https://doc.owncloud.com/ocis/latest/deployment/services/s-list/notifications.html
|
||||
|
||||
### Email / Inbucket settings ###
|
||||
# Inbucket / Mail domain. Defaults to "mail.owncloud.test"
|
||||
INBUCKET_DOMAIN=
|
||||
# SMTP host to connect to.
|
||||
SMTP_HOST=
|
||||
|
||||
### Apache Tika Content analysis toolkit ###
|
||||
# Set the desired docker image tag or digest, defaults to "latest"
|
||||
# Port of the SMTP host to connect to.
|
||||
SMTP_PORT=
|
||||
|
||||
# An eMail address that is used for sending Infinite Scale notification eMails
|
||||
# like "ocis notifications <noreply@yourdomain.com>".
|
||||
SMTP_SENDER=
|
||||
|
||||
# Username for the SMTP host to connect to.
|
||||
SMTP_USERNAME=
|
||||
|
||||
# Password for the SMTP host to connect to.
|
||||
SMTP_PASSWORD=
|
||||
|
||||
# Authentication method for the SMTP communication.
|
||||
SMTP_AUTHENTICATION=
|
||||
|
||||
# Allow insecure connections to the SMTP server. Defaults to false.
|
||||
SMTP_INSECURE=
|
||||
|
||||
|
||||
## Default Enabled Services ##
|
||||
|
||||
### Apache Tika Content Analysis Toolkit ###
|
||||
|
||||
# Tika (search) is enabled by default, comment if not required.
|
||||
# the leading colon is required to enable the service
|
||||
TIKA=:tika.yml
|
||||
|
||||
# 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"
|
||||
### Wopi Server Settings ###
|
||||
|
||||
# Wopi Server is enabled by default, comment if not required.
|
||||
# Note that without the wopiserver, office apps will fail to start.
|
||||
# the leading colon is required to enable the service
|
||||
WOPISERVER=:wopiserver.yml
|
||||
|
||||
# cs3org WOPI Server Version.
|
||||
# Defaults to "v10.5.0"
|
||||
WOPISERVER_DOCKER_TAG=
|
||||
|
||||
# cs3org WOPI Server Domain. Defaults to "wopiserver.owncloud.test"
|
||||
WOPISERVER_DOMAIN=
|
||||
|
||||
# JWT secret which is used for the documents to be requested by the WOPI client
|
||||
# from the cs3org WOPI server. Must be changed in order to have a secure WOPI server.
|
||||
# Defaults to "LoremIpsum567"
|
||||
WOPI_JWT_SECRET=
|
||||
|
||||
|
||||
### Collabora Settings ###
|
||||
|
||||
# Collabora web office is default enabled, comment if not required.
|
||||
# the leading colon is required to enable the service
|
||||
COLLABORA=:collabora.yml
|
||||
|
||||
# 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.
|
||||
# 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=
|
||||
|
||||
|
||||
### Supplemental Configurations ###
|
||||
# If you want to use supplemental configurations,
|
||||
# you need to uncomment lines containing :path/file.yml
|
||||
# and configure the service if required.
|
||||
|
||||
|
||||
## Debugging - Monitoring ##
|
||||
# Please see documentation at: https://owncloud.dev/ocis/deployment/monitoring-tracing/
|
||||
# Only enable if you have Collabora AND OnlyOffice enabled
|
||||
#MONITORING=:monitoring_tracing/docker-compose-additions.yml
|
||||
|
||||
|
||||
## Uppy Companion Settings ##
|
||||
# the leading colon is required to enable the service
|
||||
#COMPANION=:companion.yml
|
||||
|
||||
COMPANION_IMAGE=
|
||||
|
||||
# Domain of Uppy Companion. Defaults to "companion.owncloud.test"
|
||||
COMPANION_DOMAIN=
|
||||
COMPANION_WEB_CONFIG_FILE_NAME=
|
||||
# Provider settings, see https://uppy.io/docs/companion/#provideroptions for reference. Empty by default, which disables providers.
|
||||
|
||||
# Provider settings, see https://uppy.io/docs/companion/#provideroptions for reference.
|
||||
# Empty by default, which disables providers.
|
||||
COMPANION_ONEDRIVE_KEY=
|
||||
COMPANION_ONEDRIVE_SECRET=
|
||||
|
||||
|
||||
## OnlyOffice Settings ##
|
||||
# the leading colon is required to enable the service
|
||||
#ONLYOFFICE=:onlyoffice.yml
|
||||
|
||||
# Domain for OnlyOffice. Defaults to "onlyoffice.owncloud.test"
|
||||
ONLYOFFICE_DOMAIN=
|
||||
|
||||
|
||||
## Inbucket Settings ##
|
||||
#INBUCKET=:inbucket.yml
|
||||
|
||||
# email server (in this case inbucket acts as mail catcher)
|
||||
# Domain for Inbucket. Defaults to "mail.owncloud.test"
|
||||
INBUCKET_DOMAIN=
|
||||
|
||||
# Mutually exclusive with ocis settings, only uncomment when the ocis settings are NOT set
|
||||
#SMTP_HOST=inbucket
|
||||
#SMTP_PORT=2500
|
||||
#SMTP_SENDER="oCIS notifications <notifications@${OCIS_DOMAIN:-ocis.owncloud.test}>"
|
||||
#SMTP_USERNAME="notifications@${OCIS_DOMAIN:-ocis.owncloud.test}"
|
||||
# the mail catcher uses self signed certificates
|
||||
#SMTP_INSECURE: "true"
|
||||
|
||||
|
||||
### IMPORTANT ###
|
||||
# This MUST be the last line as it assembles the supplemental compose files to be used.
|
||||
# ALL supplemental configs must be added here, whether commented or not.
|
||||
# Each var must either be empty or contain :path/file.yml
|
||||
COMPOSE_FILE=docker-compose.yml${OCIS:-}${TIKA:-}${WOPISERVER:-}${COLLABORA:-}${MONITORING:-}${COMPANION:-}${ONLYOFFICE:-}${INBUCKET:-}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
---
|
||||
document this deployment example in: docs/ocis/deployment/ocis_wopi.md
|
||||
---
|
||||
Please refer to our [admin documentation](https://doc.owncloud.com/ocis/latest/depl-examples/ubuntu-compose/ubuntu-compose-prod.html) for instructions on how to deploy this scenario.
|
||||
|
||||
Note: This deployment setup is highly configurable. At minimum, it starts `traefik`, `ocis`, `tika`, the `wopiserver` and `collabora`. Additional services can be started by removing the respective comment in the `.env` file. Depending on the service added, related variables need to be configured.
|
||||
|
||||
Please refer to [our documentation](https://owncloud.dev/ocis/deployment/ocis_wopi/)
|
||||
for instructions on how to deploy this scenario.
|
||||
@@ -0,0 +1,68 @@
|
||||
---
|
||||
services:
|
||||
traefik:
|
||||
networks:
|
||||
ocis-net:
|
||||
aliases:
|
||||
- ${COLLABORA_DOMAIN:-collabora.owncloud.test}
|
||||
|
||||
collabora:
|
||||
# collabora can currently NOT be updated to: 24.x due to a bug in collabora
|
||||
# this is the latest tested and functional collabora version
|
||||
image: collabora/code:23.05.10.1.1
|
||||
networks:
|
||||
- ocis-net
|
||||
environment:
|
||||
aliasgroup1: https://${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}:443
|
||||
DONT_GEN_SSL_CERT: "YES"
|
||||
extra_params: --o:ssl.enable=false --o:ssl.termination=true --o:welcome.enable=false --o:net.frame_ancestors=${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
username: ${COLLABORA_ADMIN_USER}
|
||||
password: ${COLLABORA_ADMIN_PASSWORD}
|
||||
cap_add:
|
||||
- MKNOD
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.collabora.entrypoints=https"
|
||||
- "traefik.http.routers.collabora.rule=Host(`${COLLABORA_DOMAIN:-collabora.owncloud.test}`)"
|
||||
- "traefik.http.routers.collabora.tls.certresolver=http"
|
||||
- "traefik.http.routers.collabora.service=collabora"
|
||||
- "traefik.http.services.collabora.loadbalancer.server.port=9980"
|
||||
logging:
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:9980/hosting/discovery"]
|
||||
|
||||
ocis-appprovider-collabora:
|
||||
image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
|
||||
networks:
|
||||
ocis-net:
|
||||
command: app-provider server
|
||||
environment:
|
||||
OCIS_LOG_LEVEL: ${OCIS_LOG_LEVEL:-info}
|
||||
# use the internal service name of the gateway
|
||||
APP_PROVIDER_GRPC_ADDR: 0.0.0.0:9164
|
||||
# configure the service name to avoid collision with other apps like onlyoffice
|
||||
APP_PROVIDER_SERVICE_NAME: app-provider-collabora
|
||||
# use the internal service name
|
||||
APP_PROVIDER_EXTERNAL_ADDR: com.owncloud.api.app-provider-collabora
|
||||
APP_PROVIDER_DRIVER: wopi
|
||||
APP_PROVIDER_WOPI_APP_NAME: Collabora
|
||||
APP_PROVIDER_WOPI_APP_ICON_URI: https://${COLLABORA_DOMAIN:-collabora.owncloud.test}/favicon.ico
|
||||
APP_PROVIDER_WOPI_APP_URL: https://${COLLABORA_DOMAIN:-collabora.owncloud.test}
|
||||
APP_PROVIDER_WOPI_INSECURE: "${INSECURE:-false}"
|
||||
APP_PROVIDER_WOPI_WOPI_SERVER_EXTERNAL_URL: https://${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}
|
||||
APP_PROVIDER_WOPI_FOLDER_URL_BASE_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
# share the registry with the ocis container
|
||||
MICRO_REGISTRY_ADDRESS: ocis:9233
|
||||
volumes:
|
||||
# configure the .env file to use own paths instead of docker internal volumes
|
||||
- ${OCIS_CONFIG_DIR:-ocis-config}:/etc/ocis
|
||||
logging:
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
depends_on:
|
||||
ocis:
|
||||
condition: service_started
|
||||
collabora:
|
||||
condition: service_healthy
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
services:
|
||||
traefik:
|
||||
networks:
|
||||
ocis-net:
|
||||
aliases:
|
||||
- ${COMPANION_DOMAIN:-companion.owncloud.test}
|
||||
|
||||
companion:
|
||||
# companion could be updated to: 4.14.0 <-- needs checking
|
||||
image: ${COMPANION_IMAGE:-transloadit/companion:4.5.1}
|
||||
networks:
|
||||
- ocis-net
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
||||
COMPANION_DATADIR: /tmp/companion/
|
||||
COMPANION_DOMAIN: ${COMPANION_DOMAIN:-companion.owncloud.test}
|
||||
COMPANION_PROTOCOL: https
|
||||
COMPANION_UPLOAD_URLS: "^https://${OCIS_DOMAIN:-ocis.owncloud.test}/"
|
||||
COMPANION_ONEDRIVE_KEY: "${COMPANION_ONEDRIVE_KEY}"
|
||||
COMPANION_ONEDRIVE_SECRET: "${COMPANION_ONEDRIVE_SECRET}"
|
||||
volumes:
|
||||
- companion-data:/tmp/companion/
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.companion.entrypoints=https"
|
||||
- "traefik.http.routers.companion.rule=Host(`${COMPANION_DOMAIN:-companion.owncloud.test}`)"
|
||||
- "traefik.http.routers.companion.tls.certresolver=http"
|
||||
- "traefik.http.routers.companion.service=companion"
|
||||
- "traefik.http.services.companion.loadbalancer.server.port=3020"
|
||||
logging:
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
companion-data:
|
||||
|
||||
-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
|
||||
@@ -1,23 +1,16 @@
|
||||
---
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
traefik:
|
||||
image: traefik:v2.9.1
|
||||
image: traefik:v3.0.3
|
||||
networks:
|
||||
ocis-net:
|
||||
aliases:
|
||||
- ${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
- ${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}
|
||||
- ${COLLABORA_DOMAIN:-collabora.owncloud.test}
|
||||
- ${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}
|
||||
- ${COMPANION_DOMAIN:-companion.owncloud.test}
|
||||
- ocis-net
|
||||
command:
|
||||
- "--log.level=${TRAEFIK_LOG_LEVEL:-ERROR}"
|
||||
# letsencrypt configuration
|
||||
- "--certificatesResolvers.http.acme.email=${TRAEFIK_ACME_MAIL:-example@example.org}"
|
||||
- "--certificatesResolvers.http.acme.storage=/certs/acme.json"
|
||||
- "--certificatesResolvers.http.acme.httpChallenge.entryPoint=http"
|
||||
- "--certificatesresolvers.http.acme.caserver=${TRAEFIK_ACME_CASERVER:-https://acme-v02.api.letsencrypt.org/directory}"
|
||||
# enable dashboard
|
||||
- "--api.dashboard=true"
|
||||
# define entrypoints
|
||||
@@ -36,272 +29,24 @@ 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}"
|
||||
- "traefik.http.middlewares.traefik-auth.basicauth.users=${TRAEFIK_BASIC_AUTH_USERS:-admin:$$apr1$$4vqie50r$$YQAmQdtmz5n9rEALhxJ4l.}" # defaults to admin:admin
|
||||
# basic authentication for the traefik dashboard, defaults to admin:admin
|
||||
- "traefik.http.middlewares.traefik-auth.basicauth.users=${TRAEFIK_BASIC_AUTH_USERS:-admin:$$apr1$$4vqie50r$$YQAmQdtmz5n9rEALhxJ4l.}"
|
||||
- "traefik.http.routers.traefik.entrypoints=https"
|
||||
- "traefik.http.routers.traefik.rule=Host(`${TRAEFIK_DOMAIN:-traefik.owncloud.test}`)"
|
||||
- "traefik.http.routers.traefik.middlewares=traefik-auth"
|
||||
- "traefik.http.routers.traefik.tls.certresolver=http"
|
||||
- "traefik.http.routers.traefik.service=api@internal"
|
||||
logging:
|
||||
driver: "local"
|
||||
restart: always
|
||||
|
||||
ocis:
|
||||
image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
|
||||
networks:
|
||||
ocis-net:
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
# run ocis init to initialize a configuration file with random secrets
|
||||
# it will fail on subsequent runs, because the config file already exists
|
||||
# therefore we ignore the error and then start the ocis server
|
||||
command: ["-c", "ocis init || true; ocis server"]
|
||||
environment:
|
||||
OCIS_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
OCIS_LOG_LEVEL: ${OCIS_LOG_LEVEL:-info}
|
||||
OCIS_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
|
||||
PROXY_TLS: "false" # do not use SSL between Traefik and oCIS
|
||||
GATEWAY_GRPC_ADDR: 0.0.0.0:9142 # make the REVA gateway accessible to the app drivers
|
||||
# INSECURE: needed if oCIS / Traefik is using self generated certificates
|
||||
OCIS_INSECURE: "${INSECURE:-false}"
|
||||
# basic auth (not recommended, but needed for eg. WebDav clients that do not support OpenID Connect)
|
||||
PROXY_ENABLE_BASIC_AUTH: "${PROXY_ENABLE_BASIC_AUTH:-false}"
|
||||
# admin user password
|
||||
IDM_ADMIN_PASSWORD: "${ADMIN_PASSWORD:-admin}" # this overrides the admin password from the configuration file
|
||||
# demo users
|
||||
IDM_CREATE_DEMO_USERS: "${DEMO_USERS:-false}"
|
||||
# fulltext search
|
||||
SEARCH_EXTRACTOR_TYPE: tika
|
||||
SEARCH_EXTRACTOR_TIKA_TIKA_URL: http://tika:9998
|
||||
FRONTEND_FULL_TEXT_SEARCH_ENABLED: "true"
|
||||
# email server (in this case inbucket acts as mail catcher)
|
||||
NOTIFICATIONS_SMTP_HOST: inbucket
|
||||
NOTIFICATIONS_SMTP_PORT: 2500
|
||||
NOTIFICATIONS_SMTP_SENDER: oCIS notifications <notifications@${OCIS_DOMAIN:-ocis.owncloud.test}>
|
||||
NOTIFICATIONS_SMTP_USERNAME: notifications@${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
NOTIFICATIONS_SMTP_INSECURE: "true" # the mail catcher uses self signed certificates
|
||||
# make the registry available to the app provider containers
|
||||
MICRO_REGISTRY_ADDRESS: 127.0.0.1:9233
|
||||
NATS_NATS_HOST: 0.0.0.0
|
||||
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
|
||||
- ocis-config:/etc/ocis
|
||||
- ocis-data:/var/lib/ocis
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.ocis.entrypoints=https"
|
||||
- "traefik.http.routers.ocis.rule=Host(`${OCIS_DOMAIN:-ocis.owncloud.test}`)"
|
||||
- "traefik.http.routers.ocis.tls.certresolver=http"
|
||||
- "traefik.http.routers.ocis.service=ocis"
|
||||
- "traefik.http.services.ocis.loadbalancer.server.port=9200"
|
||||
logging:
|
||||
driver: "local"
|
||||
restart: always
|
||||
|
||||
ocis-appprovider-collabora:
|
||||
image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
|
||||
networks:
|
||||
ocis-net:
|
||||
command: app-provider server
|
||||
environment:
|
||||
# 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
|
||||
# configure the service name to avoid collision with onlyoffice
|
||||
APP_PROVIDER_SERVICE_NAME: app-provider-collabora
|
||||
# use the internal service name
|
||||
APP_PROVIDER_EXTERNAL_ADDR: com.owncloud.api.app-provider-collabora
|
||||
APP_PROVIDER_DRIVER: wopi
|
||||
APP_PROVIDER_WOPI_APP_NAME: Collabora
|
||||
APP_PROVIDER_WOPI_APP_ICON_URI: https://${COLLABORA_DOMAIN:-collabora.owncloud.test}/favicon.ico
|
||||
APP_PROVIDER_WOPI_APP_URL: https://${COLLABORA_DOMAIN:-collabora.owncloud.test}
|
||||
APP_PROVIDER_WOPI_INSECURE: "${INSECURE:-false}"
|
||||
APP_PROVIDER_WOPI_WOPI_SERVER_EXTERNAL_URL: https://${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}
|
||||
APP_PROVIDER_WOPI_FOLDER_URL_BASE_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
# share the registry with the ocis container
|
||||
MICRO_REGISTRY_ADDRESS: ocis:9233
|
||||
volumes:
|
||||
- ocis-config:/etc/ocis
|
||||
logging:
|
||||
driver: "local"
|
||||
restart: always
|
||||
|
||||
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
|
||||
environment:
|
||||
# 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
|
||||
# configure the service name to avoid collision with collabora
|
||||
APP_PROVIDER_SERVICE_NAME: app-provider-onlyoffice
|
||||
# use the internal service name
|
||||
APP_PROVIDER_EXTERNAL_ADDR: com.owncloud.api.app-provider-onlyoffice
|
||||
APP_PROVIDER_DRIVER: wopi
|
||||
APP_PROVIDER_WOPI_APP_NAME: OnlyOffice
|
||||
APP_PROVIDER_WOPI_APP_ICON_URI: https://${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}/web-apps/apps/documenteditor/main/resources/img/favicon.ico
|
||||
APP_PROVIDER_WOPI_APP_URL: https://${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}
|
||||
APP_PROVIDER_WOPI_INSECURE: "${INSECURE:-false}"
|
||||
APP_PROVIDER_WOPI_WOPI_SERVER_EXTERNAL_URL: https://${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}
|
||||
APP_PROVIDER_WOPI_FOLDER_URL_BASE_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
# 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"
|
||||
restart: always
|
||||
|
||||
wopiserver:
|
||||
image: cs3org/wopiserver:${WOPISERVER_DOCKER_TAG:-v10.3.0}
|
||||
networks:
|
||||
ocis-net:
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
- /entrypoint-override.sh
|
||||
environment:
|
||||
WOPISERVER_INSECURE: "${INSECURE:-false}"
|
||||
WOPISECRET: ${WOPI_JWT_SECRET:-LoremIpsum567}
|
||||
WOPISERVER_DOMAIN: ${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}
|
||||
volumes:
|
||||
- ./config/wopiserver/entrypoint-override.sh:/entrypoint-override.sh
|
||||
- ./config/wopiserver/wopiserver.conf.dist:/etc/wopi/wopiserver.conf.dist
|
||||
- wopi-recovery:/var/spool/wopirecovery
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.wopiserver.entrypoints=https"
|
||||
- "traefik.http.routers.wopiserver.rule=Host(`${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}`)"
|
||||
- "traefik.http.routers.wopiserver.tls.certresolver=http"
|
||||
- "traefik.http.routers.wopiserver.service=wopiserver"
|
||||
- "traefik.http.services.wopiserver.loadbalancer.server.port=8880"
|
||||
logging:
|
||||
driver: "local"
|
||||
restart: always
|
||||
|
||||
collabora:
|
||||
image: collabora/code:23.05.5.2.1
|
||||
networks:
|
||||
ocis-net:
|
||||
environment:
|
||||
aliasgroup1: https://${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}:443
|
||||
DONT_GEN_SSL_CERT: "YES"
|
||||
extra_params: --o:ssl.enable=false --o:ssl.termination=true --o:welcome.enable=false --o:net.frame_ancestors=${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
username: ${COLLABORA_ADMIN_USER}
|
||||
password: ${COLLABORA_ADMIN_PASSWORD}
|
||||
cap_add:
|
||||
- MKNOD
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.collabora.entrypoints=https"
|
||||
- "traefik.http.routers.collabora.rule=Host(`${COLLABORA_DOMAIN:-collabora.owncloud.test}`)"
|
||||
- "traefik.http.routers.collabora.tls.certresolver=http"
|
||||
- "traefik.http.routers.collabora.service=collabora"
|
||||
- "traefik.http.services.collabora.loadbalancer.server.port=9980"
|
||||
logging:
|
||||
driver: "local"
|
||||
restart: always
|
||||
|
||||
onlyoffice:
|
||||
image: onlyoffice/documentserver:7.5.0
|
||||
networks:
|
||||
ocis-net:
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
- /entrypoint-override.sh
|
||||
environment:
|
||||
WOPI_ENABLED: "true"
|
||||
USE_UNAUTHORIZED_STORAGE: "${INSECURE:-false}" # self signed certificates
|
||||
volumes:
|
||||
- ./config/onlyoffice/entrypoint-override.sh:/entrypoint-override.sh
|
||||
- ./config/onlyoffice/local.json:/etc/onlyoffice/documentserver/local.dist.json
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.onlyoffice.entrypoints=https"
|
||||
- "traefik.http.routers.onlyoffice.rule=Host(`${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}`)"
|
||||
- "traefik.http.routers.onlyoffice.tls.certresolver=http"
|
||||
- "traefik.http.routers.onlyoffice.service=onlyoffice"
|
||||
- "traefik.http.services.onlyoffice.loadbalancer.server.port=80"
|
||||
# websockets can't be opened when this is ommitted
|
||||
- "traefik.http.middlewares.onlyoffice.headers.customrequestheaders.X-Forwarded-Proto=https"
|
||||
- "traefik.http.routers.onlyoffice.middlewares=onlyoffice"
|
||||
logging:
|
||||
driver: "local"
|
||||
restart: always
|
||||
|
||||
tika:
|
||||
image: ${TIKA_IMAGE:-apache/tika:latest-full}
|
||||
networks:
|
||||
ocis-net:
|
||||
restart: always
|
||||
|
||||
companion:
|
||||
image: ${COMPANION_IMAGE:-transloadit/companion:4.5.1}
|
||||
networks:
|
||||
ocis-net:
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
NODE_TLS_REJECT_UNAUTHORIZED: 0
|
||||
COMPANION_DATADIR: /tmp/companion/
|
||||
COMPANION_DOMAIN: ${COMPANION_DOMAIN:-companion.owncloud.test}
|
||||
COMPANION_PROTOCOL: https
|
||||
COMPANION_UPLOAD_URLS: "^https://${OCIS_DOMAIN:-ocis.owncloud.test}/"
|
||||
COMPANION_ONEDRIVE_KEY: "${COMPANION_ONEDRIVE_KEY}"
|
||||
COMPANION_ONEDRIVE_SECRET: "${COMPANION_ONEDRIVE_SECRET}"
|
||||
volumes:
|
||||
- companion-data:/tmp/companion/
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.companion.entrypoints=https"
|
||||
- "traefik.http.routers.companion.rule=Host(`${COMPANION_DOMAIN:-companion.owncloud.test}`)"
|
||||
- "traefik.http.routers.companion.tls.certresolver=http"
|
||||
- "traefik.http.routers.companion.service=companion"
|
||||
- "traefik.http.services.companion.loadbalancer.server.port=3020"
|
||||
logging:
|
||||
driver: "local"
|
||||
restart: always
|
||||
|
||||
inbucket:
|
||||
image: inbucket/inbucket
|
||||
networks:
|
||||
ocis-net:
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
command: [ "-c", "apk add openssl; openssl req -subj '/CN=inbucket.test' -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout /tmp/server.key -out /tmp/server.crt; /start-inbucket.sh" ]
|
||||
environment:
|
||||
INBUCKET_SMTP_TLSENABLED: "true"
|
||||
INBUCKET_SMTP_TLSPRIVKEY: /tmp/server.key
|
||||
INBUCKET_SMTP_TLSCERT: /tmp/server.crt
|
||||
INBUCKET_STORAGE_MAILBOXMSGCAP: 1000
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.inbucket.entrypoints=https"
|
||||
- "traefik.http.routers.inbucket.rule=Host(`${INBUCKET_DOMAIN:-mail.owncloud.test}`)"
|
||||
- "traefik.http.routers.inbucket.tls.certresolver=http"
|
||||
- "traefik.http.routers.inbucket.service=inbucket"
|
||||
- "traefik.http.services.inbucket.loadbalancer.server.port=9000"
|
||||
logging:
|
||||
driver: "local"
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
certs:
|
||||
ocis-config:
|
||||
ocis-data:
|
||||
wopi-recovery:
|
||||
companion-data:
|
||||
|
||||
networks:
|
||||
ocis-net:
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
services:
|
||||
ocis:
|
||||
environment:
|
||||
NOTIFICATIONS_SMTP_HOST: inbucket
|
||||
NOTIFICATIONS_SMTP_PORT: 2500
|
||||
NOTIFICATIONS_SMTP_SENDER: oCIS notifications <notifications@${OCIS_DOMAIN:-ocis.owncloud.test}>
|
||||
NOTIFICATIONS_SMTP_USERNAME: notifications@${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
NOTIFICATIONS_SMTP_INSECURE: "true" # the mail catcher uses self signed certificates
|
||||
|
||||
inbucket:
|
||||
image: inbucket/inbucket
|
||||
networks:
|
||||
- ocis-net
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
command: [ "-c", "apk add openssl; openssl req -subj '/CN=inbucket.test' -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout /tmp/server.key -out /tmp/server.crt; /start-inbucket.sh" ]
|
||||
environment:
|
||||
INBUCKET_SMTP_TLSENABLED: "true"
|
||||
INBUCKET_SMTP_TLSPRIVKEY: /tmp/server.key
|
||||
INBUCKET_SMTP_TLSCERT: /tmp/server.crt
|
||||
INBUCKET_STORAGE_MAILBOXMSGCAP: 1000
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.inbucket.entrypoints=https"
|
||||
- "traefik.http.routers.inbucket.rule=Host(`${INBUCKET_DOMAIN:-mail.owncloud.test}`)"
|
||||
- "traefik.http.routers.inbucket.tls.certresolver=http"
|
||||
- "traefik.http.routers.inbucket.service=inbucket"
|
||||
- "traefik.http.services.inbucket.loadbalancer.server.port=9000"
|
||||
logging:
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
-11
@@ -1,6 +1,4 @@
|
||||
---
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
ocis:
|
||||
environment:
|
||||
@@ -22,15 +20,6 @@ services:
|
||||
# metrics
|
||||
APP_PROVIDER_DEBUG_ADDR: 0.0.0.0:9165
|
||||
|
||||
ocis-appprovider-onlyoffice:
|
||||
environment:
|
||||
# tracing
|
||||
OCIS_TRACING_ENABLED: "true"
|
||||
OCIS_TRACING_TYPE: "jaeger"
|
||||
OCIS_TRACING_ENDPOINT: jaeger-agent:6831
|
||||
# metrics
|
||||
APP_PROVIDER_DEBUG_ADDR: 0.0.0.0:9165
|
||||
|
||||
networks:
|
||||
ocis-net:
|
||||
external: true
|
||||
@@ -0,0 +1,67 @@
|
||||
---
|
||||
services:
|
||||
traefik:
|
||||
networks:
|
||||
ocis-net:
|
||||
aliases:
|
||||
- ${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
|
||||
ocis:
|
||||
image: ${OCIS_DOCKER_IMAGE:-owncloud/ocis}:${OCIS_DOCKER_TAG:-latest}
|
||||
networks:
|
||||
- ocis-net
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
# run ocis init to initialize a configuration file with random secrets
|
||||
# it will fail on subsequent runs, because the config file already exists
|
||||
# therefore we ignore the error and then start the ocis server
|
||||
command: ["-c", "ocis init || true; ocis server"]
|
||||
environment:
|
||||
OCIS_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
OCIS_LOG_LEVEL: ${LOG_LEVEL:-info}
|
||||
# do not use SSL between Traefik and oCIS
|
||||
PROXY_TLS: "false"
|
||||
# make the REVA gateway accessible to the app drivers
|
||||
GATEWAY_GRPC_ADDR: 0.0.0.0:9142
|
||||
# INSECURE: needed if oCIS / Traefik is using self generated certificates
|
||||
OCIS_INSECURE: "${INSECURE:-false}"
|
||||
# admin user password
|
||||
# use the admin password from the configuration file if defined
|
||||
IDM_ADMIN_PASSWORD: "${ADMIN_PASSWORD:-admin}"
|
||||
# demo users
|
||||
IDM_CREATE_DEMO_USERS: "${DEMO_USERS:-false}"
|
||||
# email server (if configured)
|
||||
NOTIFICATIONS_SMTP_HOST: "${SMTP_HOST}"
|
||||
NOTIFICATIONS_SMTP_PORT: "${SMTP_PORT}"
|
||||
NOTIFICATIONS_SMTP_SENDER: "${SMTP_SENDER}"
|
||||
NOTIFICATIONS_SMTP_USERNAME: "${SMTP_USERNAME}"
|
||||
NOTIFICATIONS_SMTP_INSECURE: "${SMTP_INSECURE}"
|
||||
# other required configurations
|
||||
MICRO_REGISTRY_ADDRESS: 127.0.0.1:9233
|
||||
NATS_NATS_HOST: 0.0.0.0
|
||||
NATS_NATS_PORT: 9233
|
||||
# enable to allow using the banned passwords list
|
||||
#OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST: banned-password-list.txt
|
||||
volumes:
|
||||
# configure the .env file to use own paths instead of docker internal volumes
|
||||
- ${OCIS_CONFIG_DIR:-ocis-config}:/etc/ocis
|
||||
- ${OCIS_DATA_DIR:-ocis-data}:/var/lib/ocis
|
||||
# paths are relative to the main compose file
|
||||
- ./config/ocis/app-registry.yaml:/etc/ocis/app-registry.yaml
|
||||
- ./config/ocis/web.yaml:/etc/ocis/web.yaml
|
||||
- ./config/ocis/banned-password-list.txt:/etc/ocis/banned-password-list.txt
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.ocis.entrypoints=https"
|
||||
- "traefik.http.routers.ocis.rule=Host(`${OCIS_DOMAIN:-ocis.owncloud.test}`)"
|
||||
- "traefik.http.routers.ocis.tls.certresolver=http"
|
||||
- "traefik.http.routers.ocis.service=ocis"
|
||||
- "traefik.http.services.ocis.loadbalancer.server.port=9200"
|
||||
logging:
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
ocis-config:
|
||||
ocis-data:
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
---
|
||||
services:
|
||||
traefik:
|
||||
networks:
|
||||
ocis-net:
|
||||
aliases:
|
||||
- ${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}
|
||||
|
||||
onlyoffice:
|
||||
# onlyoffice could be updated to: 8.0.1 <-- needs checking
|
||||
# the image used is the community edition, the EE has not been tested.
|
||||
image: onlyoffice/documentserver:7.5.0
|
||||
networks:
|
||||
ocis-net:
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
- /entrypoint-override.sh
|
||||
environment:
|
||||
WOPI_ENABLED: "true"
|
||||
# self-signed certificates
|
||||
USE_UNAUTHORIZED_STORAGE: "${INSECURE:-false}"
|
||||
volumes:
|
||||
# paths are relative to the main compose file
|
||||
- ./config/onlyoffice/entrypoint-override.sh:/entrypoint-override.sh
|
||||
- ./config/onlyoffice/local.json:/etc/onlyoffice/documentserver/local.dist.json
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.onlyoffice.entrypoints=https"
|
||||
- "traefik.http.routers.onlyoffice.rule=Host(`${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}`)"
|
||||
- "traefik.http.routers.onlyoffice.tls.certresolver=http"
|
||||
- "traefik.http.routers.onlyoffice.service=onlyoffice"
|
||||
- "traefik.http.services.onlyoffice.loadbalancer.server.port=80"
|
||||
# websockets can't be opened when this is omitted
|
||||
- "traefik.http.middlewares.onlyoffice.headers.customrequestheaders.X-Forwarded-Proto=https"
|
||||
- "traefik.http.routers.onlyoffice.middlewares=onlyoffice"
|
||||
logging:
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost/hosting/discovery"]
|
||||
|
||||
ocis-appprovider-onlyoffice:
|
||||
image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
|
||||
networks:
|
||||
ocis-net:
|
||||
command: app-provider server
|
||||
environment:
|
||||
OCIS_LOG_LEVEL: ${OCIS_LOG_LEVEL:-info}
|
||||
# use the internal service name of the gateway
|
||||
APP_PROVIDER_GRPC_ADDR: 0.0.0.0:9164
|
||||
# configure the service name to avoid collision with other apps like collabora
|
||||
APP_PROVIDER_SERVICE_NAME: app-provider-onlyoffice
|
||||
# use the internal service name
|
||||
APP_PROVIDER_EXTERNAL_ADDR: com.owncloud.api.app-provider-onlyoffice
|
||||
APP_PROVIDER_DRIVER: wopi
|
||||
APP_PROVIDER_WOPI_APP_NAME: OnlyOffice
|
||||
APP_PROVIDER_WOPI_APP_ICON_URI: https://${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}/web-apps/apps/documenteditor/main/resources/img/favicon.ico
|
||||
APP_PROVIDER_WOPI_APP_URL: https://${ONLYOFFICE_DOMAIN:-onlyoffice.owncloud.test}
|
||||
APP_PROVIDER_WOPI_INSECURE: "${INSECURE:-false}"
|
||||
APP_PROVIDER_WOPI_WOPI_SERVER_EXTERNAL_URL: https://${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}
|
||||
APP_PROVIDER_WOPI_FOLDER_URL_BASE_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
|
||||
# share the registry with the ocis container
|
||||
MICRO_REGISTRY_ADDRESS: ocis:9233
|
||||
volumes:
|
||||
# configure the .env file to use own paths instead of docker internal volumes
|
||||
- ${OCIS_CONFIG_DIR:-ocis-config}:/etc/ocis
|
||||
logging:
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
depends_on:
|
||||
ocis:
|
||||
condition: service_started
|
||||
onlyoffice:
|
||||
condition: service_healthy
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
services:
|
||||
tika:
|
||||
image: ${TIKA_IMAGE:-apache/tika:latest-full}
|
||||
networks:
|
||||
ocis-net:
|
||||
restart: always
|
||||
|
||||
ocis:
|
||||
environment:
|
||||
# fulltext search
|
||||
SEARCH_EXTRACTOR_TYPE: tika
|
||||
SEARCH_EXTRACTOR_TIKA_TIKA_URL: http://tika:9998
|
||||
FRONTEND_FULL_TEXT_SEARCH_ENABLED: "true"
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
services:
|
||||
traefik:
|
||||
networks:
|
||||
ocis-net:
|
||||
aliases:
|
||||
- ${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}
|
||||
|
||||
wopiserver:
|
||||
image: cs3org/wopiserver:${WOPISERVER_DOCKER_TAG:-v10.5.0}
|
||||
networks:
|
||||
- ocis-net
|
||||
entrypoint:
|
||||
- /bin/sh
|
||||
- /entrypoint-override.sh
|
||||
environment:
|
||||
WOPISERVER_INSECURE: "${INSECURE:-false}"
|
||||
WOPISECRET: ${WOPI_JWT_SECRET:-LoremIpsum567}
|
||||
WOPISERVER_DOMAIN: ${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}
|
||||
volumes:
|
||||
# paths are relative to the main compose file
|
||||
- ./config/wopiserver/entrypoint-override.sh:/entrypoint-override.sh
|
||||
- ./config/wopiserver/wopiserver.conf.dist:/etc/wopi/wopiserver.conf.dist
|
||||
- wopi-recovery:/var/spool/wopirecovery
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.wopiserver.entrypoints=https"
|
||||
- "traefik.http.routers.wopiserver.rule=Host(`${WOPISERVER_DOMAIN:-wopiserver.owncloud.test}`)"
|
||||
- "traefik.http.routers.wopiserver.tls.certresolver=http"
|
||||
#- "traefik.http.routers.wopiserver.service=wopiserver"
|
||||
- "traefik.http.services.wopiserver.loadbalancer.server.port=8880"
|
||||
logging:
|
||||
driver: ${LOG_DRIVER:-local}
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
wopi-recovery:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
variables:
|
||||
- rawname: CS3_GATEWAY
|
||||
path: services/idp/pkg/backends/cs3/bootstrap/cs3.go:76
|
||||
path: services/idp/pkg/backends/cs3/bootstrap/cs3.go:77
|
||||
foundincode: true
|
||||
name: CS3_GATEWAY
|
||||
type: ""
|
||||
@@ -8,7 +8,7 @@ variables:
|
||||
description: ""
|
||||
do_ignore: true
|
||||
- rawname: CS3_MACHINE_AUTH_API_KEY
|
||||
path: services/idp/pkg/backends/cs3/bootstrap/cs3.go:77
|
||||
path: services/idp/pkg/backends/cs3/bootstrap/cs3.go:78
|
||||
foundincode: true
|
||||
name: CS3_MACHINE_AUTH_API_KEY
|
||||
type: ""
|
||||
@@ -44,7 +44,7 @@ variables:
|
||||
on supervision of ownCloud Support.'
|
||||
do_ignore: false
|
||||
- rawname: _registryAddressEnv
|
||||
path: ocis-pkg/natsjsregistry/registry.go:145
|
||||
path: ocis-pkg/natsjsregistry/registry.go:165
|
||||
foundincode: true
|
||||
name: MICRO_REGISTRY_ADDRESS
|
||||
type: string
|
||||
@@ -61,7 +61,7 @@ variables:
|
||||
description: ""
|
||||
do_ignore: true
|
||||
- rawname: _registryPasswordEnv
|
||||
path: ocis-pkg/natsjsregistry/registry.go:163
|
||||
path: ocis-pkg/natsjsregistry/registry.go:193
|
||||
foundincode: true
|
||||
name: MICRO_REGISTRY_AUTH_PASSWORD
|
||||
type: string
|
||||
@@ -69,7 +69,7 @@ variables:
|
||||
description: Optional when using nats to authenticate with the nats cluster.
|
||||
do_ignore: false
|
||||
- rawname: _registryUsernameEnv
|
||||
path: ocis-pkg/natsjsregistry/registry.go:163
|
||||
path: ocis-pkg/natsjsregistry/registry.go:193
|
||||
foundincode: true
|
||||
name: MICRO_REGISTRY_AUTH_USERNAME
|
||||
type: string
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -362,6 +362,7 @@ PROXY_ENABLE_BASIC_AUTH=true \
|
||||
NOTIFICATIONS_SMTP_HOST=localhost \
|
||||
NOTIFICATIONS_SMTP_PORT=2500 \
|
||||
NOTIFICATIONS_SMTP_INSECURE=true \
|
||||
NOTIFICATIONS_SMTP_SENDER="owncloud <noreply@example.com>" \
|
||||
ocis/bin/ocis server
|
||||
```
|
||||
|
||||
|
||||
Vendored
+4
@@ -1,4 +1,6 @@
|
||||
// set the attribute to true or leave empty, true without any quotes.
|
||||
// if the generated adoc file is used outside tabs, it renders correctly depending on the attribute set.
|
||||
// if inside, you need to also use the xxx_deprecation.adoc file. attributes can't be defined inside tabs.
|
||||
|
||||
:show-deprecation: {{ .HasDeprecations }}
|
||||
|
||||
@@ -23,6 +25,8 @@ ifeval::[{show-deprecation} == true]
|
||||
{{- end }}
|
||||
|===
|
||||
|
||||
{empty} +
|
||||
|
||||
endif::[]
|
||||
|
||||
[caption=]
|
||||
|
||||
@@ -13,7 +13,7 @@ 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.6
|
||||
github.com/cs3org/reva/v2 v2.19.7
|
||||
github.com/dhowden/tag v0.0.0-20230630033851-978a0926ee25
|
||||
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e
|
||||
github.com/egirna/icap-client v0.1.1
|
||||
@@ -81,6 +81,7 @@ require (
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/spf13/cobra v1.8.0
|
||||
github.com/stretchr/testify v1.8.4
|
||||
github.com/test-go/testify v1.1.4
|
||||
github.com/thejerf/suture/v4 v4.0.2
|
||||
github.com/tidwall/gjson v1.17.1
|
||||
github.com/tus/tusd v1.13.0
|
||||
@@ -95,13 +96,13 @@ require (
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0
|
||||
go.opentelemetry.io/otel/sdk v1.24.0
|
||||
go.opentelemetry.io/otel/trace v1.24.0
|
||||
golang.org/x/crypto v0.21.0
|
||||
golang.org/x/image v0.15.0
|
||||
golang.org/x/net v0.23.0
|
||||
golang.org/x/crypto v0.23.0
|
||||
golang.org/x/image v0.18.0
|
||||
golang.org/x/net v0.25.0
|
||||
golang.org/x/oauth2 v0.17.0
|
||||
golang.org/x/sync v0.6.0
|
||||
golang.org/x/term v0.18.0
|
||||
golang.org/x/text v0.14.0
|
||||
golang.org/x/sync v0.7.0
|
||||
golang.org/x/term v0.20.0
|
||||
golang.org/x/text v0.16.0
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe
|
||||
google.golang.org/grpc v1.62.0
|
||||
google.golang.org/protobuf v1.33.0
|
||||
@@ -334,10 +335,10 @@ require (
|
||||
go.uber.org/multierr v1.8.0 // indirect
|
||||
go.uber.org/zap v1.23.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240205201215-2c58cdc269a3 // indirect
|
||||
golang.org/x/mod v0.14.0 // indirect
|
||||
golang.org/x/sys v0.18.0 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/sys v0.20.0 // indirect
|
||||
golang.org/x/time v0.5.0 // indirect
|
||||
golang.org/x/tools v0.17.0 // indirect
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
||||
google.golang.org/appengine v1.6.8 // indirect
|
||||
google.golang.org/genproto v0.0.0-20240205150955-31a09d347014 // indirect
|
||||
|
||||
@@ -1019,8 +1019,8 @@ 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.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=
|
||||
@@ -2167,8 +2167,8 @@ golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIi
|
||||
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
|
||||
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
|
||||
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
||||
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
|
||||
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
|
||||
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
@@ -2199,8 +2199,8 @@ golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9/go.mod h1:023OzeP/+EPmXeap
|
||||
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
|
||||
golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
|
||||
golang.org/x/image v0.0.0-20220302094943-723b81ca9867/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
|
||||
golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8=
|
||||
golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE=
|
||||
golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ=
|
||||
golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
@@ -2231,8 +2231,8 @@ golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
|
||||
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
|
||||
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@@ -2312,8 +2312,8 @@ golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
|
||||
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
|
||||
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
|
||||
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
|
||||
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
@@ -2366,8 +2366,8 @@ golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20180622082034-63fc586f45fe/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@@ -2494,8 +2494,8 @@ golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
|
||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
@@ -2512,8 +2512,8 @@ golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
|
||||
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
|
||||
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
|
||||
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
|
||||
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
|
||||
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
|
||||
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
|
||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@@ -2534,8 +2534,8 @@ golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
|
||||
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
@@ -2622,8 +2622,8 @@ golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
|
||||
golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
|
||||
golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc=
|
||||
golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps=
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
)
|
||||
|
||||
// Throttle limits the number of concurrent requests.
|
||||
func Throttle(limit int) func(http.Handler) http.Handler {
|
||||
if limit > 0 {
|
||||
return middleware.Throttle(limit)
|
||||
}
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -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.3+dev"
|
||||
LatestTag = "5.0.7+dev"
|
||||
|
||||
// Date indicates the build date.
|
||||
// This has been removed, it looks like you can only replace static strings with recent go versions
|
||||
|
||||
+37
-1
@@ -23,4 +23,40 @@ To authenticate the connection to the etcd registry, you have to set `ETCD_USERN
|
||||
|
||||
## Memory limits
|
||||
|
||||
oCIS will automatically set the go native `GOMEMLIMIT` to `0.9`. To disable the limit set `AUTOMEMEMLIMIT=off`. For more information take a look at the official [Guide to the Go Garbage Collector](https://go.dev/doc/gc-guide).
|
||||
oCIS will automatically set the go native `GOMEMLIMIT` to `0.9`. To disable the limit set `AUTOMEMEMLIMIT=off`. For more information take a look at the official [Guide to the Go Garbage Collector](https://go.dev/doc/gc-guide).
|
||||
|
||||
## CLI Commands
|
||||
|
||||
The ocis package offers a variety of cli commands to monitor or repair ocis installations. All these commands have a common mandatory parameter: `--basePath` (or `-p`) which needs to point to a storage provider. Example paths are:
|
||||
|
||||
```bash
|
||||
.ocis/storage/users # bare metal installation
|
||||
/var/tmp/ocis/storage/users # docker installation
|
||||
...
|
||||
```
|
||||
|
||||
These paths can vary depending on your ocis installation.
|
||||
|
||||
### Revisions CLI
|
||||
|
||||
The revisions command allows removing the revisions of files in the storage.
|
||||
|
||||
```bash
|
||||
ocis revisions purge -p /base/path/storage/users
|
||||
```
|
||||
|
||||
It takes the `--resource-id` (or `--r`) parameter which specify the scope of the command:
|
||||
|
||||
* An empty string (default) removes all revisions from all spaces.
|
||||
* A spaceID (like `d419032c-65b9-4f4e-b1e4-0c69a946181d\$44b5a63b-540c-4002-a674-0e9c833bbe49`) removes all revisions in that space.
|
||||
* A resourceID (e.g. `d419032c-65b9-4f4e-b1e4-0c69a946181d\$44b5a63b-540c-4002-a674-0e9c833bbe49\!e8a73d49-2e00-4322-9f34-9d7f178577b2`) removes all revisions from that specific file.
|
||||
|
||||
This command provides additional options:
|
||||
|
||||
* `--dry-run` (default: `true`)\
|
||||
Do not remove any revisions but print the revisions that would be removed.
|
||||
* `-b` / `--blobstore`\
|
||||
Allows specifying the blobstore to use. Defaults to `ocis`. Can be switched to `s3ng` but needs addtional envvar configuration (see the `storage-users` service for more details).
|
||||
* `-v` / `--verbose`\
|
||||
Prints additional information about the revisions that are removed.
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
image: owncloud/ocis:latest
|
||||
manifests:
|
||||
- image: owncloud/ocis:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: linux
|
||||
- image: owncloud/ocis:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
|
||||
platform:
|
||||
architecture: arm64
|
||||
variant: v8
|
||||
os: linux
|
||||
@@ -0,0 +1,152 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
ocisbs "github.com/cs3org/reva/v2/pkg/storage/fs/ocis/blobstore"
|
||||
"github.com/cs3org/reva/v2/pkg/storage/fs/posix/lookup"
|
||||
s3bs "github.com/cs3org/reva/v2/pkg/storage/fs/s3ng/blobstore"
|
||||
"github.com/cs3org/reva/v2/pkg/storagespace"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/config/configlog"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/config/parser"
|
||||
"github.com/owncloud/ocis/v2/ocis/pkg/register"
|
||||
"github.com/owncloud/ocis/v2/ocis/pkg/revisions"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
var (
|
||||
// _nodesGlobPattern is the glob pattern to find all nodes
|
||||
_nodesGlobPattern = "spaces/*/*/*/*/*/*/*/*"
|
||||
)
|
||||
|
||||
// RevisionsCommand is the entrypoint for the revisions command.
|
||||
func RevisionsCommand(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "revisions",
|
||||
Usage: "ocis revisions functionality",
|
||||
Subcommands: []*cli.Command{
|
||||
PurgeRevisionsCommand(cfg),
|
||||
},
|
||||
Before: func(c *cli.Context) error {
|
||||
return configlog.ReturnError(parser.ParseConfig(cfg, true))
|
||||
},
|
||||
Action: func(_ *cli.Context) error {
|
||||
fmt.Println("Read the docs")
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// PurgeRevisionsCommand allows removing all revisions from a storage provider.
|
||||
func PurgeRevisionsCommand(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
Name: "purge",
|
||||
Usage: "purge revisions",
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{
|
||||
Name: "basepath",
|
||||
Aliases: []string{"p"},
|
||||
Usage: "the basepath of the decomposedfs (e.g. /var/tmp/ocis/storage/metadata)",
|
||||
Required: true,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "blobstore",
|
||||
Aliases: []string{"b"},
|
||||
Usage: "the blobstore type. Can be (none, ocis, s3ng). Default ocis. Note: When using s3ng this needs same configuration as the storage-users service",
|
||||
Value: "ocis",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "dry-run",
|
||||
Usage: "do not delete anything, just print what would be deleted",
|
||||
Value: true,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "verbose",
|
||||
Aliases: []string{"v"},
|
||||
Usage: "print verbose output",
|
||||
Value: false,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "resource-id",
|
||||
Aliases: []string{"r"},
|
||||
Usage: "purge all revisions of this file/space. If not set, all revisions will be purged",
|
||||
},
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
basePath := c.String("basepath")
|
||||
if basePath == "" {
|
||||
fmt.Println("basepath is required")
|
||||
return cli.ShowCommandHelp(c, "revisions")
|
||||
}
|
||||
|
||||
var (
|
||||
bs revisions.DelBlobstore
|
||||
err error
|
||||
)
|
||||
switch c.String("blobstore") {
|
||||
case "s3ng":
|
||||
bs, err = s3bs.New(
|
||||
cfg.StorageUsers.Drivers.S3NG.Endpoint,
|
||||
cfg.StorageUsers.Drivers.S3NG.Region,
|
||||
cfg.StorageUsers.Drivers.S3NG.Bucket,
|
||||
cfg.StorageUsers.Drivers.S3NG.AccessKey,
|
||||
cfg.StorageUsers.Drivers.S3NG.SecretKey,
|
||||
s3bs.Options{},
|
||||
)
|
||||
case "ocis":
|
||||
bs, err = ocisbs.New(basePath)
|
||||
case "none":
|
||||
bs = nil
|
||||
default:
|
||||
err = errors.New("blobstore type not supported")
|
||||
}
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return err
|
||||
}
|
||||
|
||||
p, err := generatePath(basePath, c.String("resource-id"))
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error parsing resourceID: %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
if err := revisions.PurgeRevisions(p, bs, c.Bool("dry-run"), c.Bool("verbose")); err != nil {
|
||||
fmt.Printf("❌ Error purging revisions: %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func generatePath(basePath string, resourceID string) (string, error) {
|
||||
if resourceID == "" {
|
||||
return filepath.Join(basePath, _nodesGlobPattern), nil
|
||||
}
|
||||
|
||||
rid, err := storagespace.ParseID(resourceID)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
sid := lookup.Pathify(rid.GetSpaceId(), 1, 2)
|
||||
if sid == "" {
|
||||
sid = "*/*"
|
||||
}
|
||||
|
||||
nid := lookup.Pathify(rid.GetOpaqueId(), 4, 2)
|
||||
if nid == "" {
|
||||
nid = "*/*/*/*/"
|
||||
}
|
||||
|
||||
return filepath.Join(basePath, "spaces", sid, "nodes", nid+"*"), nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
register.AddCommand(RevisionsCommand)
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
// Package revisions allows manipulating revisions in a storage provider.
|
||||
package revisions
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/node"
|
||||
"github.com/shamaton/msgpack/v2"
|
||||
)
|
||||
|
||||
var (
|
||||
// regex to determine if a node versioned. Examples:
|
||||
// 9113a718-8285-4b32-9042-f930f1a58ac2.REV.2024-05-22T07:32:53.89969726Z
|
||||
// 9113a718-8285-4b32-9042-f930f1a58ac2.REV.2024-05-22T07:32:53.89969726Z.mpk
|
||||
// 9113a718-8285-4b32-9042-f930f1a58ac2.REV.2024-05-22T07:32:53.89969726Z.mlock
|
||||
_versionRegex = regexp.MustCompile(`\.REV\.[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]+Z*`)
|
||||
)
|
||||
|
||||
// DelBlobstore is the interface for a blobstore that can delete blobs.
|
||||
type DelBlobstore interface {
|
||||
Delete(node *node.Node) error
|
||||
}
|
||||
|
||||
// PurgeRevisions removes all revisions from a storage provider.
|
||||
func PurgeRevisions(pattern string, bs DelBlobstore, dryRun bool, verbose bool) error {
|
||||
if verbose {
|
||||
fmt.Println("Looking for nodes in", pattern)
|
||||
}
|
||||
|
||||
nodes, err := filepath.Glob(pattern)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(nodes) == 0 {
|
||||
return errors.New("no nodes found, double check storage path")
|
||||
}
|
||||
|
||||
countFiles := 0
|
||||
countBlobs := 0
|
||||
countRevisions := 0
|
||||
for _, d := range nodes {
|
||||
if !_versionRegex.MatchString(d) {
|
||||
continue
|
||||
}
|
||||
|
||||
var blobID string
|
||||
e := filepath.Ext(d)
|
||||
switch e {
|
||||
case ".mpk":
|
||||
blobID, err = getBlobID(d)
|
||||
if err != nil {
|
||||
fmt.Printf("error getting blobID from %s: %v\n", d, err)
|
||||
continue
|
||||
}
|
||||
|
||||
countBlobs++
|
||||
case ".mlock":
|
||||
// no extra action on .mlock files
|
||||
default:
|
||||
countRevisions++
|
||||
}
|
||||
|
||||
if !dryRun {
|
||||
if blobID != "" {
|
||||
// TODO: needs spaceID for s3ng
|
||||
if err := bs.Delete(&node.Node{BlobID: blobID}); err != nil {
|
||||
fmt.Printf("error deleting blob %s: %v\n", blobID, err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if err := os.Remove(d); err != nil {
|
||||
fmt.Printf("error removing %s: %v\n", d, err)
|
||||
continue
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
countFiles++
|
||||
|
||||
if verbose {
|
||||
spaceID, nodeID := getIDsFromPath(d)
|
||||
if dryRun {
|
||||
fmt.Println("Would delete")
|
||||
fmt.Println("\tResourceID:", spaceID+"!"+nodeID)
|
||||
fmt.Println("\tSpaceID:", spaceID)
|
||||
fmt.Println("\tPath:", d)
|
||||
if blobID != "" {
|
||||
fmt.Println("\tBlob:", blobID)
|
||||
}
|
||||
} else {
|
||||
fmt.Println("Deleted")
|
||||
fmt.Println("\tResourceID:", spaceID+"!"+nodeID)
|
||||
fmt.Println("\tSpaceID:", spaceID)
|
||||
fmt.Println("\tPath:", d)
|
||||
if blobID != "" {
|
||||
fmt.Println("\tBlob:", blobID)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch {
|
||||
case countFiles == 0 && countRevisions == 0 && countBlobs == 0:
|
||||
fmt.Println("❎ No revisions found. Storage provider is clean.")
|
||||
case !dryRun:
|
||||
fmt.Printf("✅ Deleted %d revisions (%d files / %d blobs)\n", countRevisions, countFiles, countBlobs)
|
||||
default:
|
||||
fmt.Printf("👉 Would delete %d revisions (%d files / %d blobs)\n", countRevisions, countFiles, countBlobs)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func getBlobID(path string) (string, error) {
|
||||
b, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
m := map[string][]byte{}
|
||||
if err := msgpack.Unmarshal(b, &m); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if bid := m["user.ocis.blobid"]; string(bid) != "" {
|
||||
return string(bid), nil
|
||||
}
|
||||
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func getIDsFromPath(path string) (string, string) {
|
||||
rawIDs := strings.Split(path, "/nodes/")
|
||||
if len(rawIDs) != 2 {
|
||||
return "", ""
|
||||
}
|
||||
|
||||
s := strings.Split(rawIDs[0], "/spaces/")
|
||||
if len(s) != 2 {
|
||||
return "", ""
|
||||
}
|
||||
|
||||
n := strings.Split(rawIDs[1], ".REV.")
|
||||
if len(n) != 2 {
|
||||
return "", ""
|
||||
}
|
||||
|
||||
spaceID := strings.Replace(s[1], "/", "", -1)
|
||||
nodeID := strings.Replace(n[0], "/", "", -1)
|
||||
return spaceID, filepath.Base(nodeID)
|
||||
}
|
||||
@@ -191,5 +191,5 @@ type PasswordPolicy struct {
|
||||
MinUpperCaseCharacters int `yaml:"min_uppercase_characters" env:"OCIS_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS;FRONTEND_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS" desc:"Define the minimum number of lowercase letters. Defaults to 1 if not set." introductionVersion:"5.0"`
|
||||
MinDigits int `yaml:"min_digits" env:"OCIS_PASSWORD_POLICY_MIN_DIGITS;FRONTEND_PASSWORD_POLICY_MIN_DIGITS" desc:"Define the minimum number of digits. Defaults to 1 if not set." introductionVersion:"5.0"`
|
||||
MinSpecialCharacters int `yaml:"min_special_characters" env:"OCIS_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS;FRONTEND_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS" desc:"Define the minimum number of characters from the special characters list to be present. Defaults to 1 if not set." introductionVersion:"5.0"`
|
||||
BannedPasswordsList string `yaml:"banned_passwords_list" env:"OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST;FRONTEND_PASSWORD_POLICY_BANNED_PASSWORDS_LIST" desc:"Path to the 'banned passwords list' file. See the documentation for more details." introductionVersion:"5.0"`
|
||||
BannedPasswordsList string `yaml:"banned_passwords_list" env:"OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST;FRONTEND_PASSWORD_POLICY_BANNED_PASSWORDS_LIST" desc:"Path to the 'banned passwords list' file. This only impacts public link password validation. See the documentation for more details." introductionVersion:"5.0"`
|
||||
}
|
||||
@@ -89,7 +89,7 @@ type Cache struct {
|
||||
ProviderCacheNodes []string `yaml:"provider_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_PROVIDER_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
ProviderCacheDatabase string `yaml:"provider_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
ProviderCacheTTL time.Duration `yaml:"provider_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_PROVIDER_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
ProviderCacheSize int `yaml:"provider_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_PROVIDER_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
|
||||
ProviderCacheSize int `yaml:"provider_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_PROVIDER_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
|
||||
ProviderCacheDisablePersistence bool `yaml:"provider_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_PROVIDER_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the provider cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
|
||||
ProviderCacheAuthUsername string `yaml:"provider_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_PROVIDER_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
ProviderCacheAuthPassword string `yaml:"provider_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_PROVIDER_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
@@ -97,7 +97,7 @@ type Cache struct {
|
||||
CreateHomeCacheNodes []string `yaml:"create_home_cache_nodes" env:"OCIS_CACHE_STORE_NODES;GATEWAY_CREATE_HOME_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
CreateHomeCacheDatabase string `yaml:"create_home_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
CreateHomeCacheTTL time.Duration `yaml:"create_home_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_CREATE_HOME_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
CreateHomeCacheSize int `yaml:"create_home_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_CREATE_HOME_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
|
||||
CreateHomeCacheSize int `yaml:"create_home_cache_size" env:"OCIS_CACHE_SIZE;GATEWAY_CREATE_HOME_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
|
||||
CreateHomeCacheDisablePersistence bool `yaml:"create_home_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_CREATE_HOME_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the create home cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
|
||||
CreateHomeCacheAuthUsername string `yaml:"create_home_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_CREATE_HOME_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
CreateHomeCacheAuthPassword string `yaml:"create_home_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_CREATE_HOME_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
|
||||
@@ -9,7 +9,7 @@ type Cache struct {
|
||||
Database string `yaml:"database" env:"GRAPH_CACHE_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
Table string `yaml:"table" env:"GRAPH_CACHE_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
|
||||
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;GRAPH_CACHE_TTL" desc:"Time to live for cache records in the graph. Defaults to '336h' (2 weeks). See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;GRAPH_CACHE_SIZE" desc:"The maximum quantity of items in the store. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
|
||||
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;GRAPH_CACHE_SIZE" desc:"The maximum quantity of items in the store. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
|
||||
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GRAPH_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;GRAPH_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;GRAPH_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
|
||||
@@ -4,7 +4,7 @@ package channels
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
stdmail "net/mail"
|
||||
"strings"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||
@@ -31,16 +31,24 @@ type Message struct {
|
||||
|
||||
// NewMailChannel instantiates a new mail communication channel.
|
||||
func NewMailChannel(cfg config.Config, logger log.Logger) (Channel, error) {
|
||||
var err error
|
||||
var a *stdmail.Address
|
||||
a, err = stdmail.ParseAddress(cfg.Notifications.SMTP.Sender)
|
||||
if err != nil {
|
||||
logger.Err(err).Msg("parsing error, the 'smtp_sender' must be a valid single RFC 5322 address.")
|
||||
}
|
||||
return Mail{
|
||||
conf: cfg,
|
||||
logger: logger,
|
||||
conf: cfg,
|
||||
smtpAddress: a,
|
||||
logger: logger,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Mail is the communication channel for email.
|
||||
type Mail struct {
|
||||
conf config.Config
|
||||
logger log.Logger
|
||||
conf config.Config
|
||||
smtpAddress *stdmail.Address
|
||||
logger log.Logger
|
||||
}
|
||||
|
||||
func (m Mail) getMailClient() (*mail.SMTPClient, error) {
|
||||
@@ -102,8 +110,12 @@ func (m Mail) getMailClient() (*mail.SMTPClient, error) {
|
||||
|
||||
// SendMessage sends a message to all given users.
|
||||
func (m Mail) SendMessage(ctx context.Context, message *Message) error {
|
||||
if m.smtpAddress == nil {
|
||||
m.logger.Error().Str("mail", "SendMessage").Msg("failed to send a message. SMTP address is not set")
|
||||
return nil
|
||||
}
|
||||
if m.conf.Notifications.SMTP.Host == "" {
|
||||
m.logger.Info().Str("mail", "SendMessage").Msg("failed to send a message. SMTP host is not set")
|
||||
m.logger.Info().Str("mail", "SendMessage").Msg("failed to send a message. SMTP host is not set")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -113,11 +125,7 @@ func (m Mail) SendMessage(ctx context.Context, message *Message) error {
|
||||
}
|
||||
|
||||
email := mail.NewMSG()
|
||||
if message.Sender != "" {
|
||||
email.SetFrom(fmt.Sprintf("%s via %s", message.Sender, m.conf.Notifications.SMTP.Sender)).AddTo(message.Recipient...)
|
||||
} else {
|
||||
email.SetFrom(m.conf.Notifications.SMTP.Sender).AddTo(message.Recipient...)
|
||||
}
|
||||
email.SetFrom(appendSender(message.Sender, *m.smtpAddress)).AddTo(message.Recipient...)
|
||||
email.SetSubject(message.Subject)
|
||||
email.SetBody(mail.TextPlain, message.TextBody)
|
||||
if message.HTMLBody != "" {
|
||||
@@ -129,3 +137,10 @@ func (m Mail) SendMessage(ctx context.Context, message *Message) error {
|
||||
|
||||
return email.Send(smtpClient)
|
||||
}
|
||||
|
||||
func appendSender(sender string, a stdmail.Address) string {
|
||||
if strings.TrimSpace(sender) != "" {
|
||||
a.Name = strings.TrimSpace(sender + " via " + a.Name)
|
||||
}
|
||||
return a.String()
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package channels
|
||||
|
||||
import (
|
||||
"net/mail"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_appendSender(t *testing.T) {
|
||||
type args struct {
|
||||
sender string
|
||||
a mail.Address
|
||||
}
|
||||
|
||||
a1, err := mail.ParseAddress("ownCloud <noreply@example.com>")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
a2, err := mail.ParseAddress("noreply@example.com")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
sender string
|
||||
want1 string
|
||||
want2 string
|
||||
}{
|
||||
{
|
||||
name: "empty sender",
|
||||
sender: "",
|
||||
want1: `"ownCloud" <noreply@example.com>`,
|
||||
want2: `<noreply@example.com>`,
|
||||
},
|
||||
{
|
||||
name: "not empty sender",
|
||||
sender: `Joe Q. Public`,
|
||||
want1: `"Joe Q. Public via ownCloud" <noreply@example.com>`,
|
||||
want2: `"Joe Q. Public via" <noreply@example.com>`,
|
||||
},
|
||||
{
|
||||
name: "sender whit comma and semicolon",
|
||||
sender: `Joe, Q; Public:`,
|
||||
want1: `"Joe, Q; Public: via ownCloud" <noreply@example.com>`,
|
||||
want2: `"Joe, Q; Public: via" <noreply@example.com>`,
|
||||
},
|
||||
{
|
||||
name: "sender with quotes",
|
||||
sender: `Joe Q. "Public"`,
|
||||
want1: `"Joe Q. \"Public\" via ownCloud" <noreply@example.com>`,
|
||||
want2: `"Joe Q. \"Public\" via" <noreply@example.com>`,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := appendSender(tt.sender, *a1); got != tt.want1 {
|
||||
t.Errorf("appendSender() = %v, want %v", got, tt.want1)
|
||||
}
|
||||
if got := appendSender(tt.sender, *a2); got != tt.want2 {
|
||||
t.Errorf("appendSender() = %v, want %v", got, tt.want2)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package parser
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/mail"
|
||||
"strings"
|
||||
|
||||
ociscfg "github.com/owncloud/ocis/v2/ocis-pkg/config"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
|
||||
@@ -54,6 +56,14 @@ func Validate(cfg *config.Config) error {
|
||||
}
|
||||
}
|
||||
|
||||
if strings.TrimSpace(cfg.Notifications.SMTP.Sender) != "" {
|
||||
if s, err := mail.ParseAddress(cfg.Notifications.SMTP.Sender); err == nil {
|
||||
cfg.Notifications.SMTP.Sender = s.String()
|
||||
} else {
|
||||
return fmt.Errorf("the 'smtp_sender' must be a valid single RFC 5322 address. parsing error %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
if cfg.ServiceAccount.ServiceAccountID == "" {
|
||||
return shared.MissingServiceAccountID(cfg.Service.Name)
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ type Store struct {
|
||||
Database string `yaml:"database" env:"POSTPROCESSING_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
Table string `yaml:"table" env:"POSTPROCESSING_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
|
||||
TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;POSTPROCESSING_STORE_TTL" desc:"Time to live for events in the store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
Size int `yaml:"size" env:"OCIS_PERSISTENT_STORE_SIZE;POSTPROCESSING_STORE_SIZE" desc:"The maximum quantity of items in the store. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
|
||||
Size int `yaml:"size" env:"OCIS_PERSISTENT_STORE_SIZE;POSTPROCESSING_STORE_SIZE" desc:"The maximum quantity of items in the store. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;POSTPROCESSING_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;POSTPROCESSING_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
}
|
||||
@@ -241,7 +241,6 @@ func (pps *PostprocessingService) handleResumePPEvent(ctx context.Context, ev ev
|
||||
for _, id := range ids {
|
||||
if err := pps.resumePP(ctx, id); err != nil {
|
||||
pps.log.Error().Str("uploadID", id).Err(err).Msg("cannot resume upload")
|
||||
return fmt.Errorf("cannot resume upload: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -128,7 +128,7 @@ type Cache struct {
|
||||
Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
Table string `yaml:"table" env:"PROXY_OIDC_USERINFO_CACHE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
|
||||
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;PROXY_OIDC_USERINFO_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;PROXY_OIDC_USERINFO_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
|
||||
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;PROXY_OIDC_USERINFO_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
|
||||
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;PROXY_OIDC_USERINFO_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"pre5.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;PROXY_OIDC_USERINFO_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;PROXY_OIDC_USERINFO_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
|
||||
@@ -63,7 +63,7 @@ type Cache struct {
|
||||
FileTable string `yaml:"files_table" env:"SETTINGS_FILE_CACHE_TABLE" desc:"The database table the store should use for the file cache." introductionVersion:"pre5.0"`
|
||||
DirectoryTable string `yaml:"directories_table" env:"SETTINGS_DIRECTORY_CACHE_TABLE" desc:"The database table the store should use for the directory cache." introductionVersion:"pre5.0"`
|
||||
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;SETTINGS_CACHE_TTL" desc:"Default time to live for entries in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;SETTINGS_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
|
||||
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;SETTINGS_CACHE_SIZE" desc:"The maximum quantity of items in the cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
|
||||
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;SETTINGS_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;SETTINGS_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;SETTINGS_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
|
||||
@@ -167,5 +167,5 @@ type PasswordPolicy struct {
|
||||
MinUpperCaseCharacters int `yaml:"min_uppercase_characters" env:"OCIS_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS;SHARING_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS" desc:"Define the minimum number of lowercase letters. Defaults to 1 if not set." introductionVersion:"5.0"`
|
||||
MinDigits int `yaml:"min_digits" env:"OCIS_PASSWORD_POLICY_MIN_DIGITS;SHARING_PASSWORD_POLICY_MIN_DIGITS" desc:"Define the minimum number of digits. Defaults to 1 if not set." introductionVersion:"5.0"`
|
||||
MinSpecialCharacters int `yaml:"min_special_characters" env:"OCIS_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS;SHARING_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS" desc:"Define the minimum number of characters from the special characters list to be present. Defaults to 1 if not set." introductionVersion:"5.0"`
|
||||
BannedPasswordsList string `yaml:"banned_passwords_list" env:"OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST;SHARING_PASSWORD_POLICY_BANNED_PASSWORDS_LIST" desc:"Path to the 'banned passwords list' file. See the documentation for more details." introductionVersion:"5.0"`
|
||||
BannedPasswordsList string `yaml:"banned_passwords_list" env:"OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST;SHARING_PASSWORD_POLICY_BANNED_PASSWORDS_LIST" desc:"Path to the 'banned passwords list' file. This only impacts public link password validation. See the documentation for more details." introductionVersion:"5.0"`
|
||||
}
|
||||
@@ -91,7 +91,7 @@ type Cache struct {
|
||||
Nodes []string `yaml:"nodes" env:"OCIS_CACHE_STORE_NODES;STORAGE_SYSTEM_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_SYSTEM_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_SYSTEM_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
|
||||
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_SYSTEM_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
|
||||
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_SYSTEM_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
|
||||
AuthUsername string `yaml:"auth_username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_SYSTEM_CACHE_AUTH_USERNAME" desc:"Username for the configured store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_SYSTEM_CACHE_AUTH_PASSWORD" desc:"Password for the configured store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
|
||||
@@ -51,58 +51,90 @@ ocis storage-users uploads <command>
|
||||
```plaintext
|
||||
COMMANDS:
|
||||
sessions Print a list of upload sessions
|
||||
clean Clean up leftovers from expired uploads
|
||||
clean Clean up leftovers from expired uploads (deprecated)
|
||||
list Print a list of all incomplete uploads (deprecated)
|
||||
```
|
||||
|
||||
#### Sessions command
|
||||
|
||||
The `sessions` command is the entry point for listing, restarting and cleaning unfinished uploads.
|
||||
|
||||
```bash
|
||||
ocis storage-users uploads sessions <command>
|
||||
```
|
||||
|
||||
```
|
||||
NAME:
|
||||
ocis storage-users uploads sessions - Print a list of upload sessions
|
||||
|
||||
USAGE:
|
||||
ocis storage-users uploads sessions [command options]
|
||||
|
||||
OPTIONS:
|
||||
--id value filter sessions by upload session id (default: unset)
|
||||
--processing filter sessions by processing status (default: unset)
|
||||
--expired filter sessions by expired status (default: unset)
|
||||
--has-virus filter sessions by virus scan result (default: unset)
|
||||
--json output as json (default: false)
|
||||
--restart send restart event for all listed sessions (default: false)
|
||||
--clean remove uploads (default: false)
|
||||
--help, -h show help
|
||||
```
|
||||
|
||||
This will always output a list of uploads that match the criteria. See Command Examples section.
|
||||
|
||||
Some additional information on returned information:
|
||||
- `Offset` is the amount of bytes the server has already received. If `Offset` == `Size` the server has reveived all bytes of the upload.
|
||||
- `Processing` indicates if the uploaded file is currently going through postprocessing.
|
||||
- `Scan Date` and `Scan Result` indicate the scanning status. If `Scan Date` is set and `Scan Result` is empty the file is not virus infected.
|
||||
|
||||
#### Command Examples
|
||||
|
||||
Command to list ongoing upload sessions
|
||||
|
||||
```bash
|
||||
ocis storage-users sessions --expired=false
|
||||
ocis storage-users uploads sessions --expired=false --processing=false
|
||||
```
|
||||
|
||||
```plaintext
|
||||
Not expired sessions:
|
||||
+--------------------------------------+--------------------------------------+---------+--------+------+--------------------------------------+--------------------------------------+---------------------------+------------+
|
||||
| Space | Upload Id | Name | Offset | Size | Executant | Owner | Expires | Processing |
|
||||
+--------------------------------------+--------------------------------------+---------+--------+------+--------------------------------------+--------------------------------------+---------------------------+------------+
|
||||
| f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | 5e387954-7313-4223-a904-bf996da6ec0b | foo.txt | 0 | 1234 | f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | 2024-01-26T13:04:31+01:00 | false |
|
||||
| f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | f066244d-97b2-48e7-a30d-b40fcb60cec6 | bar.txt | 0 | 4321 | f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | 2024-01-26T13:18:47+01:00 | false |
|
||||
+--------------------------------------+--------------------------------------+---------+--------+------+--------------------------------------+--------------------------------------+---------------------------+------------+
|
||||
+--------------------------------------+--------------------------------------+---------+--------+------+--------------------------------------+--------------------------------------+---------------------------+------------+---------------------------+-----------------------+
|
||||
| Space | Upload Id | Name | Offset | Size | Executant | Owner | Expires | Processing | Scan Date | Scan Result |
|
||||
+--------------------------------------+--------------------------------------+---------+--------+------+--------------------------------------+--------------------------------------+---------------------------+------------+---------------------------+-----------------------+
|
||||
| f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | 5e387954-7313-4223-a904-bf996da6ec0b | foo.txt | 0 | 1234 | f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | 2024-01-26T13:04:31+01:00 | false | 2024-04-24T11:24:14+02:00 | infected: virus A |
|
||||
| f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | f066244d-97b2-48e7-a30d-b40fcb60cec6 | bar.txt | 0 | 4321 | f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c | 2024-01-26T13:18:47+01:00 | false | 2024-04-24T14:38:29+02:00 | |
|
||||
+--------------------------------------+--------------------------------------+---------+--------+------+--------------------------------------+--------------------------------------+---------------------------+------------+---------------------------+-----------------------+
|
||||
```
|
||||
|
||||
The sessions command can also output json
|
||||
|
||||
```bash
|
||||
ocis storage-users sessions --expired=false --json
|
||||
ocis storage-users uploads sessions --expired=false --processing=false --json
|
||||
```
|
||||
|
||||
```json
|
||||
{"id":"5e387954-7313-4223-a904-bf996da6ec0b","space":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c","filename":"foo.txt","offset":0,"size":1234,"executant":{"idp":"https://cloud.ocis.test","opaque_id":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"},"spaceowner":{"opaque_id":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"},"expires":"2024-01-26T13:04:31+01:00","processing":false}
|
||||
{"id":"f066244d-97b2-48e7-a30d-b40fcb60cec6","space":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c","filename":"bar.txt","offset":0,"size":4321,"executant":{"idp":"https://cloud.ocis.test","opaque_id":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"},"spaceowner":{"opaque_id":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"},"expires":"2024-01-26T13:18:47+01:00","processing":false}
|
||||
{"id":"5e387954-7313-4223-a904-bf996da6ec0b","space":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c","filename":"foo.txt","offset":0,"size":1234,"executant":{"idp":"https://cloud.ocis.test","opaque_id":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"},"spaceowner":{"opaque_id":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"},"expires":"2024-01-26T13:04:31+01:00","processing":false, "scanDate": "2024-04-24T11:24:14+02:00", "scanResult": "infected: virus A"}
|
||||
{"id":"f066244d-97b2-48e7-a30d-b40fcb60cec6","space":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c","filename":"bar.txt","offset":0,"size":4321,"executant":{"idp":"https://cloud.ocis.test","opaque_id":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"},"spaceowner":{"opaque_id":"f7fbf8c8-139b-4376-b307-cf0a8c2d0d9c"},"expires":"2024-01-26T13:18:47+01:00","processing":false, "scanDate": "2024-04-24T14:38:29+02:00", "scanResult": ""}
|
||||
```
|
||||
|
||||
Command to clear expired uploads
|
||||
The sessions command can also clear and restart uploads. The output is the same as if run without `--clean` or `--restart` flag.
|
||||
Note: It is recommended to run to command first without the `--clean` (`--processing`) flag to double check which uploads get cleaned (restarted).
|
||||
```bash
|
||||
ocis storage-users uploads clean
|
||||
# cleans all expired uploads regardless of processing and virus state.
|
||||
ocis storage-users uploads sessions --expired=true --clean
|
||||
|
||||
# restarts all uploads that are processing and are not virus infected
|
||||
ocis storage-users uploads sessions --processing=false --has-virus=false --restart
|
||||
```
|
||||
|
||||
```plaintext
|
||||
Cleaned uploads:
|
||||
- 455bd640-cd08-46e8-a5a0-9304908bd40a (Filename: file_example_PPT_1MB.ppt, Size: 1028608, Expires: 2022-08-17T12:35:34+02:00)
|
||||
```
|
||||
|
||||
Deprecated list command to identify unfinished uploads
|
||||
IMPOTANT: `list` and `clean` commands are deprecated. Do not use them.
|
||||
|
||||
```bash
|
||||
# deprecated
|
||||
ocis storage-users uploads list
|
||||
```
|
||||
|
||||
```plaintext
|
||||
Incomplete uploads:
|
||||
- 455bd640-cd08-46e8-a5a0-9304908bd40a (file_example_PPT_1MB.ppt, Size: 1028608, Expires: 2022-08-17T12:35:34+02:00)
|
||||
# deprecated
|
||||
ocis storage-users uploads clean
|
||||
```
|
||||
|
||||
### Purge Expired Space Trash-Bins Items
|
||||
|
||||
@@ -25,6 +25,22 @@ import (
|
||||
"github.com/owncloud/ocis/v2/services/storage-users/pkg/revaconfig"
|
||||
)
|
||||
|
||||
// Session contains the information of an upload session
|
||||
type Session struct {
|
||||
ID string `json:"id"`
|
||||
Space string `json:"space"`
|
||||
Filename string `json:"filename"`
|
||||
Offset int64 `json:"offset"`
|
||||
Size int64 `json:"size"`
|
||||
Executant userpb.UserId `json:"executant"`
|
||||
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"`
|
||||
}
|
||||
|
||||
// Uploads is the entry point for the uploads command
|
||||
func Uploads(cfg *config.Config) *cli.Command {
|
||||
return &cli.Command{
|
||||
|
||||
@@ -47,6 +63,8 @@ func ListUploads(cfg *config.Config) *cli.Command {
|
||||
return configlog.ReturnFatal(parser.ParseConfig(cfg))
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
fmt.Println("Warning: This command is deprecated, use 'uploads sessions' instead")
|
||||
|
||||
f, ok := registry.NewFuncs[cfg.Driver]
|
||||
if !ok {
|
||||
fmt.Fprintf(os.Stderr, "Unknown filesystem driver '%s'\n", cfg.Driver)
|
||||
@@ -101,6 +119,11 @@ func ListUploadSessions(cfg *config.Config) *cli.Command {
|
||||
DefaultText: "unset",
|
||||
Usage: "filter sessions by expired status",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "has-virus",
|
||||
DefaultText: "unset",
|
||||
Usage: "filter sessions by virus scan result",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "json",
|
||||
Usage: "output as json",
|
||||
@@ -109,6 +132,10 @@ func ListUploadSessions(cfg *config.Config) *cli.Command {
|
||||
Name: "restart",
|
||||
Usage: "send restart event for all listed sessions",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "clean",
|
||||
Usage: "remove uploads",
|
||||
},
|
||||
},
|
||||
Before: func(c *cli.Context) error {
|
||||
return configlog.ReturnFatal(parser.ParseConfig(cfg))
|
||||
@@ -141,138 +168,91 @@ func ListUploadSessions(cfg *config.Config) *cli.Command {
|
||||
}
|
||||
}
|
||||
|
||||
var b strings.Builder
|
||||
filter := storage.UploadSessionFilter{}
|
||||
if c.IsSet("processing") {
|
||||
processingValue := c.Bool("processing")
|
||||
filter.Processing = &processingValue
|
||||
if !processingValue {
|
||||
b.WriteString("Not ")
|
||||
}
|
||||
if b.Len() == 0 {
|
||||
b.WriteString("Processing ")
|
||||
} else {
|
||||
b.WriteString("processing ")
|
||||
}
|
||||
}
|
||||
if c.IsSet("expired") {
|
||||
expiredValue := c.Bool("expired")
|
||||
filter.Expired = &expiredValue
|
||||
if !expiredValue {
|
||||
if b.Len() == 0 {
|
||||
b.WriteString("Not ")
|
||||
} else {
|
||||
b.WriteString(", not ")
|
||||
}
|
||||
}
|
||||
if b.Len() == 0 {
|
||||
b.WriteString("Expired ")
|
||||
} else {
|
||||
b.WriteString("expired ")
|
||||
}
|
||||
}
|
||||
if b.Len() == 0 {
|
||||
b.WriteString("Sessions")
|
||||
} else {
|
||||
b.WriteString("sessions")
|
||||
}
|
||||
if c.IsSet("id") {
|
||||
idValue := c.String("id")
|
||||
filter.ID = &idValue
|
||||
b.WriteString(" with id '" + idValue + "'")
|
||||
}
|
||||
b.WriteString(":")
|
||||
filter := buildFilter(c)
|
||||
uploads, err := managingFS.ListUploadSessions(c.Context, filter)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var table *tw.Table
|
||||
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"`
|
||||
Filename string `json:"filename"`
|
||||
Offset int64 `json:"offset"`
|
||||
Size int64 `json:"size"`
|
||||
Executant userpb.UserId `json:"executant"`
|
||||
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(),
|
||||
Filename: u.Filename(),
|
||||
Offset: u.Offset(),
|
||||
Size: u.Size(),
|
||||
Executant: u.Executant(),
|
||||
SpaceOwner: u.SpaceOwner(),
|
||||
Expires: u.Expires(),
|
||||
Processing: u.IsProcessing(),
|
||||
ScanDate: sd,
|
||||
ScanResult: sr,
|
||||
}
|
||||
j, err := json.Marshal(s)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
fmt.Println(string(j))
|
||||
var (
|
||||
table *tw.Table
|
||||
raw []Session
|
||||
)
|
||||
|
||||
if c.Bool("restart") {
|
||||
if err := events.Publish(context.Background(), stream, events.ResumePostprocessing{
|
||||
UploadID: u.ID(),
|
||||
Timestamp: utils.TSNow(),
|
||||
}); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Failed to send restart event for upload session '%s'\n", u.ID())
|
||||
// if publishing fails there is no need to try publishing other events - they will fail too.
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if !c.Bool("json") {
|
||||
fmt.Println(buildInfo(filter))
|
||||
|
||||
// Print what the user requested
|
||||
fmt.Println(b.String())
|
||||
|
||||
// start a table
|
||||
table = tw.NewWriter(os.Stdout)
|
||||
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()
|
||||
for _, u := range uploads {
|
||||
ref := u.Reference()
|
||||
sr, sd := u.ScanData()
|
||||
|
||||
session := Session{
|
||||
Space: ref.GetResourceId().GetSpaceId(),
|
||||
ID: u.ID(),
|
||||
Filename: u.Filename(),
|
||||
Offset: u.Offset(),
|
||||
Size: u.Size(),
|
||||
Executant: u.Executant(),
|
||||
SpaceOwner: u.SpaceOwner(),
|
||||
Expires: u.Expires(),
|
||||
Processing: u.IsProcessing(),
|
||||
ScanDate: sd,
|
||||
ScanResult: sr,
|
||||
}
|
||||
|
||||
if c.Bool("json") {
|
||||
raw = append(raw, session)
|
||||
} else {
|
||||
table.Append([]string{
|
||||
u.Reference().ResourceId.GetSpaceId(),
|
||||
u.ID(),
|
||||
u.Filename(),
|
||||
strconv.FormatInt(u.Offset(), 10),
|
||||
strconv.FormatInt(u.Size(), 10),
|
||||
u.Executant().OpaqueId,
|
||||
u.SpaceOwner().GetOpaqueId(),
|
||||
u.Expires().Format(time.RFC3339),
|
||||
strconv.FormatBool(u.IsProcessing()),
|
||||
sd.Format(time.RFC3339),
|
||||
sr,
|
||||
session.Space,
|
||||
session.ID,
|
||||
session.Filename,
|
||||
strconv.FormatInt(session.Offset, 10),
|
||||
strconv.FormatInt(session.Size, 10),
|
||||
session.Executant.OpaqueId,
|
||||
session.SpaceOwner.GetOpaqueId(),
|
||||
session.Expires.Format(time.RFC3339),
|
||||
strconv.FormatBool(session.Processing),
|
||||
session.ScanDate.Format(time.RFC3339),
|
||||
session.ScanResult,
|
||||
})
|
||||
}
|
||||
|
||||
if c.Bool("restart") {
|
||||
if err := events.Publish(context.Background(), stream, events.ResumePostprocessing{
|
||||
UploadID: u.ID(),
|
||||
Timestamp: utils.TSNow(),
|
||||
}); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Failed to send restart event for upload session '%s'\n", u.ID())
|
||||
// if publishing fails there is no need to try publishing other events - they will fail too.
|
||||
os.Exit(1)
|
||||
}
|
||||
if c.Bool("restart") {
|
||||
if err := events.Publish(context.Background(), stream, events.ResumePostprocessing{
|
||||
UploadID: u.ID(),
|
||||
Timestamp: utils.TSNow(),
|
||||
}); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Failed to send restart event for upload session '%s'\n", u.ID())
|
||||
// if publishing fails there is no need to try publishing other events - they will fail too.
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
table.Render()
|
||||
|
||||
if c.Bool("clean") {
|
||||
if err := u.Purge(c.Context); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Failed to clean upload session '%s'\n", u.ID())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if !c.Bool("json") {
|
||||
table.Render()
|
||||
return nil
|
||||
}
|
||||
|
||||
j, err := json.Marshal(raw)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return err
|
||||
}
|
||||
fmt.Println(string(j))
|
||||
return nil
|
||||
},
|
||||
}
|
||||
@@ -287,6 +267,7 @@ func PurgeExpiredUploads(cfg *config.Config) *cli.Command {
|
||||
return configlog.ReturnFatal(parser.ParseConfig(cfg))
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
fmt.Println("Warning: This command is deprecated, use 'uploads sessions --clean' instead")
|
||||
f, ok := registry.NewFuncs[cfg.Driver]
|
||||
if !ok {
|
||||
fmt.Fprintf(os.Stderr, "Unknown filesystem driver '%s'\n", cfg.Driver)
|
||||
@@ -333,3 +314,90 @@ func PurgeExpiredUploads(cfg *config.Config) *cli.Command {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func buildFilter(c *cli.Context) storage.UploadSessionFilter {
|
||||
filter := storage.UploadSessionFilter{}
|
||||
if c.IsSet("processing") {
|
||||
processingValue := c.Bool("processing")
|
||||
filter.Processing = &processingValue
|
||||
}
|
||||
if c.IsSet("expired") {
|
||||
expiredValue := c.Bool("expired")
|
||||
filter.Expired = &expiredValue
|
||||
}
|
||||
if c.IsSet("has-virus") {
|
||||
infectedValue := c.Bool("has-virus")
|
||||
filter.HasVirus = &infectedValue
|
||||
}
|
||||
if c.IsSet("id") {
|
||||
idValue := c.String("id")
|
||||
filter.ID = &idValue
|
||||
}
|
||||
return filter
|
||||
}
|
||||
|
||||
func buildInfo(filter storage.UploadSessionFilter) string {
|
||||
var b strings.Builder
|
||||
if filter.Processing != nil {
|
||||
if !*filter.Processing {
|
||||
b.WriteString("Not ")
|
||||
}
|
||||
if b.Len() == 0 {
|
||||
b.WriteString("Processing")
|
||||
} else {
|
||||
b.WriteString("processing")
|
||||
}
|
||||
}
|
||||
|
||||
if filter.Expired != nil {
|
||||
if b.Len() != 0 {
|
||||
b.WriteString(", ")
|
||||
}
|
||||
if !*filter.Expired {
|
||||
if b.Len() == 0 {
|
||||
b.WriteString("Not ")
|
||||
} else {
|
||||
b.WriteString("not ")
|
||||
}
|
||||
}
|
||||
if b.Len() == 0 {
|
||||
b.WriteString("Expired")
|
||||
} else {
|
||||
b.WriteString("expired")
|
||||
}
|
||||
}
|
||||
|
||||
if filter.HasVirus != nil {
|
||||
if b.Len() != 0 {
|
||||
b.WriteString(", ")
|
||||
}
|
||||
if !*filter.HasVirus {
|
||||
if b.Len() == 0 {
|
||||
b.WriteString("Not ")
|
||||
} else {
|
||||
b.WriteString("not ")
|
||||
}
|
||||
}
|
||||
if b.Len() == 0 {
|
||||
b.WriteString("Virusinfected")
|
||||
} else {
|
||||
b.WriteString("virusinfected")
|
||||
}
|
||||
}
|
||||
|
||||
if b.Len() == 0 {
|
||||
b.WriteString("Session")
|
||||
} else {
|
||||
b.WriteString(" session")
|
||||
}
|
||||
|
||||
if filter.ID != nil {
|
||||
b.WriteString(" with id '" + *filter.ID + "'")
|
||||
} else {
|
||||
// to make `session` plural
|
||||
b.WriteString("s")
|
||||
}
|
||||
|
||||
b.WriteString(":")
|
||||
return b.String()
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/cs3org/reva/v2/pkg/storage"
|
||||
"github.com/test-go/testify/require"
|
||||
)
|
||||
|
||||
func TestBuildInfo(t *testing.T) {
|
||||
testCases := []struct {
|
||||
alias string
|
||||
filter storage.UploadSessionFilter
|
||||
expectedInfo string
|
||||
}{
|
||||
{
|
||||
alias: "empty filter",
|
||||
filter: storage.UploadSessionFilter{},
|
||||
expectedInfo: "Sessions:",
|
||||
},
|
||||
{
|
||||
alias: "processing",
|
||||
filter: storage.UploadSessionFilter{Processing: boolPtr(true)},
|
||||
expectedInfo: "Processing sessions:",
|
||||
},
|
||||
{
|
||||
alias: "processing and not expired",
|
||||
filter: storage.UploadSessionFilter{Processing: boolPtr(true), Expired: boolPtr(false)},
|
||||
expectedInfo: "Processing, not expired sessions:",
|
||||
},
|
||||
{
|
||||
alias: "processing and expired",
|
||||
filter: storage.UploadSessionFilter{Processing: boolPtr(true), Expired: boolPtr(true)},
|
||||
expectedInfo: "Processing, expired sessions:",
|
||||
},
|
||||
{
|
||||
alias: "with id",
|
||||
filter: storage.UploadSessionFilter{ID: strPtr("123")},
|
||||
expectedInfo: "Session with id '123':",
|
||||
},
|
||||
{
|
||||
alias: "processing, not expired and not virus infected",
|
||||
filter: storage.UploadSessionFilter{Processing: boolPtr(true), Expired: boolPtr(false), HasVirus: boolPtr(false)},
|
||||
expectedInfo: "Processing, not expired, not virusinfected sessions:",
|
||||
},
|
||||
{
|
||||
alias: "not virusinfected",
|
||||
filter: storage.UploadSessionFilter{HasVirus: boolPtr(false)},
|
||||
expectedInfo: "Not virusinfected sessions:",
|
||||
},
|
||||
{
|
||||
alias: "expired and virusinfected",
|
||||
filter: storage.UploadSessionFilter{Expired: boolPtr(true), HasVirus: boolPtr(true)},
|
||||
expectedInfo: "Expired, virusinfected sessions:",
|
||||
},
|
||||
{
|
||||
alias: "expired and not virus infected",
|
||||
filter: storage.UploadSessionFilter{Expired: boolPtr(true), HasVirus: boolPtr(false)},
|
||||
expectedInfo: "Expired, not virusinfected sessions:",
|
||||
},
|
||||
{
|
||||
alias: "processing, not expired, virus infected and with id (note: this makes no sense)",
|
||||
filter: storage.UploadSessionFilter{Processing: boolPtr(true), Expired: boolPtr(false), HasVirus: boolPtr(true), ID: strPtr("123")},
|
||||
expectedInfo: "Processing, not expired, virusinfected session with id '123':",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
alias := tc.alias
|
||||
filter := tc.filter
|
||||
expectedInfo := tc.expectedInfo
|
||||
|
||||
t.Run(alias, func(t *testing.T) {
|
||||
require.Equal(t, expectedInfo, buildInfo(filter))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func boolPtr(b bool) *bool {
|
||||
return &b
|
||||
}
|
||||
|
||||
func strPtr(s string) *string {
|
||||
return &s
|
||||
}
|
||||
@@ -204,7 +204,7 @@ type FilemetadataCache struct {
|
||||
Nodes []string `yaml:"nodes" env:"OCIS_CACHE_STORE_NODES;STORAGE_USERS_FILEMETADATA_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_USERS_FILEMETADATA_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_USERS_FILEMETADATA_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
|
||||
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_USERS_FILEMETADATA_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
|
||||
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_USERS_FILEMETADATA_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_USERS_FILEMETADATA_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_USERS_FILEMETADATA_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
@@ -216,7 +216,7 @@ type IDCache struct {
|
||||
Nodes []string `yaml:"nodes" env:"OCIS_CACHE_STORE_NODES;STORAGE_USERS_ID_CACHE_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' or 'ocmem' stores are configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_USERS_ID_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens have no expiration. Defaults to 300s which is derived from the underlaying package though not explicitly set as default. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_USERS_ID_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
|
||||
Size int `yaml:"size" env:"OCIS_CACHE_SIZE;STORAGE_USERS_ID_CACHE_SIZE" desc:"The maximum quantity of items in the user info cache. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
|
||||
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_USERS_ID_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_USERS_ID_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_USERS_ID_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
|
||||
@@ -41,19 +41,19 @@ Thumbnails can either be generated as `png`, `jpg` or `gif` files. These types a
|
||||
|
||||
## Thumbnail Query String Parameters
|
||||
|
||||
Clients can request thumbnail previews for files by adding `?preview=1` to the file URL. Requests for files with thumbnail availabe respond with HTTP status `404`.
|
||||
Clients can request thumbnail previews for files by adding `?preview=1` to the file URL. Requests for files with thumbnail available respond with HTTP status `404`.
|
||||
|
||||
The following query parameters are supported:
|
||||
|
||||
| Parameter | Required | Default Value | Description |
|
||||
| --------- | -------- | ---------------------------------------------------- | ------------------------------------------------------------------------------- |
|
||||
|-----------|----------|------------------------------------------------------|---------------------------------------------------------------------------------|
|
||||
| preview | YES | 1 | generates preview |
|
||||
| x | YES | first x-value configured in `THUMBNAILS_RESOLUTIONS` | horizontal target size |
|
||||
| y | YES | first y-value configured in `THUMBNAILS_RESOLUTIONS` | vertical target size |
|
||||
| scalingup | NO | 0 | prevents upscaling of small images |
|
||||
| scalingup | NO | 0 | prevents up-scaling of small images |
|
||||
| a | NO | 1 | aspect ratio |
|
||||
| c | NO | Caching string | Clients should send the etag, so they get a fresh thumbnail after a file change |
|
||||
| processor | NO | `resize` for gif's and `thumbnail` for all others | preferred thumbnail processor |
|
||||
| processor | NO | `resize` for gifs and `thumbnail` for all others | preferred thumbnail processor |
|
||||
|
||||
## Thumbnail Resolution
|
||||
|
||||
@@ -61,21 +61,21 @@ Various resolutions can be defined via `THUMBNAILS_RESOLUTIONS`. A requestor can
|
||||
|
||||
Example:
|
||||
|
||||
Requested: 18x12
|
||||
Available: 30x20, 15x10, 9x6
|
||||
Returned: 15x10
|
||||
Requested: 18x12
|
||||
Available: 30x20, 15x10, 9x6
|
||||
Returned: 15x10
|
||||
|
||||
## Thumbnail Processors
|
||||
|
||||
Normally, an image might get cropped when creating a preview, depending on the aspect ratio of the original image. This can have negative
|
||||
Normally, an image might get cropped when creating a preview, depending on the aspect ratio of the original image. This can have negative
|
||||
impacts on previews as only a part of the image will be shown. When using an _optional_ processor in the request, cropping can be avoided by defining on how the preview image generation will be done. The following processors are available:
|
||||
|
||||
* `resize` resizes the image to the specified width and height and returns the transformed image. If one of width or height is 0, the image aspect ratio is preserved.
|
||||
* `fit` scales down the image to fit the specified maximum width and height and returns the transformed image.
|
||||
* `fill`: creates an image with the specified dimensions and fills it with the scaled source image. To achieve the correct aspect ratio without stretching, the source image will be cropped.
|
||||
* `thumbnail` scales the image up or down, crops it to the specified width and hight and returns the transformed image.
|
||||
* `thumbnail` scales the image up or down, crops it to the specified width and height and returns the transformed image.
|
||||
|
||||
To apply one of those, a query parameter has to be added to the request, like `?processor=fit`. If no query parameter or processor is added, the default behaviour applies which is `resize` for gif's and `thumbnail` for all others.
|
||||
To apply one of those, a query parameter has to be added to the request, like `?processor=fit`. If no query parameter or processor is added, the default behaviour applies which is `resize` for gifs and `thumbnail` for all others.
|
||||
|
||||
## Deleting Thumbnails
|
||||
|
||||
@@ -84,3 +84,4 @@ As of now, there is no automated thumbnail deletion. This is especially true whe
|
||||
## Memory Considerations
|
||||
|
||||
Since source files need to be loaded into memory when generating thumbnails, large source files could potentially crash this service if there is insufficient memory available. For bigger instances when using container orchestration deployment methods, this service can be dedicated to its own server(s) with more memory.
|
||||
To have more control over memory (and CPU) consumption the maximum number of concurrent requests can be limited by setting the environment variable `THUMBNAILS_MAX_CONCURRENT_REQUESTS`. The default value is 0 which does not apply any restrictions to the number of concurrent requests. As soon as the number of concurrent requests is reached any further request will be responded with `429/Too Many Requests` and the client can retry at a later point in time.
|
||||
@@ -98,6 +98,7 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
http.Metrics(metrics),
|
||||
http.Namespace(cfg.HTTP.Namespace),
|
||||
http.TraceProvider(traceProvider),
|
||||
http.MaxConcurrentRequests(cfg.HTTP.MaxConcurrentRequests),
|
||||
)
|
||||
if err != nil {
|
||||
logger.Info().
|
||||
|
||||
@@ -32,9 +32,10 @@ func DefaultConfig() *config.Config {
|
||||
Namespace: "com.owncloud.api",
|
||||
},
|
||||
HTTP: config.HTTP{
|
||||
Addr: "127.0.0.1:9186",
|
||||
Root: "/thumbnails",
|
||||
Namespace: "com.owncloud.web",
|
||||
Addr: "127.0.0.1:9186",
|
||||
Root: "/thumbnails",
|
||||
Namespace: "com.owncloud.web",
|
||||
MaxConcurrentRequests: 0,
|
||||
},
|
||||
Service: config.Service{
|
||||
Name: "thumbnails",
|
||||
|
||||
@@ -4,8 +4,9 @@ import "github.com/owncloud/ocis/v2/ocis-pkg/shared"
|
||||
|
||||
// HTTP defines the available http configuration.
|
||||
type HTTP struct {
|
||||
Addr string `yaml:"addr" env:"THUMBNAILS_HTTP_ADDR" desc:"The bind address of the HTTP service." introductionVersion:"pre5.0"`
|
||||
TLS shared.HTTPServiceTLS `yaml:"tls"`
|
||||
Root string `yaml:"root" env:"THUMBNAILS_HTTP_ROOT" desc:"Subdirectory that serves as the root for this HTTP service." introductionVersion:"pre5.0"`
|
||||
Namespace string `yaml:"-"`
|
||||
Addr string `yaml:"addr" env:"THUMBNAILS_HTTP_ADDR" desc:"The bind address of the HTTP service." introductionVersion:"pre5.0"`
|
||||
TLS shared.HTTPServiceTLS `yaml:"tls"`
|
||||
Root string `yaml:"root" env:"THUMBNAILS_HTTP_ROOT" desc:"Subdirectory that serves as the root for this HTTP service." introductionVersion:"pre5.0"`
|
||||
Namespace string `yaml:"-"`
|
||||
MaxConcurrentRequests int `yaml:"max_concurrent_requests" env:"THUMBNAILS_MAX_CONCURRENT_REQUESTS" desc:"Number of maximum concurrent thumbnail requests. Default is 0 which is unlimited." introductionVersion:"6.0"`
|
||||
}
|
||||
@@ -15,13 +15,14 @@ type Option func(o *Options)
|
||||
|
||||
// Options defines the available options for this package.
|
||||
type Options struct {
|
||||
Namespace string
|
||||
Logger log.Logger
|
||||
Context context.Context
|
||||
Config *config.Config
|
||||
Metrics *metrics.Metrics
|
||||
Flags []cli.Flag
|
||||
TraceProvider trace.TracerProvider
|
||||
Namespace string
|
||||
Logger log.Logger
|
||||
Context context.Context
|
||||
Config *config.Config
|
||||
Metrics *metrics.Metrics
|
||||
Flags []cli.Flag
|
||||
TraceProvider trace.TracerProvider
|
||||
MaxConcurrentRequests int
|
||||
}
|
||||
|
||||
// newOptions initializes the available default options.
|
||||
@@ -80,3 +81,10 @@ func TraceProvider(traceProvider trace.TracerProvider) Option {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MaxConcurrentRequests provides a function to set the MaxConcurrentRequests option.
|
||||
func MaxConcurrentRequests(val int) Option {
|
||||
return func(o *Options) {
|
||||
o.MaxConcurrentRequests = val
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,7 @@ func Server(opts ...Option) (http.Service, error) {
|
||||
middleware.RealIP,
|
||||
middleware.RequestID,
|
||||
// ocismiddleware.Secure,
|
||||
ocismiddleware.Throttle(options.MaxConcurrentRequests),
|
||||
ocismiddleware.Version(
|
||||
options.Config.Service.Name,
|
||||
version.GetString(),
|
||||
|
||||
@@ -3,12 +3,11 @@ package svc
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/golang-jwt/jwt/v4"
|
||||
"github.com/riandyrn/otelchi"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/tracing"
|
||||
|
||||
@@ -44,7 +44,7 @@ type Persistence struct {
|
||||
Database string `yaml:"database" env:"USERLOG_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
|
||||
Table string `yaml:"table" env:"USERLOG_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
|
||||
TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;USERLOG_STORE_TTL" desc:"Time to live for events in the store. Defaults to '336h' (2 weeks). See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
|
||||
Size int `yaml:"size" env:"OCIS_PERSISTENT_STORE_SIZE;USERLOG_STORE_SIZE" desc:"The maximum quantity of items in the store. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not exclicitely set as default." introductionVersion:"pre5.0"`
|
||||
Size int `yaml:"size" env:"OCIS_PERSISTENT_STORE_SIZE;USERLOG_STORE_SIZE" desc:"The maximum quantity of items in the store. Only applies when store type 'ocmem' is configured. Defaults to 512 which is derived from the ocmem package though not explicitly set as default." introductionVersion:"pre5.0"`
|
||||
AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;USERLOG_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;USERLOG_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
SHELL := bash
|
||||
NAME := web
|
||||
WEB_ASSETS_VERSION = v8.0.1
|
||||
WEB_ASSETS_VERSION = v8.0.5
|
||||
|
||||
include ../../.make/recursion.mk
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ func (g Webdav) Search(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
t := r.Header.Get(TokenHeader)
|
||||
t := r.Header.Get(revactx.TokenHeader)
|
||||
ctx := revactx.ContextSetToken(r.Context(), t)
|
||||
ctx = metadata.Set(ctx, revactx.TokenHeader, t)
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
gatewayv1beta1 "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
|
||||
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
|
||||
rpcv1beta1 "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
||||
revactx "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
"github.com/cs3org/reva/v2/pkg/storage/utils/templates"
|
||||
"github.com/go-chi/chi/v5"
|
||||
@@ -37,10 +38,6 @@ func init() {
|
||||
chi.RegisterMethod("REPORT")
|
||||
}
|
||||
|
||||
const (
|
||||
TokenHeader = "X-Access-Token"
|
||||
)
|
||||
|
||||
var (
|
||||
codesEnum = map[int]string{
|
||||
http.StatusBadRequest: "Sabre\\DAV\\Exception\\BadRequest",
|
||||
@@ -52,8 +49,8 @@ var (
|
||||
|
||||
// Service defines the extension handlers.
|
||||
type Service interface {
|
||||
ServeHTTP(http.ResponseWriter, *http.Request)
|
||||
Thumbnail(http.ResponseWriter, *http.Request)
|
||||
ServeHTTP(w http.ResponseWriter, r *http.Request)
|
||||
Thumbnail(w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
|
||||
// NewService returns a service implementation for Service.
|
||||
@@ -235,7 +232,7 @@ func (g Webdav) SpacesThumbnail(w http.ResponseWriter, r *http.Request) {
|
||||
renderError(w, r, errBadRequest(err.Error()))
|
||||
return
|
||||
}
|
||||
t := r.Header.Get(TokenHeader)
|
||||
t := r.Header.Get(revactx.TokenHeader)
|
||||
|
||||
fullPath := filepath.Join(tr.Identifier, tr.Filepath)
|
||||
rsp, err := g.thumbnailsClient.GetThumbnail(r.Context(), &thumbnailssvc.GetThumbnailRequest{
|
||||
@@ -284,7 +281,7 @@ func (g Webdav) Thumbnail(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
t := r.Header.Get(TokenHeader)
|
||||
t := r.Header.Get(revactx.TokenHeader)
|
||||
|
||||
gatewayClient, err := g.gatewaySelector.Next()
|
||||
if err != nil {
|
||||
@@ -312,7 +309,7 @@ func (g Webdav) Thumbnail(w http.ResponseWriter, r *http.Request) {
|
||||
user = userRes.GetUser()
|
||||
} else {
|
||||
// look up user from URL via GetUserByClaim
|
||||
ctx := grpcmetadata.AppendToOutgoingContext(r.Context(), TokenHeader, t)
|
||||
ctx := grpcmetadata.AppendToOutgoingContext(r.Context(), revactx.TokenHeader, t)
|
||||
userRes, err := gatewayClient.GetUserByClaim(ctx, &userv1beta1.GetUserByClaimRequest{
|
||||
Claim: "username",
|
||||
Value: tr.Identifier,
|
||||
@@ -475,11 +472,11 @@ func (g Webdav) sendThumbnailResponse(rsp *thumbnailssvc.GetThumbnailResponse, w
|
||||
|
||||
if dlRsp.StatusCode != http.StatusOK {
|
||||
logger.Debug().
|
||||
Str("transfer_token", rsp.TransferToken).
|
||||
Str("data_endpoint", rsp.DataEndpoint).
|
||||
Str("transfer_token", rsp.GetTransferToken()).
|
||||
Str("data_endpoint", rsp.GetDataEndpoint()).
|
||||
Str("response_status", dlRsp.Status).
|
||||
Msg("could not download thumbnail")
|
||||
renderError(w, r, errInternalError("could not download thumbnail"))
|
||||
renderError(w, r, newErrResponse(dlRsp.StatusCode, "could not download thumbnail"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
sonar.projectKey=owncloud_ocis
|
||||
sonar.organization=owncloud-1
|
||||
sonar.projectName=ocis
|
||||
sonar.projectVersion=5.0.3
|
||||
sonar.projectVersion=5.0.7
|
||||
sonar.host.url=https://sonarcloud.io
|
||||
|
||||
# =====================================================
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
## Scenarios from web tests that are expected to fail on OCIS with OCIS storage
|
||||
The expected failures in this file are from features in the owncloud/web repo.
|
||||
|
||||
Lines that contain a format like "[someSuite.someFeature.feature:n](https://github.com/owncloud/web/path/to/feature)"
|
||||
are lines that document a specific expected failure. Follow that with a URL to the line in the feature file in GitHub.
|
||||
Please follow this format for the actual expected failures.
|
||||
|
||||
Level-3 headings should be used for the references to the relevant issues. Include the issue title with a link to the issue in GitHub.
|
||||
|
||||
Other free text and Markdown formatting can be used elsewhere in the document if needed. But if you want to explain something about the issue, then please post that in the issue itself.
|
||||
|
||||
Only the web scenarios tagged ocisSmokeTest are run by default in OCIS CI. This file lists the expected-failures of those ocisSmokeTest scenarios.
|
||||
@@ -1,16 +0,0 @@
|
||||
## Scenarios from web tests that are expected to fail on OCIS with OCIS storage
|
||||
|
||||
The expected failures in this file are from features in the owncloud/web repo.
|
||||
|
||||
Lines that contain a format like "[someSuite.someFeature.feature:n](https://github.com/owncloud/web/path/to/feature)"
|
||||
are lines that document a specific expected failure. Follow that with a URL to the line in the feature file in GitHub.
|
||||
Please follow this format for the actual expected failures.
|
||||
|
||||
Level-3 headings should be used for the references to the relevant issues. Include the issue title with a link to the issue in GitHub.
|
||||
|
||||
Other free text and Markdown formatting can be used elsewhere in the document if needed. But if you want to explain something about the issue, then please post that in the issue itself.
|
||||
|
||||
### [Exit page re-appears in loop when logged in user is deleted](https://github.com/owncloud/web/issues/4677)
|
||||
|
||||
- [webUILogin/openidLogin.feature:50](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUILogin/openidLogin.feature#L50)
|
||||
- [webUILogin/openidLogin.feature:60](https://github.com/owncloud/web/blob/master/tests/acceptance/features/webUILogin/openidLogin.feature#L60)
|
||||
+1
@@ -86,4 +86,5 @@ type UploadSessionFilter struct {
|
||||
ID *string
|
||||
Processing *bool
|
||||
Expired *bool
|
||||
HasVirus *bool
|
||||
}
|
||||
+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
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell
|
||||
|
||||
Please consider promoting this project if you find it useful.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
|
||||
OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
// Package require implements the same assertions as the `assert` package but
|
||||
// stops test execution when a test fails.
|
||||
//
|
||||
// Example Usage
|
||||
//
|
||||
// The following is a complete example using require in a standard test function:
|
||||
// import (
|
||||
// "testing"
|
||||
// "github.com/stretchr/testify/require"
|
||||
// )
|
||||
//
|
||||
// func TestSomething(t *testing.T) {
|
||||
//
|
||||
// var a string = "Hello"
|
||||
// var b string = "Hello"
|
||||
//
|
||||
// require.Equal(t, a, b, "The two words should be the same.")
|
||||
//
|
||||
// }
|
||||
//
|
||||
// Assertions
|
||||
//
|
||||
// The `require` package have same global functions as in the `assert` package,
|
||||
// but instead of returning a boolean result they call `t.FailNow()`.
|
||||
//
|
||||
// Every assertion function also takes an optional string message as the final argument,
|
||||
// allowing custom error messages to be appended to the message the assertion method outputs.
|
||||
package require
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package require
|
||||
|
||||
// Assertions provides assertion methods around the
|
||||
// TestingT interface.
|
||||
type Assertions struct {
|
||||
t TestingT
|
||||
}
|
||||
|
||||
// New makes a new Assertions object for the specified TestingT.
|
||||
func New(t TestingT) *Assertions {
|
||||
return &Assertions{
|
||||
t: t,
|
||||
}
|
||||
}
|
||||
|
||||
//go:generate go run ../_codegen/main.go -output-package=require -template=require_forward.go.tmpl
|
||||
+464
@@ -0,0 +1,464 @@
|
||||
/*
|
||||
* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen
|
||||
* THIS FILE MUST NOT BE EDITED BY HAND
|
||||
*/
|
||||
|
||||
package require
|
||||
|
||||
import (
|
||||
|
||||
assert "github.com/stretchr/testify/assert"
|
||||
http "net/http"
|
||||
url "net/url"
|
||||
time "time"
|
||||
)
|
||||
|
||||
|
||||
// Condition uses a Comparison to assert a complex condition.
|
||||
func Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) {
|
||||
if !assert.Condition(t, comp, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Contains asserts that the specified string, list(array, slice...) or map contains the
|
||||
// specified substring or element.
|
||||
//
|
||||
// assert.Contains(t, "Hello World", "World", "But 'Hello World' does contain 'World'")
|
||||
// assert.Contains(t, ["Hello", "World"], "World", "But ["Hello", "World"] does contain 'World'")
|
||||
// assert.Contains(t, {"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {
|
||||
if !assert.Contains(t, s, contains, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
|
||||
// a slice or a channel with len == 0.
|
||||
//
|
||||
// assert.Empty(t, obj)
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
|
||||
if !assert.Empty(t, object, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Equal asserts that two objects are equal.
|
||||
//
|
||||
// assert.Equal(t, 123, 123, "123 and 123 should be equal")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
|
||||
if !assert.Equal(t, expected, actual, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// EqualError asserts that a function returned an error (i.e. not `nil`)
|
||||
// and that it is equal to the provided error.
|
||||
//
|
||||
// actualObj, err := SomeFunction()
|
||||
// if assert.Error(t, err, "An error was expected") {
|
||||
// assert.Equal(t, err, expectedError)
|
||||
// }
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) {
|
||||
if !assert.EqualError(t, theError, errString, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// EqualValues asserts that two objects are equal or convertable to the same types
|
||||
// and equal.
|
||||
//
|
||||
// assert.EqualValues(t, uint32(123), int32(123), "123 and 123 should be equal")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
|
||||
if !assert.EqualValues(t, expected, actual, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Error asserts that a function returned an error (i.e. not `nil`).
|
||||
//
|
||||
// actualObj, err := SomeFunction()
|
||||
// if assert.Error(t, err, "An error was expected") {
|
||||
// assert.Equal(t, err, expectedError)
|
||||
// }
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func Error(t TestingT, err error, msgAndArgs ...interface{}) {
|
||||
if !assert.Error(t, err, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Exactly asserts that two objects are equal is value and type.
|
||||
//
|
||||
// assert.Exactly(t, int32(123), int64(123), "123 and 123 should NOT be equal")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
|
||||
if !assert.Exactly(t, expected, actual, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Fail reports a failure through
|
||||
func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) {
|
||||
if !assert.Fail(t, failureMessage, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// FailNow fails test
|
||||
func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) {
|
||||
if !assert.FailNow(t, failureMessage, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// False asserts that the specified value is false.
|
||||
//
|
||||
// assert.False(t, myBool, "myBool should be false")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func False(t TestingT, value bool, msgAndArgs ...interface{}) {
|
||||
if !assert.False(t, value, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// HTTPBodyContains asserts that a specified handler returns a
|
||||
// body that contains a string.
|
||||
//
|
||||
// assert.HTTPBodyContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) {
|
||||
if !assert.HTTPBodyContains(t, handler, method, url, values, str) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// HTTPBodyNotContains asserts that a specified handler returns a
|
||||
// body that does not contain a string.
|
||||
//
|
||||
// assert.HTTPBodyNotContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) {
|
||||
if !assert.HTTPBodyNotContains(t, handler, method, url, values, str) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// HTTPError asserts that a specified handler returns an error status code.
|
||||
//
|
||||
// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) {
|
||||
if !assert.HTTPError(t, handler, method, url, values) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// HTTPRedirect asserts that a specified handler returns a redirect status code.
|
||||
//
|
||||
// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) {
|
||||
if !assert.HTTPRedirect(t, handler, method, url, values) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// HTTPSuccess asserts that a specified handler returns a success status code.
|
||||
//
|
||||
// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil)
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) {
|
||||
if !assert.HTTPSuccess(t, handler, method, url, values) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Implements asserts that an object is implemented by the specified interface.
|
||||
//
|
||||
// assert.Implements(t, (*MyInterface)(nil), new(MyObject), "MyObject")
|
||||
func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {
|
||||
if !assert.Implements(t, interfaceObject, object, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// InDelta asserts that the two numerals are within delta of each other.
|
||||
//
|
||||
// assert.InDelta(t, math.Pi, (22 / 7.0), 0.01)
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
|
||||
if !assert.InDelta(t, expected, actual, delta, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// InDeltaSlice is the same as InDelta, except it compares two slices.
|
||||
func InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
|
||||
if !assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// InEpsilon asserts that expected and actual have a relative error less than epsilon
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
|
||||
if !assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// InEpsilonSlice is the same as InEpsilon, except it compares two slices.
|
||||
func InEpsilonSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
|
||||
if !assert.InEpsilonSlice(t, expected, actual, delta, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// IsType asserts that the specified objects are of the same type.
|
||||
func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {
|
||||
if !assert.IsType(t, expectedType, object, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// JSONEq asserts that two JSON strings are equivalent.
|
||||
//
|
||||
// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) {
|
||||
if !assert.JSONEq(t, expected, actual, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Len asserts that the specified object has specific length.
|
||||
// Len also fails if the object has a type that len() not accept.
|
||||
//
|
||||
// assert.Len(t, mySlice, 3, "The size of slice is not 3")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) {
|
||||
if !assert.Len(t, object, length, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Nil asserts that the specified object is nil.
|
||||
//
|
||||
// assert.Nil(t, err, "err should be nothing")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) {
|
||||
if !assert.Nil(t, object, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// NoError asserts that a function returned no error (i.e. `nil`).
|
||||
//
|
||||
// actualObj, err := SomeFunction()
|
||||
// if assert.NoError(t, err) {
|
||||
// assert.Equal(t, actualObj, expectedObj)
|
||||
// }
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func NoError(t TestingT, err error, msgAndArgs ...interface{}) {
|
||||
if !assert.NoError(t, err, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
|
||||
// specified substring or element.
|
||||
//
|
||||
// assert.NotContains(t, "Hello World", "Earth", "But 'Hello World' does NOT contain 'Earth'")
|
||||
// assert.NotContains(t, ["Hello", "World"], "Earth", "But ['Hello', 'World'] does NOT contain 'Earth'")
|
||||
// assert.NotContains(t, {"Hello": "World"}, "Earth", "But {'Hello': 'World'} does NOT contain 'Earth'")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {
|
||||
if !assert.NotContains(t, s, contains, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
|
||||
// a slice or a channel with len == 0.
|
||||
//
|
||||
// if assert.NotEmpty(t, obj) {
|
||||
// assert.Equal(t, "two", obj[1])
|
||||
// }
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
|
||||
if !assert.NotEmpty(t, object, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// NotEqual asserts that the specified values are NOT equal.
|
||||
//
|
||||
// assert.NotEqual(t, obj1, obj2, "two objects shouldn't be equal")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
|
||||
if !assert.NotEqual(t, expected, actual, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// NotNil asserts that the specified object is not nil.
|
||||
//
|
||||
// assert.NotNil(t, err, "err should be something")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) {
|
||||
if !assert.NotNil(t, object, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
|
||||
//
|
||||
// assert.NotPanics(t, func(){
|
||||
// RemainCalm()
|
||||
// }, "Calling RemainCalm() should NOT panic")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
|
||||
if !assert.NotPanics(t, f, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// NotRegexp asserts that a specified regexp does not match a string.
|
||||
//
|
||||
// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
|
||||
// assert.NotRegexp(t, "^start", "it's not starting")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {
|
||||
if !assert.NotRegexp(t, rx, str, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// NotZero asserts that i is not the zero value for its type and returns the truth.
|
||||
func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) {
|
||||
if !assert.NotZero(t, i, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Panics asserts that the code inside the specified PanicTestFunc panics.
|
||||
//
|
||||
// assert.Panics(t, func(){
|
||||
// GoCrazy()
|
||||
// }, "Calling GoCrazy() should panic")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
|
||||
if !assert.Panics(t, f, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Regexp asserts that a specified regexp matches a string.
|
||||
//
|
||||
// assert.Regexp(t, regexp.MustCompile("start"), "it's starting")
|
||||
// assert.Regexp(t, "start...$", "it's not starting")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {
|
||||
if !assert.Regexp(t, rx, str, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// True asserts that the specified value is true.
|
||||
//
|
||||
// assert.True(t, myBool, "myBool should be true")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func True(t TestingT, value bool, msgAndArgs ...interface{}) {
|
||||
if !assert.True(t, value, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// WithinDuration asserts that the two times are within duration delta of each other.
|
||||
//
|
||||
// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second, "The difference should not be more than 10s")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {
|
||||
if !assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Zero asserts that i is the zero value for its type and returns the truth.
|
||||
func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) {
|
||||
if !assert.Zero(t, i, msgAndArgs...) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
{{.Comment}}
|
||||
func {{.DocInfo.Name}}(t TestingT, {{.Params}}) {
|
||||
if !assert.{{.DocInfo.Name}}(t, {{.ForwardedParams}}) {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
||||
+388
@@ -0,0 +1,388 @@
|
||||
/*
|
||||
* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen
|
||||
* THIS FILE MUST NOT BE EDITED BY HAND
|
||||
*/
|
||||
|
||||
package require
|
||||
|
||||
import (
|
||||
|
||||
assert "github.com/stretchr/testify/assert"
|
||||
http "net/http"
|
||||
url "net/url"
|
||||
time "time"
|
||||
)
|
||||
|
||||
|
||||
// Condition uses a Comparison to assert a complex condition.
|
||||
func (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}) {
|
||||
Condition(a.t, comp, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// Contains asserts that the specified string, list(array, slice...) or map contains the
|
||||
// specified substring or element.
|
||||
//
|
||||
// a.Contains("Hello World", "World", "But 'Hello World' does contain 'World'")
|
||||
// a.Contains(["Hello", "World"], "World", "But ["Hello", "World"] does contain 'World'")
|
||||
// a.Contains({"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {
|
||||
Contains(a.t, s, contains, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
|
||||
// a slice or a channel with len == 0.
|
||||
//
|
||||
// a.Empty(obj)
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) {
|
||||
Empty(a.t, object, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// Equal asserts that two objects are equal.
|
||||
//
|
||||
// a.Equal(123, 123, "123 and 123 should be equal")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
|
||||
Equal(a.t, expected, actual, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// EqualError asserts that a function returned an error (i.e. not `nil`)
|
||||
// and that it is equal to the provided error.
|
||||
//
|
||||
// actualObj, err := SomeFunction()
|
||||
// if assert.Error(t, err, "An error was expected") {
|
||||
// assert.Equal(t, err, expectedError)
|
||||
// }
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) {
|
||||
EqualError(a.t, theError, errString, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// EqualValues asserts that two objects are equal or convertable to the same types
|
||||
// and equal.
|
||||
//
|
||||
// a.EqualValues(uint32(123), int32(123), "123 and 123 should be equal")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
|
||||
EqualValues(a.t, expected, actual, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// Error asserts that a function returned an error (i.e. not `nil`).
|
||||
//
|
||||
// actualObj, err := SomeFunction()
|
||||
// if a.Error(err, "An error was expected") {
|
||||
// assert.Equal(t, err, expectedError)
|
||||
// }
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) Error(err error, msgAndArgs ...interface{}) {
|
||||
Error(a.t, err, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// Exactly asserts that two objects are equal is value and type.
|
||||
//
|
||||
// a.Exactly(int32(123), int64(123), "123 and 123 should NOT be equal")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
|
||||
Exactly(a.t, expected, actual, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// Fail reports a failure through
|
||||
func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) {
|
||||
Fail(a.t, failureMessage, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// FailNow fails test
|
||||
func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) {
|
||||
FailNow(a.t, failureMessage, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// False asserts that the specified value is false.
|
||||
//
|
||||
// a.False(myBool, "myBool should be false")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) False(value bool, msgAndArgs ...interface{}) {
|
||||
False(a.t, value, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// HTTPBodyContains asserts that a specified handler returns a
|
||||
// body that contains a string.
|
||||
//
|
||||
// a.HTTPBodyContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) {
|
||||
HTTPBodyContains(a.t, handler, method, url, values, str)
|
||||
}
|
||||
|
||||
|
||||
// HTTPBodyNotContains asserts that a specified handler returns a
|
||||
// body that does not contain a string.
|
||||
//
|
||||
// a.HTTPBodyNotContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) {
|
||||
HTTPBodyNotContains(a.t, handler, method, url, values, str)
|
||||
}
|
||||
|
||||
|
||||
// HTTPError asserts that a specified handler returns an error status code.
|
||||
//
|
||||
// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values) {
|
||||
HTTPError(a.t, handler, method, url, values)
|
||||
}
|
||||
|
||||
|
||||
// HTTPRedirect asserts that a specified handler returns a redirect status code.
|
||||
//
|
||||
// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values) {
|
||||
HTTPRedirect(a.t, handler, method, url, values)
|
||||
}
|
||||
|
||||
|
||||
// HTTPSuccess asserts that a specified handler returns a success status code.
|
||||
//
|
||||
// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values) {
|
||||
HTTPSuccess(a.t, handler, method, url, values)
|
||||
}
|
||||
|
||||
|
||||
// Implements asserts that an object is implemented by the specified interface.
|
||||
//
|
||||
// a.Implements((*MyInterface)(nil), new(MyObject), "MyObject")
|
||||
func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {
|
||||
Implements(a.t, interfaceObject, object, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// InDelta asserts that the two numerals are within delta of each other.
|
||||
//
|
||||
// a.InDelta(math.Pi, (22 / 7.0), 0.01)
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
|
||||
InDelta(a.t, expected, actual, delta, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// InDeltaSlice is the same as InDelta, except it compares two slices.
|
||||
func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
|
||||
InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// InEpsilon asserts that expected and actual have a relative error less than epsilon
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
|
||||
InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// InEpsilonSlice is the same as InEpsilon, except it compares two slices.
|
||||
func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
|
||||
InEpsilonSlice(a.t, expected, actual, delta, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// IsType asserts that the specified objects are of the same type.
|
||||
func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {
|
||||
IsType(a.t, expectedType, object, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// JSONEq asserts that two JSON strings are equivalent.
|
||||
//
|
||||
// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) {
|
||||
JSONEq(a.t, expected, actual, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// Len asserts that the specified object has specific length.
|
||||
// Len also fails if the object has a type that len() not accept.
|
||||
//
|
||||
// a.Len(mySlice, 3, "The size of slice is not 3")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) {
|
||||
Len(a.t, object, length, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// Nil asserts that the specified object is nil.
|
||||
//
|
||||
// a.Nil(err, "err should be nothing")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) {
|
||||
Nil(a.t, object, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// NoError asserts that a function returned no error (i.e. `nil`).
|
||||
//
|
||||
// actualObj, err := SomeFunction()
|
||||
// if a.NoError(err) {
|
||||
// assert.Equal(t, actualObj, expectedObj)
|
||||
// }
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) {
|
||||
NoError(a.t, err, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
|
||||
// specified substring or element.
|
||||
//
|
||||
// a.NotContains("Hello World", "Earth", "But 'Hello World' does NOT contain 'Earth'")
|
||||
// a.NotContains(["Hello", "World"], "Earth", "But ['Hello', 'World'] does NOT contain 'Earth'")
|
||||
// a.NotContains({"Hello": "World"}, "Earth", "But {'Hello': 'World'} does NOT contain 'Earth'")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {
|
||||
NotContains(a.t, s, contains, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
|
||||
// a slice or a channel with len == 0.
|
||||
//
|
||||
// if a.NotEmpty(obj) {
|
||||
// assert.Equal(t, "two", obj[1])
|
||||
// }
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) {
|
||||
NotEmpty(a.t, object, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// NotEqual asserts that the specified values are NOT equal.
|
||||
//
|
||||
// a.NotEqual(obj1, obj2, "two objects shouldn't be equal")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
|
||||
NotEqual(a.t, expected, actual, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// NotNil asserts that the specified object is not nil.
|
||||
//
|
||||
// a.NotNil(err, "err should be something")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) {
|
||||
NotNil(a.t, object, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
|
||||
//
|
||||
// a.NotPanics(func(){
|
||||
// RemainCalm()
|
||||
// }, "Calling RemainCalm() should NOT panic")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {
|
||||
NotPanics(a.t, f, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// NotRegexp asserts that a specified regexp does not match a string.
|
||||
//
|
||||
// a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
|
||||
// a.NotRegexp("^start", "it's not starting")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {
|
||||
NotRegexp(a.t, rx, str, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// NotZero asserts that i is not the zero value for its type and returns the truth.
|
||||
func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) {
|
||||
NotZero(a.t, i, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// Panics asserts that the code inside the specified PanicTestFunc panics.
|
||||
//
|
||||
// a.Panics(func(){
|
||||
// GoCrazy()
|
||||
// }, "Calling GoCrazy() should panic")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {
|
||||
Panics(a.t, f, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// Regexp asserts that a specified regexp matches a string.
|
||||
//
|
||||
// a.Regexp(regexp.MustCompile("start"), "it's starting")
|
||||
// a.Regexp("start...$", "it's not starting")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {
|
||||
Regexp(a.t, rx, str, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// True asserts that the specified value is true.
|
||||
//
|
||||
// a.True(myBool, "myBool should be true")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) True(value bool, msgAndArgs ...interface{}) {
|
||||
True(a.t, value, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// WithinDuration asserts that the two times are within duration delta of each other.
|
||||
//
|
||||
// a.WithinDuration(time.Now(), time.Now(), 10*time.Second, "The difference should not be more than 10s")
|
||||
//
|
||||
// Returns whether the assertion was successful (true) or not (false).
|
||||
func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {
|
||||
WithinDuration(a.t, expected, actual, delta, msgAndArgs...)
|
||||
}
|
||||
|
||||
|
||||
// Zero asserts that i is the zero value for its type and returns the truth.
|
||||
func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) {
|
||||
Zero(a.t, i, msgAndArgs...)
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
{{.CommentWithoutT "a"}}
|
||||
func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) {
|
||||
{{.DocInfo.Name}}(a.t, {{.ForwardedParams}})
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package require
|
||||
|
||||
// TestingT is an interface wrapper around *testing.T
|
||||
type TestingT interface {
|
||||
Errorf(format string, args ...interface{})
|
||||
FailNow()
|
||||
}
|
||||
|
||||
//go:generate go run ../_codegen/main.go -output-package=require -template=require.go.tmpl
|
||||
+52
-58
@@ -33,6 +33,9 @@
|
||||
#define CONSTBASE R16
|
||||
#define BLOCKS R17
|
||||
|
||||
// for VPERMXOR
|
||||
#define MASK R18
|
||||
|
||||
DATA consts<>+0x00(SB)/8, $0x3320646e61707865
|
||||
DATA consts<>+0x08(SB)/8, $0x6b20657479622d32
|
||||
DATA consts<>+0x10(SB)/8, $0x0000000000000001
|
||||
@@ -53,7 +56,11 @@ DATA consts<>+0x80(SB)/8, $0x6b2065746b206574
|
||||
DATA consts<>+0x88(SB)/8, $0x6b2065746b206574
|
||||
DATA consts<>+0x90(SB)/8, $0x0000000100000000
|
||||
DATA consts<>+0x98(SB)/8, $0x0000000300000002
|
||||
GLOBL consts<>(SB), RODATA, $0xa0
|
||||
DATA consts<>+0xa0(SB)/8, $0x5566774411223300
|
||||
DATA consts<>+0xa8(SB)/8, $0xddeeffcc99aabb88
|
||||
DATA consts<>+0xb0(SB)/8, $0x6677445522330011
|
||||
DATA consts<>+0xb8(SB)/8, $0xeeffccddaabb8899
|
||||
GLOBL consts<>(SB), RODATA, $0xc0
|
||||
|
||||
//func chaCha20_ctr32_vsx(out, inp *byte, len int, key *[8]uint32, counter *uint32)
|
||||
TEXT ·chaCha20_ctr32_vsx(SB),NOSPLIT,$64-40
|
||||
@@ -70,6 +77,9 @@ TEXT ·chaCha20_ctr32_vsx(SB),NOSPLIT,$64-40
|
||||
MOVD $48, R10
|
||||
MOVD $64, R11
|
||||
SRD $6, LEN, BLOCKS
|
||||
// for VPERMXOR
|
||||
MOVD $consts<>+0xa0(SB), MASK
|
||||
MOVD $16, R20
|
||||
// V16
|
||||
LXVW4X (CONSTBASE)(R0), VS48
|
||||
ADD $80,CONSTBASE
|
||||
@@ -87,6 +97,10 @@ TEXT ·chaCha20_ctr32_vsx(SB),NOSPLIT,$64-40
|
||||
// V28
|
||||
LXVW4X (CONSTBASE)(R11), VS60
|
||||
|
||||
// Load mask constants for VPERMXOR
|
||||
LXVW4X (MASK)(R0), V20
|
||||
LXVW4X (MASK)(R20), V21
|
||||
|
||||
// splat slot from V19 -> V26
|
||||
VSPLTW $0, V19, V26
|
||||
|
||||
@@ -97,7 +111,7 @@ TEXT ·chaCha20_ctr32_vsx(SB),NOSPLIT,$64-40
|
||||
|
||||
MOVD $10, R14
|
||||
MOVD R14, CTR
|
||||
|
||||
PCALIGN $16
|
||||
loop_outer_vsx:
|
||||
// V0, V1, V2, V3
|
||||
LXVW4X (R0)(CONSTBASE), VS32
|
||||
@@ -128,22 +142,17 @@ loop_outer_vsx:
|
||||
VSPLTISW $12, V28
|
||||
VSPLTISW $8, V29
|
||||
VSPLTISW $7, V30
|
||||
|
||||
PCALIGN $16
|
||||
loop_vsx:
|
||||
VADDUWM V0, V4, V0
|
||||
VADDUWM V1, V5, V1
|
||||
VADDUWM V2, V6, V2
|
||||
VADDUWM V3, V7, V3
|
||||
|
||||
VXOR V12, V0, V12
|
||||
VXOR V13, V1, V13
|
||||
VXOR V14, V2, V14
|
||||
VXOR V15, V3, V15
|
||||
|
||||
VRLW V12, V27, V12
|
||||
VRLW V13, V27, V13
|
||||
VRLW V14, V27, V14
|
||||
VRLW V15, V27, V15
|
||||
VPERMXOR V12, V0, V21, V12
|
||||
VPERMXOR V13, V1, V21, V13
|
||||
VPERMXOR V14, V2, V21, V14
|
||||
VPERMXOR V15, V3, V21, V15
|
||||
|
||||
VADDUWM V8, V12, V8
|
||||
VADDUWM V9, V13, V9
|
||||
@@ -165,15 +174,10 @@ loop_vsx:
|
||||
VADDUWM V2, V6, V2
|
||||
VADDUWM V3, V7, V3
|
||||
|
||||
VXOR V12, V0, V12
|
||||
VXOR V13, V1, V13
|
||||
VXOR V14, V2, V14
|
||||
VXOR V15, V3, V15
|
||||
|
||||
VRLW V12, V29, V12
|
||||
VRLW V13, V29, V13
|
||||
VRLW V14, V29, V14
|
||||
VRLW V15, V29, V15
|
||||
VPERMXOR V12, V0, V20, V12
|
||||
VPERMXOR V13, V1, V20, V13
|
||||
VPERMXOR V14, V2, V20, V14
|
||||
VPERMXOR V15, V3, V20, V15
|
||||
|
||||
VADDUWM V8, V12, V8
|
||||
VADDUWM V9, V13, V9
|
||||
@@ -195,15 +199,10 @@ loop_vsx:
|
||||
VADDUWM V2, V7, V2
|
||||
VADDUWM V3, V4, V3
|
||||
|
||||
VXOR V15, V0, V15
|
||||
VXOR V12, V1, V12
|
||||
VXOR V13, V2, V13
|
||||
VXOR V14, V3, V14
|
||||
|
||||
VRLW V15, V27, V15
|
||||
VRLW V12, V27, V12
|
||||
VRLW V13, V27, V13
|
||||
VRLW V14, V27, V14
|
||||
VPERMXOR V15, V0, V21, V15
|
||||
VPERMXOR V12, V1, V21, V12
|
||||
VPERMXOR V13, V2, V21, V13
|
||||
VPERMXOR V14, V3, V21, V14
|
||||
|
||||
VADDUWM V10, V15, V10
|
||||
VADDUWM V11, V12, V11
|
||||
@@ -225,15 +224,10 @@ loop_vsx:
|
||||
VADDUWM V2, V7, V2
|
||||
VADDUWM V3, V4, V3
|
||||
|
||||
VXOR V15, V0, V15
|
||||
VXOR V12, V1, V12
|
||||
VXOR V13, V2, V13
|
||||
VXOR V14, V3, V14
|
||||
|
||||
VRLW V15, V29, V15
|
||||
VRLW V12, V29, V12
|
||||
VRLW V13, V29, V13
|
||||
VRLW V14, V29, V14
|
||||
VPERMXOR V15, V0, V20, V15
|
||||
VPERMXOR V12, V1, V20, V12
|
||||
VPERMXOR V13, V2, V20, V13
|
||||
VPERMXOR V14, V3, V20, V14
|
||||
|
||||
VADDUWM V10, V15, V10
|
||||
VADDUWM V11, V12, V11
|
||||
@@ -249,48 +243,48 @@ loop_vsx:
|
||||
VRLW V6, V30, V6
|
||||
VRLW V7, V30, V7
|
||||
VRLW V4, V30, V4
|
||||
BC 16, LT, loop_vsx
|
||||
BDNZ loop_vsx
|
||||
|
||||
VADDUWM V12, V26, V12
|
||||
|
||||
WORD $0x13600F8C // VMRGEW V0, V1, V27
|
||||
WORD $0x13821F8C // VMRGEW V2, V3, V28
|
||||
VMRGEW V0, V1, V27
|
||||
VMRGEW V2, V3, V28
|
||||
|
||||
WORD $0x10000E8C // VMRGOW V0, V1, V0
|
||||
WORD $0x10421E8C // VMRGOW V2, V3, V2
|
||||
VMRGOW V0, V1, V0
|
||||
VMRGOW V2, V3, V2
|
||||
|
||||
WORD $0x13A42F8C // VMRGEW V4, V5, V29
|
||||
WORD $0x13C63F8C // VMRGEW V6, V7, V30
|
||||
VMRGEW V4, V5, V29
|
||||
VMRGEW V6, V7, V30
|
||||
|
||||
XXPERMDI VS32, VS34, $0, VS33
|
||||
XXPERMDI VS32, VS34, $3, VS35
|
||||
XXPERMDI VS59, VS60, $0, VS32
|
||||
XXPERMDI VS59, VS60, $3, VS34
|
||||
|
||||
WORD $0x10842E8C // VMRGOW V4, V5, V4
|
||||
WORD $0x10C63E8C // VMRGOW V6, V7, V6
|
||||
VMRGOW V4, V5, V4
|
||||
VMRGOW V6, V7, V6
|
||||
|
||||
WORD $0x13684F8C // VMRGEW V8, V9, V27
|
||||
WORD $0x138A5F8C // VMRGEW V10, V11, V28
|
||||
VMRGEW V8, V9, V27
|
||||
VMRGEW V10, V11, V28
|
||||
|
||||
XXPERMDI VS36, VS38, $0, VS37
|
||||
XXPERMDI VS36, VS38, $3, VS39
|
||||
XXPERMDI VS61, VS62, $0, VS36
|
||||
XXPERMDI VS61, VS62, $3, VS38
|
||||
|
||||
WORD $0x11084E8C // VMRGOW V8, V9, V8
|
||||
WORD $0x114A5E8C // VMRGOW V10, V11, V10
|
||||
VMRGOW V8, V9, V8
|
||||
VMRGOW V10, V11, V10
|
||||
|
||||
WORD $0x13AC6F8C // VMRGEW V12, V13, V29
|
||||
WORD $0x13CE7F8C // VMRGEW V14, V15, V30
|
||||
VMRGEW V12, V13, V29
|
||||
VMRGEW V14, V15, V30
|
||||
|
||||
XXPERMDI VS40, VS42, $0, VS41
|
||||
XXPERMDI VS40, VS42, $3, VS43
|
||||
XXPERMDI VS59, VS60, $0, VS40
|
||||
XXPERMDI VS59, VS60, $3, VS42
|
||||
|
||||
WORD $0x118C6E8C // VMRGOW V12, V13, V12
|
||||
WORD $0x11CE7E8C // VMRGOW V14, V15, V14
|
||||
VMRGOW V12, V13, V12
|
||||
VMRGOW V14, V15, V14
|
||||
|
||||
VSPLTISW $4, V27
|
||||
VADDUWM V26, V27, V26
|
||||
@@ -431,7 +425,7 @@ tail_vsx:
|
||||
ADD $-1, R11, R12
|
||||
ADD $-1, INP
|
||||
ADD $-1, OUT
|
||||
|
||||
PCALIGN $16
|
||||
looptail_vsx:
|
||||
// Copying the result to OUT
|
||||
// in bytes.
|
||||
@@ -439,7 +433,7 @@ looptail_vsx:
|
||||
MOVBZU 1(INP), TMP
|
||||
XOR KEY, TMP, KEY
|
||||
MOVBU KEY, 1(OUT)
|
||||
BC 16, LT, looptail_vsx
|
||||
BDNZ looptail_vsx
|
||||
|
||||
// Clear the stack values
|
||||
STXVW4X VS48, (R11)(R0)
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
// Package md4 implements the MD4 hash algorithm as defined in RFC 1320.
|
||||
//
|
||||
// Deprecated: MD4 is cryptographically broken and should should only be used
|
||||
// Deprecated: MD4 is cryptographically broken and should only be used
|
||||
// where compatibility with legacy systems, not security, is the goal. Instead,
|
||||
// use a secure hash like SHA-256 (from crypto/sha256).
|
||||
package md4 // import "golang.org/x/crypto/md4"
|
||||
|
||||
+17
-2
@@ -143,6 +143,12 @@ func (s *asmState) Write(b []byte) (int, error) {
|
||||
|
||||
// Read squeezes an arbitrary number of bytes from the sponge.
|
||||
func (s *asmState) Read(out []byte) (n int, err error) {
|
||||
// The 'compute last message digest' instruction only stores the digest
|
||||
// at the first operand (dst) for SHAKE functions.
|
||||
if s.function != shake_128 && s.function != shake_256 {
|
||||
panic("sha3: can only call Read for SHAKE functions")
|
||||
}
|
||||
|
||||
n = len(out)
|
||||
|
||||
// need to pad if we were absorbing
|
||||
@@ -202,8 +208,17 @@ func (s *asmState) Sum(b []byte) []byte {
|
||||
|
||||
// Hash the buffer. Note that we don't clear it because we
|
||||
// aren't updating the state.
|
||||
klmd(s.function, &a, nil, s.buf)
|
||||
return append(b, a[:s.outputLen]...)
|
||||
switch s.function {
|
||||
case sha3_224, sha3_256, sha3_384, sha3_512:
|
||||
klmd(s.function, &a, nil, s.buf)
|
||||
return append(b, a[:s.outputLen]...)
|
||||
case shake_128, shake_256:
|
||||
d := make([]byte, s.outputLen, 64)
|
||||
klmd(s.function, &a, d, s.buf)
|
||||
return append(b, d[:s.outputLen]...)
|
||||
default:
|
||||
panic("sha3: unknown function")
|
||||
}
|
||||
}
|
||||
|
||||
// Reset resets the Hash to its initial state.
|
||||
|
||||
+11
-3
@@ -404,10 +404,10 @@ func validateKey(key PublicKey, algo string, user string, c packetConn) (bool, e
|
||||
return false, err
|
||||
}
|
||||
|
||||
return confirmKeyAck(key, algo, c)
|
||||
return confirmKeyAck(key, c)
|
||||
}
|
||||
|
||||
func confirmKeyAck(key PublicKey, algo string, c packetConn) (bool, error) {
|
||||
func confirmKeyAck(key PublicKey, c packetConn) (bool, error) {
|
||||
pubKey := key.Marshal()
|
||||
|
||||
for {
|
||||
@@ -425,7 +425,15 @@ func confirmKeyAck(key PublicKey, algo string, c packetConn) (bool, error) {
|
||||
if err := Unmarshal(packet, &msg); err != nil {
|
||||
return false, err
|
||||
}
|
||||
if msg.Algo != algo || !bytes.Equal(msg.PubKey, pubKey) {
|
||||
// According to RFC 4252 Section 7 the algorithm in
|
||||
// SSH_MSG_USERAUTH_PK_OK should match that of the request but some
|
||||
// servers send the key type instead. OpenSSH allows any algorithm
|
||||
// that matches the public key, so we do the same.
|
||||
// https://github.com/openssh/openssh-portable/blob/86bdd385/sshconnect2.c#L709
|
||||
if !contains(algorithmsForKeyFormat(key.Type()), msg.Algo) {
|
||||
return false, nil
|
||||
}
|
||||
if !bytes.Equal(msg.PubKey, pubKey) {
|
||||
return false, nil
|
||||
}
|
||||
return true, nil
|
||||
|
||||
+120
-50
@@ -426,6 +426,35 @@ func (l ServerAuthError) Error() string {
|
||||
return "[" + strings.Join(errs, ", ") + "]"
|
||||
}
|
||||
|
||||
// ServerAuthCallbacks defines server-side authentication callbacks.
|
||||
type ServerAuthCallbacks struct {
|
||||
// PasswordCallback behaves like [ServerConfig.PasswordCallback].
|
||||
PasswordCallback func(conn ConnMetadata, password []byte) (*Permissions, error)
|
||||
|
||||
// PublicKeyCallback behaves like [ServerConfig.PublicKeyCallback].
|
||||
PublicKeyCallback func(conn ConnMetadata, key PublicKey) (*Permissions, error)
|
||||
|
||||
// KeyboardInteractiveCallback behaves like [ServerConfig.KeyboardInteractiveCallback].
|
||||
KeyboardInteractiveCallback func(conn ConnMetadata, client KeyboardInteractiveChallenge) (*Permissions, error)
|
||||
|
||||
// GSSAPIWithMICConfig behaves like [ServerConfig.GSSAPIWithMICConfig].
|
||||
GSSAPIWithMICConfig *GSSAPIWithMICConfig
|
||||
}
|
||||
|
||||
// PartialSuccessError can be returned by any of the [ServerConfig]
|
||||
// authentication callbacks to indicate to the client that authentication has
|
||||
// partially succeeded, but further steps are required.
|
||||
type PartialSuccessError struct {
|
||||
// Next defines the authentication callbacks to apply to further steps. The
|
||||
// available methods communicated to the client are based on the non-nil
|
||||
// ServerAuthCallbacks fields.
|
||||
Next ServerAuthCallbacks
|
||||
}
|
||||
|
||||
func (p *PartialSuccessError) Error() string {
|
||||
return "ssh: authenticated with partial success"
|
||||
}
|
||||
|
||||
// ErrNoAuth is the error value returned if no
|
||||
// authentication method has been passed yet. This happens as a normal
|
||||
// part of the authentication loop, since the client first tries
|
||||
@@ -439,8 +468,18 @@ func (s *connection) serverAuthenticate(config *ServerConfig) (*Permissions, err
|
||||
var perms *Permissions
|
||||
|
||||
authFailures := 0
|
||||
noneAuthCount := 0
|
||||
var authErrs []error
|
||||
var displayedBanner bool
|
||||
partialSuccessReturned := false
|
||||
// Set the initial authentication callbacks from the config. They can be
|
||||
// changed if a PartialSuccessError is returned.
|
||||
authConfig := ServerAuthCallbacks{
|
||||
PasswordCallback: config.PasswordCallback,
|
||||
PublicKeyCallback: config.PublicKeyCallback,
|
||||
KeyboardInteractiveCallback: config.KeyboardInteractiveCallback,
|
||||
GSSAPIWithMICConfig: config.GSSAPIWithMICConfig,
|
||||
}
|
||||
|
||||
userAuthLoop:
|
||||
for {
|
||||
@@ -471,6 +510,11 @@ userAuthLoop:
|
||||
return nil, errors.New("ssh: client attempted to negotiate for unknown service: " + userAuthReq.Service)
|
||||
}
|
||||
|
||||
if s.user != userAuthReq.User && partialSuccessReturned {
|
||||
return nil, fmt.Errorf("ssh: client changed the user after a partial success authentication, previous user %q, current user %q",
|
||||
s.user, userAuthReq.User)
|
||||
}
|
||||
|
||||
s.user = userAuthReq.User
|
||||
|
||||
if !displayedBanner && config.BannerCallback != nil {
|
||||
@@ -491,20 +535,18 @@ userAuthLoop:
|
||||
|
||||
switch userAuthReq.Method {
|
||||
case "none":
|
||||
if config.NoClientAuth {
|
||||
noneAuthCount++
|
||||
// We don't allow none authentication after a partial success
|
||||
// response.
|
||||
if config.NoClientAuth && !partialSuccessReturned {
|
||||
if config.NoClientAuthCallback != nil {
|
||||
perms, authErr = config.NoClientAuthCallback(s)
|
||||
} else {
|
||||
authErr = nil
|
||||
}
|
||||
}
|
||||
|
||||
// allow initial attempt of 'none' without penalty
|
||||
if authFailures == 0 {
|
||||
authFailures--
|
||||
}
|
||||
case "password":
|
||||
if config.PasswordCallback == nil {
|
||||
if authConfig.PasswordCallback == nil {
|
||||
authErr = errors.New("ssh: password auth not configured")
|
||||
break
|
||||
}
|
||||
@@ -518,17 +560,17 @@ userAuthLoop:
|
||||
return nil, parseError(msgUserAuthRequest)
|
||||
}
|
||||
|
||||
perms, authErr = config.PasswordCallback(s, password)
|
||||
perms, authErr = authConfig.PasswordCallback(s, password)
|
||||
case "keyboard-interactive":
|
||||
if config.KeyboardInteractiveCallback == nil {
|
||||
if authConfig.KeyboardInteractiveCallback == nil {
|
||||
authErr = errors.New("ssh: keyboard-interactive auth not configured")
|
||||
break
|
||||
}
|
||||
|
||||
prompter := &sshClientKeyboardInteractive{s}
|
||||
perms, authErr = config.KeyboardInteractiveCallback(s, prompter.Challenge)
|
||||
perms, authErr = authConfig.KeyboardInteractiveCallback(s, prompter.Challenge)
|
||||
case "publickey":
|
||||
if config.PublicKeyCallback == nil {
|
||||
if authConfig.PublicKeyCallback == nil {
|
||||
authErr = errors.New("ssh: publickey auth not configured")
|
||||
break
|
||||
}
|
||||
@@ -562,11 +604,18 @@ userAuthLoop:
|
||||
if !ok {
|
||||
candidate.user = s.user
|
||||
candidate.pubKeyData = pubKeyData
|
||||
candidate.perms, candidate.result = config.PublicKeyCallback(s, pubKey)
|
||||
if candidate.result == nil && candidate.perms != nil && candidate.perms.CriticalOptions != nil && candidate.perms.CriticalOptions[sourceAddressCriticalOption] != "" {
|
||||
candidate.result = checkSourceAddress(
|
||||
candidate.perms, candidate.result = authConfig.PublicKeyCallback(s, pubKey)
|
||||
_, isPartialSuccessError := candidate.result.(*PartialSuccessError)
|
||||
|
||||
if (candidate.result == nil || isPartialSuccessError) &&
|
||||
candidate.perms != nil &&
|
||||
candidate.perms.CriticalOptions != nil &&
|
||||
candidate.perms.CriticalOptions[sourceAddressCriticalOption] != "" {
|
||||
if err := checkSourceAddress(
|
||||
s.RemoteAddr(),
|
||||
candidate.perms.CriticalOptions[sourceAddressCriticalOption])
|
||||
candidate.perms.CriticalOptions[sourceAddressCriticalOption]); err != nil {
|
||||
candidate.result = err
|
||||
}
|
||||
}
|
||||
cache.add(candidate)
|
||||
}
|
||||
@@ -578,8 +627,8 @@ userAuthLoop:
|
||||
if len(payload) > 0 {
|
||||
return nil, parseError(msgUserAuthRequest)
|
||||
}
|
||||
|
||||
if candidate.result == nil {
|
||||
_, isPartialSuccessError := candidate.result.(*PartialSuccessError)
|
||||
if candidate.result == nil || isPartialSuccessError {
|
||||
okMsg := userAuthPubKeyOkMsg{
|
||||
Algo: algo,
|
||||
PubKey: pubKeyData,
|
||||
@@ -629,11 +678,11 @@ userAuthLoop:
|
||||
perms = candidate.perms
|
||||
}
|
||||
case "gssapi-with-mic":
|
||||
if config.GSSAPIWithMICConfig == nil {
|
||||
if authConfig.GSSAPIWithMICConfig == nil {
|
||||
authErr = errors.New("ssh: gssapi-with-mic auth not configured")
|
||||
break
|
||||
}
|
||||
gssapiConfig := config.GSSAPIWithMICConfig
|
||||
gssapiConfig := authConfig.GSSAPIWithMICConfig
|
||||
userAuthRequestGSSAPI, err := parseGSSAPIPayload(userAuthReq.Payload)
|
||||
if err != nil {
|
||||
return nil, parseError(msgUserAuthRequest)
|
||||
@@ -689,49 +738,70 @@ userAuthLoop:
|
||||
break userAuthLoop
|
||||
}
|
||||
|
||||
authFailures++
|
||||
if config.MaxAuthTries > 0 && authFailures >= config.MaxAuthTries {
|
||||
// If we have hit the max attempts, don't bother sending the
|
||||
// final SSH_MSG_USERAUTH_FAILURE message, since there are
|
||||
// no more authentication methods which can be attempted,
|
||||
// and this message may cause the client to re-attempt
|
||||
// authentication while we send the disconnect message.
|
||||
// Continue, and trigger the disconnect at the start of
|
||||
// the loop.
|
||||
//
|
||||
// The SSH specification is somewhat confusing about this,
|
||||
// RFC 4252 Section 5.1 requires each authentication failure
|
||||
// be responded to with a respective SSH_MSG_USERAUTH_FAILURE
|
||||
// message, but Section 4 says the server should disconnect
|
||||
// after some number of attempts, but it isn't explicit which
|
||||
// message should take precedence (i.e. should there be a failure
|
||||
// message than a disconnect message, or if we are going to
|
||||
// disconnect, should we only send that message.)
|
||||
//
|
||||
// Either way, OpenSSH disconnects immediately after the last
|
||||
// failed authnetication attempt, and given they are typically
|
||||
// considered the golden implementation it seems reasonable
|
||||
// to match that behavior.
|
||||
continue
|
||||
var failureMsg userAuthFailureMsg
|
||||
|
||||
if partialSuccess, ok := authErr.(*PartialSuccessError); ok {
|
||||
// After a partial success error we don't allow changing the user
|
||||
// name and execute the NoClientAuthCallback.
|
||||
partialSuccessReturned = true
|
||||
|
||||
// In case a partial success is returned, the server may send
|
||||
// a new set of authentication methods.
|
||||
authConfig = partialSuccess.Next
|
||||
|
||||
// Reset pubkey cache, as the new PublicKeyCallback might
|
||||
// accept a different set of public keys.
|
||||
cache = pubKeyCache{}
|
||||
|
||||
// Send back a partial success message to the user.
|
||||
failureMsg.PartialSuccess = true
|
||||
} else {
|
||||
// Allow initial attempt of 'none' without penalty.
|
||||
if authFailures > 0 || userAuthReq.Method != "none" || noneAuthCount != 1 {
|
||||
authFailures++
|
||||
}
|
||||
if config.MaxAuthTries > 0 && authFailures >= config.MaxAuthTries {
|
||||
// If we have hit the max attempts, don't bother sending the
|
||||
// final SSH_MSG_USERAUTH_FAILURE message, since there are
|
||||
// no more authentication methods which can be attempted,
|
||||
// and this message may cause the client to re-attempt
|
||||
// authentication while we send the disconnect message.
|
||||
// Continue, and trigger the disconnect at the start of
|
||||
// the loop.
|
||||
//
|
||||
// The SSH specification is somewhat confusing about this,
|
||||
// RFC 4252 Section 5.1 requires each authentication failure
|
||||
// be responded to with a respective SSH_MSG_USERAUTH_FAILURE
|
||||
// message, but Section 4 says the server should disconnect
|
||||
// after some number of attempts, but it isn't explicit which
|
||||
// message should take precedence (i.e. should there be a failure
|
||||
// message than a disconnect message, or if we are going to
|
||||
// disconnect, should we only send that message.)
|
||||
//
|
||||
// Either way, OpenSSH disconnects immediately after the last
|
||||
// failed authentication attempt, and given they are typically
|
||||
// considered the golden implementation it seems reasonable
|
||||
// to match that behavior.
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
var failureMsg userAuthFailureMsg
|
||||
if config.PasswordCallback != nil {
|
||||
if authConfig.PasswordCallback != nil {
|
||||
failureMsg.Methods = append(failureMsg.Methods, "password")
|
||||
}
|
||||
if config.PublicKeyCallback != nil {
|
||||
if authConfig.PublicKeyCallback != nil {
|
||||
failureMsg.Methods = append(failureMsg.Methods, "publickey")
|
||||
}
|
||||
if config.KeyboardInteractiveCallback != nil {
|
||||
if authConfig.KeyboardInteractiveCallback != nil {
|
||||
failureMsg.Methods = append(failureMsg.Methods, "keyboard-interactive")
|
||||
}
|
||||
if config.GSSAPIWithMICConfig != nil && config.GSSAPIWithMICConfig.Server != nil &&
|
||||
config.GSSAPIWithMICConfig.AllowLogin != nil {
|
||||
if authConfig.GSSAPIWithMICConfig != nil && authConfig.GSSAPIWithMICConfig.Server != nil &&
|
||||
authConfig.GSSAPIWithMICConfig.AllowLogin != nil {
|
||||
failureMsg.Methods = append(failureMsg.Methods, "gssapi-with-mic")
|
||||
}
|
||||
|
||||
if len(failureMsg.Methods) == 0 {
|
||||
return nil, errors.New("ssh: no authentication methods configured but NoClientAuth is also false")
|
||||
return nil, errors.New("ssh: no authentication methods available")
|
||||
}
|
||||
|
||||
if err := s.transport.writePacket(Marshal(&failureMsg)); err != nil {
|
||||
|
||||
+11
-3
@@ -36,11 +36,14 @@ func (e UnsupportedError) Error() string {
|
||||
return "tiff: unsupported feature: " + string(e)
|
||||
}
|
||||
|
||||
var errNoPixels = FormatError("not enough pixel data")
|
||||
var (
|
||||
errNoPixels = FormatError("not enough pixel data")
|
||||
errInvalidColorIndex = FormatError("invalid color index")
|
||||
)
|
||||
|
||||
const maxChunkSize = 10 << 20 // 10M
|
||||
|
||||
// safeReadtAt is a verbatim copy of internal/saferio.ReadDataAt from the
|
||||
// safeReadAt is a verbatim copy of internal/saferio.ReadDataAt from the
|
||||
// standard library, which is used to read data from a reader using a length
|
||||
// provided by untrusted data, without allocating the entire slice ahead of time
|
||||
// if it is large (>maxChunkSize). This allows us to avoid allocating giant
|
||||
@@ -337,13 +340,18 @@ func (d *decoder) decode(dst image.Image, xmin, ymin, xmax, ymax int) error {
|
||||
}
|
||||
case mPaletted:
|
||||
img := dst.(*image.Paletted)
|
||||
pLen := len(d.palette)
|
||||
for y := ymin; y < rMaxY; y++ {
|
||||
for x := xmin; x < rMaxX; x++ {
|
||||
v, ok := d.readBits(d.bpp)
|
||||
if !ok {
|
||||
return errNoPixels
|
||||
}
|
||||
img.SetColorIndex(x, y, uint8(v))
|
||||
idx := uint8(v)
|
||||
if int(idx) >= pLen {
|
||||
return errInvalidColorIndex
|
||||
}
|
||||
img.SetColorIndex(x, y, idx)
|
||||
}
|
||||
d.flushBits()
|
||||
}
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ tokenization, and tokenization and tree construction stages of the WHATWG HTML
|
||||
parsing specification respectively. While the tokenizer parses and normalizes
|
||||
individual HTML tokens, only the parser constructs the DOM tree from the
|
||||
tokenized HTML, as described in the tree construction stage of the
|
||||
specification, dynamically modifying or extending the docuemnt's DOM tree.
|
||||
specification, dynamically modifying or extending the document's DOM tree.
|
||||
|
||||
If your use case requires semantically well-formed HTML documents, as defined by
|
||||
the WHATWG specification, the parser should be used rather than the tokenizer.
|
||||
|
||||
+4
-9
@@ -12,7 +12,7 @@ import (
|
||||
"golang.org/x/net/idna"
|
||||
)
|
||||
|
||||
var isTokenTable = [127]bool{
|
||||
var isTokenTable = [256]bool{
|
||||
'!': true,
|
||||
'#': true,
|
||||
'$': true,
|
||||
@@ -93,12 +93,7 @@ var isTokenTable = [127]bool{
|
||||
}
|
||||
|
||||
func IsTokenRune(r rune) bool {
|
||||
i := int(r)
|
||||
return i < len(isTokenTable) && isTokenTable[i]
|
||||
}
|
||||
|
||||
func isNotToken(r rune) bool {
|
||||
return !IsTokenRune(r)
|
||||
return r < utf8.RuneSelf && isTokenTable[byte(r)]
|
||||
}
|
||||
|
||||
// HeaderValuesContainsToken reports whether any string in values
|
||||
@@ -202,8 +197,8 @@ func ValidHeaderFieldName(v string) bool {
|
||||
if len(v) == 0 {
|
||||
return false
|
||||
}
|
||||
for _, r := range v {
|
||||
if !IsTokenRune(r) {
|
||||
for i := 0; i < len(v); i++ {
|
||||
if !isTokenTable[v[i]] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
+8
-5
@@ -490,6 +490,9 @@ func terminalReadFrameError(err error) bool {
|
||||
// returned error is ErrFrameTooLarge. Other errors may be of type
|
||||
// ConnectionError, StreamError, or anything else from the underlying
|
||||
// reader.
|
||||
//
|
||||
// If ReadFrame returns an error and a non-nil Frame, the Frame's StreamID
|
||||
// indicates the stream responsible for the error.
|
||||
func (fr *Framer) ReadFrame() (Frame, error) {
|
||||
fr.errDetail = nil
|
||||
if fr.lastFrame != nil {
|
||||
@@ -1521,7 +1524,7 @@ func (fr *Framer) maxHeaderStringLen() int {
|
||||
// readMetaFrame returns 0 or more CONTINUATION frames from fr and
|
||||
// merge them into the provided hf and returns a MetaHeadersFrame
|
||||
// with the decoded hpack values.
|
||||
func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) {
|
||||
func (fr *Framer) readMetaFrame(hf *HeadersFrame) (Frame, error) {
|
||||
if fr.AllowIllegalReads {
|
||||
return nil, errors.New("illegal use of AllowIllegalReads with ReadMetaHeaders")
|
||||
}
|
||||
@@ -1592,7 +1595,7 @@ func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) {
|
||||
}
|
||||
// It would be nice to send a RST_STREAM before sending the GOAWAY,
|
||||
// but the structure of the server's frame writer makes this difficult.
|
||||
return nil, ConnectionError(ErrCodeProtocol)
|
||||
return mh, ConnectionError(ErrCodeProtocol)
|
||||
}
|
||||
|
||||
// Also close the connection after any CONTINUATION frame following an
|
||||
@@ -1604,11 +1607,11 @@ func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) {
|
||||
}
|
||||
// It would be nice to send a RST_STREAM before sending the GOAWAY,
|
||||
// but the structure of the server's frame writer makes this difficult.
|
||||
return nil, ConnectionError(ErrCodeProtocol)
|
||||
return mh, ConnectionError(ErrCodeProtocol)
|
||||
}
|
||||
|
||||
if _, err := hdec.Write(frag); err != nil {
|
||||
return nil, ConnectionError(ErrCodeCompression)
|
||||
return mh, ConnectionError(ErrCodeCompression)
|
||||
}
|
||||
|
||||
if hc.HeadersEnded() {
|
||||
@@ -1625,7 +1628,7 @@ func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) {
|
||||
mh.HeadersFrame.invalidate()
|
||||
|
||||
if err := hdec.Close(); err != nil {
|
||||
return nil, ConnectionError(ErrCodeCompression)
|
||||
return mh, ConnectionError(ErrCodeCompression)
|
||||
}
|
||||
if invalid != nil {
|
||||
fr.errDetail = invalid
|
||||
|
||||
+6
-5
@@ -732,11 +732,7 @@ func isClosedConnError(err error) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// TODO: remove this string search and be more like the Windows
|
||||
// case below. That might involve modifying the standard library
|
||||
// to return better error types.
|
||||
str := err.Error()
|
||||
if strings.Contains(str, "use of closed network connection") {
|
||||
if errors.Is(err, net.ErrClosed) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -1482,6 +1478,11 @@ func (sc *serverConn) processFrameFromReader(res readFrameResult) bool {
|
||||
sc.goAway(ErrCodeFlowControl)
|
||||
return true
|
||||
case ConnectionError:
|
||||
if res.f != nil {
|
||||
if id := res.f.Header().StreamID; id > sc.maxClientStreamID {
|
||||
sc.maxClientStreamID = id
|
||||
}
|
||||
}
|
||||
sc.logf("http2: server connection error from %v: %v", sc.conn.RemoteAddr(), ev)
|
||||
sc.goAway(ErrCode(ev))
|
||||
return true // goAway will handle shutdown
|
||||
|
||||
+14
-1
@@ -936,7 +936,20 @@ func (cc *ClientConn) setGoAway(f *GoAwayFrame) {
|
||||
}
|
||||
last := f.LastStreamID
|
||||
for streamID, cs := range cc.streams {
|
||||
if streamID > last {
|
||||
if streamID <= last {
|
||||
// The server's GOAWAY indicates that it received this stream.
|
||||
// It will either finish processing it, or close the connection
|
||||
// without doing so. Either way, leave the stream alone for now.
|
||||
continue
|
||||
}
|
||||
if streamID == 1 && cc.goAway.ErrCode != ErrCodeNo {
|
||||
// Don't retry the first stream on a connection if we get a non-NO error.
|
||||
// If the server is sending an error on a new connection,
|
||||
// retrying the request on a new one probably isn't going to work.
|
||||
cs.abortStreamLocked(fmt.Errorf("http2: Transport received GOAWAY from server ErrCode:%v", cc.goAway.ErrCode))
|
||||
} else {
|
||||
// Aborting the stream with errClentConnGotGoAway indicates that
|
||||
// the request should be retried on a new connection.
|
||||
cs.abortStreamLocked(errClientConnGotGoAway)
|
||||
}
|
||||
}
|
||||
|
||||
+33
-9
@@ -35,11 +35,25 @@ type Weighted struct {
|
||||
// Acquire acquires the semaphore with a weight of n, blocking until resources
|
||||
// are available or ctx is done. On success, returns nil. On failure, returns
|
||||
// ctx.Err() and leaves the semaphore unchanged.
|
||||
//
|
||||
// If ctx is already done, Acquire may still succeed without blocking.
|
||||
func (s *Weighted) Acquire(ctx context.Context, n int64) error {
|
||||
done := ctx.Done()
|
||||
|
||||
s.mu.Lock()
|
||||
select {
|
||||
case <-done:
|
||||
// ctx becoming done has "happened before" acquiring the semaphore,
|
||||
// whether it became done before the call began or while we were
|
||||
// waiting for the mutex. We prefer to fail even if we could acquire
|
||||
// the mutex without blocking.
|
||||
s.mu.Unlock()
|
||||
return ctx.Err()
|
||||
default:
|
||||
}
|
||||
if s.size-s.cur >= n && s.waiters.Len() == 0 {
|
||||
// Since we hold s.mu and haven't synchronized since checking done, if
|
||||
// ctx becomes done before we return here, it becoming done must have
|
||||
// "happened concurrently" with this call - it cannot "happen before"
|
||||
// we return in this branch. So, we're ok to always acquire here.
|
||||
s.cur += n
|
||||
s.mu.Unlock()
|
||||
return nil
|
||||
@@ -48,7 +62,7 @@ func (s *Weighted) Acquire(ctx context.Context, n int64) error {
|
||||
if n > s.size {
|
||||
// Don't make other Acquire calls block on one that's doomed to fail.
|
||||
s.mu.Unlock()
|
||||
<-ctx.Done()
|
||||
<-done
|
||||
return ctx.Err()
|
||||
}
|
||||
|
||||
@@ -58,14 +72,14 @@ func (s *Weighted) Acquire(ctx context.Context, n int64) error {
|
||||
s.mu.Unlock()
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
err := ctx.Err()
|
||||
case <-done:
|
||||
s.mu.Lock()
|
||||
select {
|
||||
case <-ready:
|
||||
// Acquired the semaphore after we were canceled. Rather than trying to
|
||||
// fix up the queue, just pretend we didn't notice the cancelation.
|
||||
err = nil
|
||||
// Acquired the semaphore after we were canceled.
|
||||
// Pretend we didn't and put the tokens back.
|
||||
s.cur -= n
|
||||
s.notifyWaiters()
|
||||
default:
|
||||
isFront := s.waiters.Front() == elem
|
||||
s.waiters.Remove(elem)
|
||||
@@ -75,9 +89,19 @@ func (s *Weighted) Acquire(ctx context.Context, n int64) error {
|
||||
}
|
||||
}
|
||||
s.mu.Unlock()
|
||||
return err
|
||||
return ctx.Err()
|
||||
|
||||
case <-ready:
|
||||
// Acquired the semaphore. Check that ctx isn't already done.
|
||||
// We check the done channel instead of calling ctx.Err because we
|
||||
// already have the channel, and ctx.Err is O(n) with the nesting
|
||||
// depth of ctx.
|
||||
select {
|
||||
case <-done:
|
||||
s.Release(n)
|
||||
return ctx.Err()
|
||||
default:
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Loaded 100 of 211 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user