Remove onlyoffice extension

This commit is contained in:
pwengerter
2021-08-24 14:15:20 +01:00
parent 8e5b975b7f
commit a24fe109cc
61 changed files with 13 additions and 10330 deletions

View File

@@ -9,7 +9,6 @@ config = {
"ocis-pkg",
"ocis",
"ocs",
"onlyoffice",
"proxy",
"settings",
"storage",

7
.github/CODEOWNERS vendored
View File

@@ -1,5 +1,4 @@
/accounts/ @kulmann @pascalwengerter
/onlyoffice/ @kulmann @pascalwengerter
/settings/ @kulmann @pascalwengerter
/web/ @kulmann @pascalwengerter
accounts/ @kulmann @pascalwengerter @paulcod3
settings/ @kulmann @pascalwengerter @paulcod3
web/ @kulmann @pascalwengerter
.drone.star @wkloucek @micbar @phil-davis @individual-it

View File

@@ -18,12 +18,6 @@ updates:
interval: "weekly"
open-pull-requests-limit: 2
- package-ecosystem: "npm"
directory: "/onlyoffice"
schedule:
interval: "weekly"
open-pull-requests-limit: 2
- package-ecosystem: "npm"
directory: "/idp"
schedule:

View File

@@ -24,7 +24,6 @@ OCIS_MODULES = \
ocis \
ocis-pkg \
ocs \
onlyoffice \
proxy \
settings \
storage \

View File

@@ -0,0 +1,9 @@
Change: Remove OnlyOffice extension
Tags: OnlyOffice
We've removed the OnlyOffice extension in oCIS.
OnlyOffice has their own web extension for OC10 backend now with [a dedicated guide](https://owncloud.dev/clients/web/deployments/oc10-app/#onlyoffice).
In oCIS, we will follow up with a guide on how to start a WOPI server providing OnlyOffice soon.
https://github.com/owncloud/ocis/pull/2433

View File

@@ -88,10 +88,6 @@
{
"endpoint": "/settings.js",
"backend": "http://localhost:9190"
},
{
"endpoint": "/onlyoffice.js",
"backend": "http://localhost:9220"
}
]
}

View File

@@ -89,10 +89,6 @@
"endpoint": "/settings.js",
"backend": "http://localhost:9190"
},
{
"endpoint": "/onlyoffice.js",
"backend": "http://localhost:9220"
},
{
"endpoint": "/api/v0/greet",
"backend": "http://ocis-hello:9105"

View File

@@ -89,10 +89,6 @@
"endpoint": "/settings.js",
"backend": "http://localhost:9190"
},
{
"endpoint": "/onlyoffice.js",
"backend": "http://localhost:9220"
},
{
"endpoint": "/api/v0/wopi",
"backend": "http://ocis-wopiserver:9105"

View File

@@ -1,2 +0,0 @@
configuration.md
grpc.md

View File

@@ -1,11 +0,0 @@
---
title: "OnlyOffice"
date: 2018-05-02T00:00:00+00:00
weight: 20
geekdocRepo: https://github.com/owncloud/ocis
geekdocEditPath: edit/master/docs/extensions/onlyoffice
geekdocFilePath: _index.md
geekdocCollapseSection: true
---
This service enables users open documents, spreadsheets and presentations in the OnlyOffice app installed in ownCloud 10.

View File

@@ -1,28 +0,0 @@
---
title: "Building"
date: 2018-05-02T00:00:00+00:00
weight: 30
geekdocRepo: https://github.com/owncloud/ocis
geekdocEditPath: edit/master/docs/extensions/onlyoffice
geekdocFilePath: building.md
---
{{< toc >}}
As this project is built with Go, so you need to install that first. The installation of Go is out of the scope of this document, please follow the official documentation for [Go](https://golang.org/doc/install), to build this project you have to install Go >= v1.12. After the installation of the required tools you need to get the sources:
{{< highlight txt >}}
git clone https://github.com/owncloud/ocis/onlyoffice.git
cd ocis-onlyoffice
{{< / highlight >}}
All required tool besides Go itself and make are bundled or getting automatically installed within the `GOPATH`. All commands to build this project are part of our `Makefile`.
## Backend
{{< highlight txt >}}
make generate
make build
{{< / highlight >}}
Finally you should have the binary within the `bin/` folder now, give it a try with `./bin/onlyoffice -h` to see all available options.

View File

@@ -1,291 +0,0 @@
---
title: "Getting Started"
date: 2018-05-02T00:00:00+00:00
weight: 20
geekdocRepo: https://github.com/owncloud/ocis
geekdocEditPath: edit/master/docs/extensions/onlyoffice
geekdocFilePath: getting-started.md
---
{{< toc >}}
## Installation
So far we are offering two different variants for the installation. You can choose between [Docker](https://www.docker.com/) or pre-built binaries which are stored on our download mirrors and GitHub releases. Maybe we will also provide system packages for the major distributions later if we see the need for it.
### Docker
TBD
### Binaries
TBD
## Configuration
We provide overall three different variants of configuration. The variant based on environment variables and commandline flags are split up into global values and command-specific values.
### ownCloud Web configuration
When loading the extension in the ownCloud Web, it is necessary to specify to which ownCloud 10 server the extension is supposed to connect to. This can be done via `config` object when registering the extension in `config.json`. For more details, you can take a look at the following example:
```json
"external_apps": [
{
"id": "onlyoffice",
"path": "https://localhost:9200/onlyoffice.js",
"config": {
"server": "https://oc10.example.org"
}
}
]
```
### Environment variables
If you prefer to configure the service with environment variables you can see the available variables below.
#### Global
ONLYOFFICE_CONFIG_FILE
: Path to config file, empty default value
ONLYOFFICE_LOG_LEVEL
: Set logging level, defaults to `info`
ONLYOFFICE_LOG_COLOR
: Enable colored logging, defaults to `true`
ONLYOFFICE_LOG_PRETTY
: Enable pretty logging, defaults to `true`
#### Server
ONLYOFFICE_TRACING_ENABLED
: Enable sending traces, defaults to `false`
ONLYOFFICE_TRACING_TYPE
: Tracing backend type, defaults to `jaeger`
ONLYOFFICE_TRACING_ENDPOINT
: Endpoint for the agent, empty default value
ONLYOFFICE_TRACING_COLLECTOR
: Endpoint for the collector, empty default value
ONLYOFFICE_TRACING_SERVICE
: Service name for tracing, defaults to `onlyoffice`
ONLYOFFICE_DEBUG_ADDR
: Address to bind debug server, defaults to `0.0.0.0:9224`
ONLYOFFICE_DEBUG_TOKEN
: Token to grant metrics access, empty default value
ONLYOFFICE_DEBUG_PPROF
: Enable pprof debugging, defaults to `false`
ONLYOFFICE_DEBUG_ZPAGES
: Enable zpages debugging, defaults to `false`
ONLYOFFICE_HTTP_ADDR
: Address to bind http server, defaults to `0.0.0.0:9220`
ONLYOFFICE_HTTP_NAMESPACE
: The http namespace
ONLYOFFICE_HTTP_ROOT
: Root path of http server, defaults to `/`
#### Health
ONLYOFFICE_DEBUG_ADDR
: Address to debug endpoint, defaults to `0.0.0.0:9224`
### Commandline flags
If you prefer to configure the service with commandline flags you can see the available variables below.
#### Global
--config-file | $ONLYOFFICE_CONFIG_FILE
: Path to config file.
--log-level | $ONLYOFFICE_LOG_LEVEL
: Set logging level. Default: `info`.
--log-pretty | $ONLYOFFICE_LOG_PRETTY
: Enable pretty logging. Default: `true`.
--log-color | $ONLYOFFICE_LOG_COLOR
: Enable colored logging. Default: `true`.
#### Server
--tracing-enabled | $ONLYOFFICE_TRACING_ENABLED
: Enable sending traces.
--tracing-type | $ONLYOFFICE_TRACING_TYPE
: Tracing backend type. Default: `jaeger`.
--tracing-endpoint | $ONLYOFFICE_TRACING_ENDPOINT
: Endpoint for the agent.
--tracing-collector | $ONLYOFFICE_TRACING_COLLECTOR
: Endpoint for the collector.
--tracing-service | $ONLYOFFICE_TRACING_SERVICE
: Service name for tracing. Default: `onlyoffice`.
--debug-addr | $ONLYOFFICE_DEBUG_ADDR
: Address to bind debug server. Default: `0.0.0.0:9224`.
--debug-token | $ONLYOFFICE_DEBUG_TOKEN
: Token to grant metrics access.
--debug-pprof | $ONLYOFFICE_DEBUG_PPROF
: Enable pprof debugging.
--debug-zpages | $ONLYOFFICE_DEBUG_ZPAGES
: Enable zpages debugging.
--http-addr | $ONLYOFFICE_HTTP_ADDR
: Address to bind http server. Default: `0.0.0.0:9220`.
--http-namespace | $ONLYOFFICE_HTTP_NAMESPACE
: Set the base namespace for the http namespace. Default: `com.owncloud.web`.
--http-root | $ONLYOFFICE_HTTP_ROOT
: Root path of http server. Default: `/`.
--asset-path | $ONLYOFFICE_ASSET_PATH
: Path to custom assets.
#### Health
--debug-addr | $ONLYOFFICE_DEBUG_ADDR
: Address to debug endpoint. Default: `0.0.0.0:9224`.
### Configuration file
So far we support the file formats `JSON` and `YAML`, if you want to get a full example configuration just take a look at [our repository](https://github.com/owncloud/ocis/tree/master/onlyoffice/config), there you can always see the latest configuration format. These example configurations include all available options and the default values. The configuration file will be automatically loaded if it's placed at `/etc/ocis/onlyoffice.yml`, `${HOME}/.ocis/onlyoffice.yml` or `$(pwd)/config/onlyoffice.yml`.
## Usage
The program provides a few sub-commands on execution. The available configuration methods have already been mentioned above. Generally you can always see a formatted help output if you execute the binary via `ocis-onlyoffice --help`.
### Server
The server command is used to start the http and debug server on two addresses within a single process. The http server is serving the general webservice while the debug server is used for health check, readiness check and to server the metrics mentioned below. For further help please execute:
{{< highlight txt >}}
ocis-onlyoffice server --help
{{< / highlight >}}
### Health
The health command is used to execute a health check, if the exit code equals zero the service should be up and running, if the exist code is greater than zero the service is not in a healthy state. Generally this command is used within our Docker containers, it could also be used within Kubernetes.
{{< highlight txt >}}
ocis-onlyoffice health --help
{{< / highlight >}}
## Metrics
This service provides some [Prometheus](https://prometheus.io/) metrics through the debug endpoint, you can optionally secure the metrics endpoint by some random token, which got to be configured through one of the flag `--debug-token` or the environment variable `ONLYOFFICE_DEBUG_TOKEN` mentioned above. By default the metrics endpoint is bound to `http://0.0.0.0:9224/metrics`.
go_gc_duration_seconds
: A summary of the GC invocation durations
go_gc_duration_seconds_sum
: A summary of the GC invocation durations
go_gc_duration_seconds_count
: A summary of the GC invocation durations
go_goroutines
: Number of goroutines that currently exist
go_info
: Information about the Go environment
go_memstats_alloc_bytes
: Number of bytes allocated and still in use
go_memstats_alloc_bytes_total
: Total number of bytes allocated, even if freed
go_memstats_buck_hash_sys_bytes
: Number of bytes used by the profiling bucket hash table
go_memstats_frees_total
: Total number of frees
go_memstats_gc_cpu_fraction
: The fraction of this program's available CPU time used by the GC since the program started
go_memstats_gc_sys_bytes
: Number of bytes used for garbage collection system metadata
go_memstats_heap_alloc_bytes
: Number of heap bytes allocated and still in use
go_memstats_heap_idle_bytes
: Number of heap bytes waiting to be used
go_memstats_heap_inuse_bytes
: Number of heap bytes that are in use
go_memstats_heap_objects
: Number of allocated objects
go_memstats_heap_released_bytes
: Number of heap bytes released to OS
go_memstats_heap_sys_bytes
: Number of heap bytes obtained from system
go_memstats_last_gc_time_seconds
: Number of seconds since 1970 of last garbage collection
go_memstats_lookups_total
: Total number of pointer lookups
go_memstats_mallocs_total
: Total number of mallocs
go_memstats_mcache_inuse_bytes
: Number of bytes in use by mcache structures
go_memstats_mcache_sys_bytes
: Number of bytes used for mcache structures obtained from system
go_memstats_mspan_inuse_bytes
: Number of bytes in use by mspan structures
go_memstats_mspan_sys_bytes
: Number of bytes used for mspan structures obtained from system
go_memstats_next_gc_bytes
: Number of heap bytes when next garbage collection will take place
go_memstats_other_sys_bytes
: Number of bytes used for other system allocations
go_memstats_stack_inuse_bytes
: Number of bytes in use by the stack allocator
go_memstats_stack_sys_bytes
: Number of bytes obtained from system for stack allocator
go_memstats_sys_bytes
: Number of bytes obtained from system
go_threads
: Number of OS threads created
promhttp_metric_handler_requests_in_flight
: Current number of scrapes being served
promhttp_metric_handler_requests_total
: Total number of scrapes by HTTP status code

View File

@@ -1,10 +0,0 @@
---
title: "License"
date: 2018-05-02T00:00:00+00:00
weight: 40
geekdocRepo: https://github.com/owncloud/ocis
geekdocEditPath: edit/master/docs/extensions/onlyoffice
geekdocFilePath: license.md
---
This project is licensed under the [Apache 2.0](https://github.com/owncloud/ocis/blob/master/onlyoffice/LICENSE) license. For the license of the used libraries you have to check the respective sources.

View File

@@ -7,7 +7,6 @@ import (
graph "github.com/owncloud/ocis/graph/pkg/config"
idp "github.com/owncloud/ocis/idp/pkg/config"
ocs "github.com/owncloud/ocis/ocs/pkg/config"
onlyoffice "github.com/owncloud/ocis/onlyoffice/pkg/config"
proxy "github.com/owncloud/ocis/proxy/pkg/config"
settings "github.com/owncloud/ocis/settings/pkg/config"
storage "github.com/owncloud/ocis/storage/pkg/config"
@@ -98,7 +97,6 @@ type Config struct {
GraphExplorer *graphExplorer.Config
IDP *idp.Config
OCS *ocs.Config
Onlyoffice *onlyoffice.Config
Web *web.Config
Proxy *proxy.Config
Settings *settings.Config
@@ -117,7 +115,6 @@ func New() *Config {
GraphExplorer: graphExplorer.New(),
IDP: idp.New(),
OCS: ocs.New(),
Onlyoffice: onlyoffice.New(),
Web: web.New(),
Proxy: proxy.New(),
Settings: settings.New(),

View File

@@ -33,7 +33,6 @@ services:
- ../thumbnails:/thumbnails
- ../webdav:/webdav
- ../storage:/storage
- ../onlyoffice:/onlyoffice
environment:
# ocis log level will be used for all services
OCIS_LOG_LEVEL: debug

View File

@@ -1,46 +0,0 @@
package command
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis/pkg/register"
"github.com/owncloud/ocis/onlyoffice/pkg/command"
svcconfig "github.com/owncloud/ocis/onlyoffice/pkg/config"
"github.com/owncloud/ocis/onlyoffice/pkg/flagset"
)
// OnlyofficeCommand is the entrypoint for the onlyoffice command.
func OnlyofficeCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "onlyoffice",
Usage: "Start onlyoffice server",
Category: "Extensions",
Flags: flagset.ServerWithConfig(cfg.Onlyoffice),
Before: func(ctx *cli.Context) error {
return ParseConfig(ctx, cfg)
},
Action: func(c *cli.Context) error {
origCmd := command.Server(configureOnlyoffice(cfg))
return handleOriginalAction(c, origCmd)
},
}
}
func configureOnlyoffice(cfg *config.Config) *svcconfig.Config {
cfg.Onlyoffice.Log.Level = cfg.Log.Level
cfg.Onlyoffice.Log.Pretty = cfg.Log.Pretty
cfg.Onlyoffice.Log.Color = cfg.Log.Color
if cfg.Tracing.Enabled {
cfg.Onlyoffice.Tracing.Enabled = cfg.Tracing.Enabled
cfg.Onlyoffice.Tracing.Type = cfg.Tracing.Type
cfg.Onlyoffice.Tracing.Endpoint = cfg.Tracing.Endpoint
cfg.Onlyoffice.Tracing.Collector = cfg.Tracing.Collector
}
return cfg.Onlyoffice
}
func init() {
register.AddCommand(OnlyofficeCommand)
}

View File

@@ -8,7 +8,6 @@ import (
idp "github.com/owncloud/ocis/idp/pkg/config"
pman "github.com/owncloud/ocis/ocis/pkg/runtime/config"
ocs "github.com/owncloud/ocis/ocs/pkg/config"
onlyoffice "github.com/owncloud/ocis/onlyoffice/pkg/config"
proxy "github.com/owncloud/ocis/proxy/pkg/config"
settings "github.com/owncloud/ocis/settings/pkg/config"
storage "github.com/owncloud/ocis/storage/pkg/config"
@@ -74,7 +73,6 @@ type Config struct {
GraphExplorer *graphExplorer.Config
IDP *idp.Config
OCS *ocs.Config
Onlyoffice *onlyoffice.Config
Web *web.Config
Proxy *proxy.Config
Settings *settings.Config
@@ -94,7 +92,6 @@ func New() *Config {
GraphExplorer: graphExplorer.New(),
IDP: idp.New(),
OCS: ocs.New(),
Onlyoffice: onlyoffice.New(),
Web: web.New(),
Proxy: proxy.New(),
Settings: settings.New(),

View File

@@ -26,7 +26,6 @@ import (
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/log"
ocs "github.com/owncloud/ocis/ocs/pkg/command"
onlyoffice "github.com/owncloud/ocis/onlyoffice/pkg/command"
proxy "github.com/owncloud/ocis/proxy/pkg/command"
settings "github.com/owncloud/ocis/settings/pkg/command"
storage "github.com/owncloud/ocis/storage/pkg/command"
@@ -96,7 +95,6 @@ func NewService(options ...Option) (*Service, error) {
s.ServicesRegistry["graph-explorer"] = graphExplorer.NewSutureService
s.ServicesRegistry["idp"] = idp.NewSutureService
s.ServicesRegistry["ocs"] = ocs.NewSutureService
s.ServicesRegistry["onlyoffice"] = onlyoffice.NewSutureService
s.ServicesRegistry["store"] = store.NewSutureService
s.ServicesRegistry["thumbnails"] = thumbnails.NewSutureService
s.ServicesRegistry["web"] = web.NewSutureService

View File

@@ -1,17 +0,0 @@
{
"env": {
"browser": true,
"es6": true,
"amd": true
},
"extends": [
"standard",
"plugin:vue/essential"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
}
}

View File

@@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1,39 +0,0 @@
SHELL := bash
NAME := onlyoffice
############ tooling ############
ifneq (, $(shell which go 2> /dev/null)) # supress `command not found warnings` for non go targets in CI
include ../.bingo/Variables.mk
endif
############ go tooling ############
include ../.make/go.mk
############ release ############
include ../.make/release.mk
############ docs generate ############
include ../.make/docs.mk
.PHONY: docs-generate
docs-generate: config-docs-generate
############ generate ############
include ../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: # CI runs ci-node-generate automatically before this target
@go generate $(GENERATE)
.PHONY: ci-node-generate
ci-node-generate: yarn-build
.PHONY: yarn-build
yarn-build: node_modules
yarn lint
yarn test
yarn build
.PHONY: node_modules
node_modules:
yarn install --frozen-lockfile

View File

@@ -1,14 +0,0 @@
package main
import (
"os"
"github.com/owncloud/ocis/onlyoffice/pkg/command"
"github.com/owncloud/ocis/onlyoffice/pkg/config"
)
func main() {
if err := command.Execute(config.New()); err != nil {
os.Exit(1)
}
}

View File

@@ -1,18 +0,0 @@
{
"debug": {
"addr": "0.0.0.0:9224",
"token": "",
"pprof": false,
"zpages": false
},
"http": {
"addr": "0.0.0.0:9220"
},
"tracing": {
"enabled": false,
"type": "jaeger",
"endpoint": "localhost:6831",
"collector": "http://localhost:14268/api/traces",
"service": "onlyoffice"
}
}

View File

@@ -1,18 +0,0 @@
---
debug:
addr: 0.0.0.0:9224
token:
pprof: false
zpages: false
http:
addr: 0.0.0.0:9220
tracing:
enabled: false
type: jaeger
endpoint: localhost:6831
collector: http://localhost:14268/api/traces
service: onlyoffice
...

View File

@@ -1,19 +0,0 @@
FROM amd64/alpine:edge
RUN apk update && \
apk upgrade && \
apk add ca-certificates mailcap && \
rm -rf /var/cache/apk/* && \
echo 'hosts: files dns' >| /etc/nsswitch.conf
LABEL maintainer="ownCloud GmbH <devops@owncloud.com>" \
org.label-schema.name="oCIS Onlyoffice" \
org.label-schema.vendor="ownCloud GmbH" \
org.label-schema.schema-version="1.0"
EXPOSE 9220 9224
ENTRYPOINT ["/usr/bin/ocis-onlyoffice"]
CMD ["server"]
COPY bin/ocis-onlyoffice /usr/bin/ocis-onlyoffice

View File

@@ -1,19 +0,0 @@
FROM arm32v6/alpine:edge
RUN apk update && \
apk upgrade && \
apk add ca-certificates mailcap && \
rm -rf /var/cache/apk/* && \
echo 'hosts: files dns' >| /etc/nsswitch.conf
LABEL maintainer="ownCloud GmbH <devops@owncloud.com>" \
org.label-schema.name="oCIS Onlyoffice" \
org.label-schema.vendor="ownCloud GmbH" \
org.label-schema.schema-version="1.0"
EXPOSE 9220 9224
ENTRYPOINT ["/usr/bin/ocis-onlyoffice"]
CMD ["server"]
COPY bin/ocis-onlyoffice /usr/bin/ocis-onlyoffice

View File

@@ -1,19 +0,0 @@
FROM arm64v8/alpine:edge
RUN apk update && \
apk upgrade && \
apk add ca-certificates mailcap && \
rm -rf /var/cache/apk/* && \
echo 'hosts: files dns' >| /etc/nsswitch.conf
LABEL maintainer="ownCloud GmbH <devops@owncloud.com>" \
org.label-schema.name="oCIS Onlyoffice" \
org.label-schema.vendor="ownCloud GmbH" \
org.label-schema.schema-version="1.0"
EXPOSE 9220 9224
ENTRYPOINT ["/usr/bin/ocis-onlyoffice"]
CMD ["server"]
COPY bin/ocis-onlyoffice /usr/bin/ocis-onlyoffice

View File

@@ -1,22 +0,0 @@
image: owncloud/ocis-onlyoffice:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
manifests:
- image: owncloud/ocis-onlyoffice:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-amd64
platform:
architecture: amd64
os: linux
- image: owncloud/ocis-onlyoffice:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm64
platform:
architecture: arm64
variant: v8
os: linux
- image: owncloud/ocis-onlyoffice:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
platform:
architecture: arm
variant: v6
os: linux

View File

@@ -1,78 +0,0 @@
{
"private": true,
"name": "onlyoffice",
"version": "0.0.0",
"description": "",
"homepage": "https://github.com/owncloud/ocis/onlyoffice#readme",
"license": "Apache-2.0",
"author": "ownCloud GmbH <devops@owncloud.com>",
"repository": "https://github.com/owncloud/ocis/onlyoffice.git",
"bugs": {
"url": "https://github.com/owncloud/ocis/onlyoffice/issues",
"email": "support@owncloud.com"
},
"scripts": {
"lint": "eslint ui/**/*.js --color --global require",
"build": "rollup -c",
"watch": "rollup -c -w",
"test": "echo 'Not implemented'",
"generate-api": "node node_modules/swagger-vue-generator/bin/generate-api.js --package-version v0 --source pkg/proto/v0/hello.swagger.json --moduleName hello --destination ui/client/hello/index.js",
"acceptance-tests": "cucumber-js --require-module @babel/register --require-module @babel/polyfill --require ${TEST_INFRA_DIRECTORY}/acceptance/setup.js --require ui/tests/acceptance/stepDefinitions --require ${TEST_INFRA_DIRECTORY}/acceptance/stepDefinitions --format node_modules/cucumber-pretty -t \"${TEST_TAGS:-not @skip and not @skipOnOC10}\""
},
"devDependencies": {
"@babel/core": "^7.13.10",
"@babel/plugin-proposal-class-properties": "^7.12.13",
"@babel/plugin-proposal-export-default-from": "^7.12.13",
"@babel/plugin-proposal-object-rest-spread": "^7.12.13",
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
"@babel/plugin-transform-runtime": "^7.13.10",
"@babel/polyfill": "^7.10.1",
"@babel/preset-env": "^7.13.12",
"@babel/register": "^7.14.5",
"@erquhart/rollup-plugin-node-builtins": "^2.1.5",
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-json": "^4.0.1",
"@rollup/plugin-replace": "^2.4.2",
"archiver": "^5.3.0",
"axios": "^0.21.1",
"core-js": "3",
"cross-env": "^7.0.3",
"cucumber": "^6.0.5",
"cucumber-pretty": ">=6.0.0",
"debounce": "^1.2.1",
"easygettext": "^2.7.0",
"eslint": "7.22.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-standard": "^5.0.0",
"eslint-plugin-vue": "^7.8.0",
"fs-extra": "^9.0.1",
"join-path": "^1.1.1",
"ldap": "^0.7.1",
"nightwatch": "^1.6.0",
"nightwatch-api": "^3.0.2",
"node-fetch": "^2.6.1",
"qs": "^6.10.1",
"rimraf": "^3.0.0",
"rollup": "^2.55.1",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-eslint": "^7.0.0",
"rollup-plugin-filesize": "^9.1.0",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-serve": "^1.1.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-vue": "^5.1.9",
"swagger-vue-generator": "^1.0.6",
"url-search-params-polyfill": "^8.1.1",
"vue-template-compiler": "2.6.12",
"xml-js": "^1.6.11"
},
"browserslist": [
"> 1%",
"not dead",
"not IE 11"
]
}

View File

@@ -1,61 +0,0 @@
package assets
import (
"net/http"
"os"
"path"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/onlyoffice/pkg/config"
)
//go:generate make -C ../.. embed.yml
// assets gets initialized by New and provides the handler.
type assets struct {
logger log.Logger
config *config.Config
}
// Open just implements the HTTP filesystem interface.
func (a assets) Open(original string) (http.File, error) {
if a.config.Asset.Path != "" {
if stat, err := os.Stat(a.config.Asset.Path); err == nil && stat.IsDir() {
custom := path.Join(
a.config.Asset.Path,
original,
)
if _, err := os.Stat(custom); !os.IsNotExist(err) {
f, err := os.Open(custom)
if err != nil {
return nil, err
}
return f, nil
}
} else {
a.logger.Warn().
Str("path", a.config.Asset.Path).
Msg("Assets directory doesn't exist")
}
}
return FS.OpenFile(
CTX,
original,
os.O_RDONLY,
0644,
)
}
// New returns a new http filesystem to serve assets.
func New(opts ...Option) http.FileSystem {
options := newOptions(opts...)
return assets{
config: options.Config,
logger: options.Logger,
}
}

View File

@@ -1,9 +0,0 @@
package assets
import (
// Fake the import to make the dep tree happy.
_ "golang.org/x/net/context"
// Fake the import to make the dep tree happy.
_ "golang.org/x/net/webdav"
)

View File

@@ -1,173 +0,0 @@
// Code generated by fileb0x at "2021-08-05 14:44:09.305719 +0200 CEST m=+0.018184459" from config file "embed.yml" DO NOT EDIT.
// modification hash(d966a8f90918312d5dd86f7544b38cc0.8058aec596c5fb73022d09bb97af796e)
package assets
import (
"bytes"
"compress/gzip"
"context"
"io"
"net/http"
"os"
"path"
"golang.org/x/net/webdav"
)
var (
// CTX is a context for webdav vfs
CTX = context.Background()
// FS is a virtual memory file system
FS = webdav.NewMemFS()
// Handler is used to server files through a http handler
Handler *webdav.Handler
// HTTP is the http file system
HTTP http.FileSystem = new(HTTPFS)
)
// HTTPFS implements http.FileSystem
type HTTPFS struct {
// Prefix allows to limit the path of all requests. F.e. a prefix "css" would allow only calls to /css/*
Prefix string
}
// FileOnlyofficeJs is "onlyoffice.js"
var FileOnlyofficeJs = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x90\xc1\x4a\x33\x31\x14\x46\xf7\xff\x53\x94\xd0\xc5\x0c\xa4\xed\x3e\xa5\xbf\x8b\x82\xd0\x85\x56\x44\x57\x22\x76\x4c\xbe\xd8\x60\xe6\xde\x30\xc9\x38\x53\x42\xde\x5d\x50\xda\xea\xc2\x7d\x77\x39\x10\x2e\xe7\x7c\x06\xd6\x11\xaa\xca\xf6\xa4\x93\x63\xaa\xea\x2c\xfa\x88\x49\x4c\x9d\xd3\x49\x2c\x3b\xa4\xbe\xa3\xdc\x84\xb0\x21\xcb\x2a\x53\xd3\x42\x89\x2d\xf9\xc3\xd6\x5a\xa7\x21\xa4\x33\x4a\x30\xf9\x03\x1f\x59\x33\x29\x31\xce\xbe\x79\x66\x58\xf7\x2d\x28\x09\x89\x31\x81\xa2\x63\x8a\xea\x29\x9f\x40\x09\xc3\x7a\x14\x72\xdf\x90\xf1\xe8\xd4\x49\xe4\xfc\x65\xcd\x64\xdd\x9b\x82\xb4\xce\xe3\xae\x49\x7b\x45\x5f\xcf\x8d\x51\x5c\xea\x3c\x38\x32\x3c\xcc\x39\x80\xaa\xdd\x34\x63\x1e\xd1\x7d\xa0\x2b\x8b\x26\x84\xb8\x38\xab\x2d\xa6\x99\xcb\xd5\xf1\xc6\x6a\x9a\x41\x9a\x0d\x1e\xef\x37\x6b\x6e\x03\x13\x28\x55\x54\x97\x9d\x14\x2f\xaf\xbe\xa1\x77\x51\x17\x49\x18\xae\x9d\xc7\x0d\xa8\x57\xb9\x05\xf5\x0f\x2e\x79\x28\xac\xfe\xa3\x12\xb7\x18\x26\xe7\x25\x26\xa7\xd2\xfa\xcf\x0d\x4a\x91\x3f\xcb\x47\x1f\x2f\xb5\xfc\xb7\x68\x08\xe9\x62\x45\x9f\x4b\x29\x75\xbd\xfc\xf7\x19\x00\x00\xff\xff\xf5\x4b\xd1\x2b\xca\x02\x00\x00")
func init() {
err := CTX.Err()
if err != nil {
panic(err)
}
var f webdav.File
var rb *bytes.Reader
var r *gzip.Reader
rb = bytes.NewReader(FileOnlyofficeJs)
r, err = gzip.NewReader(rb)
if err != nil {
panic(err)
}
err = r.Close()
if err != nil {
panic(err)
}
f, err = FS.OpenFile(CTX, "onlyoffice.js", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777)
if err != nil {
panic(err)
}
_, err = io.Copy(f, r)
if err != nil {
panic(err)
}
err = f.Close()
if err != nil {
panic(err)
}
Handler = &webdav.Handler{
FileSystem: FS,
LockSystem: webdav.NewMemLS(),
}
}
// Open a file
func (hfs *HTTPFS) Open(path string) (http.File, error) {
path = hfs.Prefix + path
f, err := FS.OpenFile(CTX, path, os.O_RDONLY, 0644)
if err != nil {
return nil, err
}
return f, nil
}
// ReadFile is adapTed from ioutil
func ReadFile(path string) ([]byte, error) {
f, err := FS.OpenFile(CTX, path, os.O_RDONLY, 0644)
if err != nil {
return nil, err
}
buf := bytes.NewBuffer(make([]byte, 0, bytes.MinRead))
// If the buffer overflows, we will get bytes.ErrTooLarge.
// Return that as an error. Any other panic remains.
defer func() {
e := recover()
if e == nil {
return
}
if panicErr, ok := e.(error); ok && panicErr == bytes.ErrTooLarge {
err = panicErr
} else {
panic(e)
}
}()
_, err = buf.ReadFrom(f)
return buf.Bytes(), err
}
// WriteFile is adapTed from ioutil
func WriteFile(filename string, data []byte, perm os.FileMode) error {
f, err := FS.OpenFile(CTX, filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, perm)
if err != nil {
return err
}
n, err := f.Write(data)
if err == nil && n < len(data) {
err = io.ErrShortWrite
}
if err1 := f.Close(); err == nil {
err = err1
}
return err
}
// WalkDirs looks for files in the given dir and returns a list of files in it
// usage for all files in the b0x: WalkDirs("", false)
func WalkDirs(name string, includeDirsInList bool, files ...string) ([]string, error) {
f, err := FS.OpenFile(CTX, name, os.O_RDONLY, 0)
if err != nil {
return nil, err
}
fileInfos, err := f.Readdir(0)
if err != nil {
return nil, err
}
err = f.Close()
if err != nil {
return nil, err
}
for _, info := range fileInfos {
filename := path.Join(name, info.Name())
if includeDirsInList || !info.IsDir() {
files = append(files, filename)
}
if info.IsDir() {
files, err = WalkDirs(filename, includeDirsInList, files...)
if err != nil {
return nil, err
}
}
}
return files, nil
}

View File

@@ -1,17 +0,0 @@
---
pkg: "assets"
dest: "."
output: "embed.go"
fmt: true
noprefix: true
compression:
compress: true
custom:
- files:
- "../../assets/"
base: "../../assets/"
prefix: ""
...

View File

@@ -1,40 +0,0 @@
package assets
import (
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/onlyoffice/pkg/config"
)
// Option defines a single option function.
type Option func(o *Options)
// Options defines the available options for this package.
type Options struct {
Logger log.Logger
Config *config.Config
}
// newOptions initializes the available default options.
func newOptions(opts ...Option) Options {
opt := Options{}
for _, o := range opts {
o(&opt)
}
return opt
}
// Logger provides a function to set the logger option.
func Logger(val log.Logger) Option {
return func(o *Options) {
o.Logger = val
}
}
// Config provides a function to set the config option.
func Config(val *config.Config) Option {
return func(o *Options) {
o.Config = val
}
}

View File

@@ -1,49 +0,0 @@
package command
import (
"fmt"
"net/http"
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/onlyoffice/pkg/config"
"github.com/owncloud/ocis/onlyoffice/pkg/flagset"
)
// Health is the entrypoint for the health command.
func Health(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "health",
Usage: "Check health status",
Flags: flagset.HealthWithConfig(cfg),
Action: func(c *cli.Context) error {
logger := NewLogger(cfg)
resp, err := http.Get(
fmt.Sprintf(
"http://%s/healthz",
cfg.Debug.Addr,
),
)
if err != nil {
logger.Fatal().
Err(err).
Msg("Failed to request health check")
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
logger.Fatal().
Int("code", resp.StatusCode).
Msg("Health seems to be in bad state")
}
logger.Debug().
Int("code", resp.StatusCode).
Msg("Health got a good state")
return nil
},
}
}

View File

@@ -1,139 +0,0 @@
package command
import (
"context"
"os"
"strings"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/micro/cli/v2"
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/onlyoffice/pkg/config"
"github.com/owncloud/ocis/onlyoffice/pkg/flagset"
"github.com/owncloud/ocis/onlyoffice/pkg/version"
"github.com/spf13/viper"
"github.com/thejerf/suture/v4"
)
// Execute is the entry point for the ocis-onlyoffice command.
func Execute(cfg *config.Config) error {
app := &cli.App{
Name: "onlyoffice",
Version: version.String,
Usage: "OnlyOffice oCIS extension",
Compiled: version.Compiled(),
Authors: []*cli.Author{
{
Name: "ownCloud GmbH",
Email: "support@owncloud.com",
},
},
Flags: flagset.RootWithConfig(cfg),
Before: func(c *cli.Context) error {
return ParseConfig(c, cfg)
},
Commands: []*cli.Command{
Server(cfg),
Health(cfg),
},
}
cli.HelpFlag = &cli.BoolFlag{
Name: "help,h",
Usage: "Show the help",
}
cli.VersionFlag = &cli.BoolFlag{
Name: "version,v",
Usage: "Print the version",
}
return app.Run(os.Args)
}
// NewLogger initializes a service-specific logger instance.
func NewLogger(cfg *config.Config) log.Logger {
return log.NewLogger(
log.Name("onlyoffice"),
log.Level(cfg.Log.Level),
log.Pretty(cfg.Log.Pretty),
log.Color(cfg.Log.Color),
log.File(cfg.Log.File),
)
}
// ParseConfig loads onlyoffice configuration from Viper known paths.
func ParseConfig(c *cli.Context, cfg *config.Config) error {
sync.ParsingViperConfig.Lock()
defer sync.ParsingViperConfig.Unlock()
logger := NewLogger(cfg)
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
viper.SetEnvPrefix("ONLYOFFICE")
viper.AutomaticEnv()
if c.IsSet("config-file") {
viper.SetConfigFile(c.String("config-file"))
} else {
viper.SetConfigName("onlyoffice")
viper.AddConfigPath("/etc/ocis")
viper.AddConfigPath("$HOME/.ocis")
viper.AddConfigPath("./config")
}
if err := viper.ReadInConfig(); err != nil {
switch err.(type) {
case viper.ConfigFileNotFoundError:
logger.Info().
Msg("Continue without config")
case viper.UnsupportedConfigError:
logger.Fatal().
Err(err).
Msg("Unsupported config type")
default:
logger.Fatal().
Err(err).
Msg("Failed to read config")
}
}
if err := viper.Unmarshal(&cfg); err != nil {
logger.Fatal().
Err(err).
Msg("Failed to parse config")
}
return nil
}
// SutureService allows for the onlyoffice command to be embedded and supervised by a suture supervisor tree.
type SutureService struct {
cfg *config.Config
}
// NewSutureService creates a new onlyoffice.SutureService
func NewSutureService(cfg *ociscfg.Config) suture.Service {
if cfg.Mode == 0 {
cfg.Onlyoffice.Supervised = true
}
cfg.Onlyoffice.Log.File = cfg.Log.File
return SutureService{
cfg: cfg.Onlyoffice,
}
}
func (s SutureService) Serve(ctx context.Context) error {
s.cfg.Context = ctx
if err := Execute(s.cfg); err != nil {
return err
}
return nil
}

View File

@@ -1,118 +0,0 @@
package command
import (
"context"
"strings"
"github.com/owncloud/ocis/onlyoffice/pkg/tracing"
"github.com/owncloud/ocis/ocis-pkg/sync"
"github.com/micro/cli/v2"
"github.com/oklog/run"
"github.com/owncloud/ocis/onlyoffice/pkg/config"
"github.com/owncloud/ocis/onlyoffice/pkg/flagset"
"github.com/owncloud/ocis/onlyoffice/pkg/metrics"
"github.com/owncloud/ocis/onlyoffice/pkg/server/debug"
"github.com/owncloud/ocis/onlyoffice/pkg/server/http"
)
// Server is the entrypoint for the server command.
func Server(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "server",
Usage: "Start integrated server",
Flags: flagset.ServerWithConfig(cfg),
Before: func(ctx *cli.Context) error {
logger := NewLogger(cfg)
if cfg.HTTP.Root != "/" {
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
}
if !cfg.Supervised {
return ParseConfig(ctx, cfg)
}
logger.Debug().Str("service", "onlyoffice").Msg("ignoring config file parsing when running supervised")
return nil
},
Action: func(c *cli.Context) error {
logger := NewLogger(cfg)
if err := tracing.Configure(cfg); err != nil {
return err
}
var (
gr = run.Group{}
ctx, cancel = func() (context.Context, context.CancelFunc) {
if cfg.Context == nil {
return context.WithCancel(context.Background())
}
return context.WithCancel(cfg.Context)
}()
metrics = metrics.New()
)
if ctx == nil {
ctx, cancel = context.WithCancel(context.Background())
} else {
ctx, cancel = context.WithCancel(cfg.Context)
}
defer cancel()
{
server, err := http.Server(
http.Name("onlyoffice"),
http.Logger(logger),
http.Context(ctx),
http.Config(cfg),
http.Metrics(metrics),
)
if err != nil {
logger.Error().
Err(err).
Str("server", "http").
Msg("Failed to initialize server")
return err
}
gr.Add(func() error {
return server.Run()
}, func(_ error) {
logger.Info().
Str("server", "http").
Msg("Shutting down server")
cancel()
})
}
{
server, err := debug.Server(
debug.Logger(logger),
debug.Context(ctx),
debug.Config(cfg),
)
if err != nil {
logger.Error().Err(err).Str("server", "debug").Msg("Failed to initialize server")
return err
}
gr.Add(server.ListenAndServe, func(_ error) {
_ = server.Shutdown(ctx)
cancel()
})
}
if !cfg.Supervised {
sync.Trap(&gr, cancel)
}
return gr.Run()
},
}
}

View File

@@ -1,59 +0,0 @@
package config
import "context"
// Log defines the available logging configuration.
type Log struct {
Level string
Pretty bool
Color bool
File string
}
// Debug defines the available debug configuration.
type Debug struct {
Addr string
Token string
Pprof bool
Zpages bool
}
// HTTP defines the available http configuration.
type HTTP struct {
Addr string
Namespace string
Root string
CacheTTL int
}
// Tracing defines the available tracing configuration.
type Tracing struct {
Enabled bool
Type string
Endpoint string
Collector string
Service string
}
// Config combines all available configuration parts.
type Config struct {
File string
Log Log
Debug Debug
HTTP HTTP
Tracing Tracing
Asset Asset
Context context.Context
Supervised bool
}
// Asset defines the available asset configuration.
type Asset struct {
Path string
}
// New initializes a new configuration with or without defaults.
func New() *Config {
return &Config{}
}

View File

@@ -1,162 +0,0 @@
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/onlyoffice/pkg/config"
)
// RootWithConfig applies cfg to the root flagset
func RootWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "config-file",
Value: "",
Usage: "Path to config file",
EnvVars: []string{"ONLYOFFICE_CONFIG_FILE"},
Destination: &cfg.File,
},
&cli.StringFlag{
Name: "log-level",
Usage: "Set logging level",
EnvVars: []string{"ONLYOFFICE_LOG_LEVEL", "OCIS_LOG_LEVEL"},
Destination: &cfg.Log.Level,
},
&cli.BoolFlag{
Name: "log-pretty",
Usage: "Enable pretty logging",
EnvVars: []string{"ONLYOFFICE_LOG_PRETTY", "OCIS_LOG_PRETTY"},
Destination: &cfg.Log.Pretty,
},
&cli.BoolFlag{
Name: "log-color",
Usage: "Enable colored logging",
EnvVars: []string{"ONLYOFFICE_LOG_COLOR", "OCIS_LOG_COLOR"},
Destination: &cfg.Log.Color,
},
}
}
// HealthWithConfig applies cfg to the root flagset
func HealthWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "0.0.0.0:9224"),
Usage: "Address to debug endpoint",
EnvVars: []string{"ONLYOFFICE_DEBUG_ADDR"},
Destination: &cfg.Debug.Addr,
},
}
}
// ServerWithConfig applies cfg to the root flagset
func ServerWithConfig(cfg *config.Config) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "log-file",
Usage: "Enable log to file",
EnvVars: []string{"ONLYOFFICE_LOG_FILE", "OCIS_LOG_FILE"},
Destination: &cfg.Log.File,
},
&cli.BoolFlag{
Name: "tracing-enabled",
Usage: "Enable sending traces",
EnvVars: []string{"ONLYOFFICE_TRACING_ENABLED", "OCIS_TRACING_ENABLED"},
Destination: &cfg.Tracing.Enabled,
},
&cli.StringFlag{
Name: "tracing-type",
Value: flags.OverrideDefaultString(cfg.Tracing.Type, "jaeger"),
Usage: "Tracing backend type",
EnvVars: []string{"ONLYOFFICE_TRACING_TYPE", "OCIS_TRACING_TYPE"},
Destination: &cfg.Tracing.Type,
},
&cli.StringFlag{
Name: "tracing-endpoint",
Value: flags.OverrideDefaultString(cfg.Tracing.Endpoint, ""),
Usage: "Endpoint for the agent",
EnvVars: []string{"ONLYOFFICE_TRACING_ENDPOINT", "OCIS_TRACING_ENDPOINT"},
Destination: &cfg.Tracing.Endpoint,
},
&cli.StringFlag{
Name: "tracing-collector",
Value: flags.OverrideDefaultString(cfg.Tracing.Collector, ""),
Usage: "Endpoint for the collector",
EnvVars: []string{"ONLYOFFICE_TRACING_COLLECTOR", "OCIS_TRACING_COLLECTOR"},
Destination: &cfg.Tracing.Collector,
},
&cli.StringFlag{
Name: "tracing-service",
Value: flags.OverrideDefaultString(cfg.Tracing.Service, "onlyoffice"),
Usage: "Service name for tracing",
EnvVars: []string{"ONLYOFFICE_TRACING_SERVICE"},
Destination: &cfg.Tracing.Service,
},
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Debug.Addr, "0.0.0.0:9224"),
Usage: "Address to bind debug server",
EnvVars: []string{"ONLYOFFICE_DEBUG_ADDR"},
Destination: &cfg.Debug.Addr,
},
&cli.StringFlag{
Name: "debug-token",
Value: flags.OverrideDefaultString(cfg.Debug.Token, ""),
Usage: "Token to grant metrics access",
EnvVars: []string{"ONLYOFFICE_DEBUG_TOKEN"},
Destination: &cfg.Debug.Token,
},
&cli.BoolFlag{
Name: "debug-pprof",
Usage: "Enable pprof debugging",
EnvVars: []string{"ONLYOFFICE_DEBUG_PPROF"},
Destination: &cfg.Debug.Pprof,
},
&cli.BoolFlag{
Name: "debug-zpages",
Usage: "Enable zpages debugging",
EnvVars: []string{"ONLYOFFICE_DEBUG_ZPAGES"},
Destination: &cfg.Debug.Zpages,
},
&cli.StringFlag{
Name: "http-addr",
Value: flags.OverrideDefaultString(cfg.HTTP.Addr, "0.0.0.0:9220"),
Usage: "Address to bind http server",
EnvVars: []string{"ONLYOFFICE_HTTP_ADDR"},
Destination: &cfg.HTTP.Addr,
},
&cli.StringFlag{
Name: "http-namespace",
Value: flags.OverrideDefaultString(cfg.HTTP.Namespace, "com.owncloud.web"),
Usage: "Set the base namespace for the http namespace",
EnvVars: []string{"ONLYOFFICE_HTTP_NAMESPACE"},
Destination: &cfg.HTTP.Namespace,
},
&cli.StringFlag{
Name: "http-root",
Value: flags.OverrideDefaultString(cfg.HTTP.Root, "/"),
Usage: "Root path of http server",
EnvVars: []string{"ONLYOFFICE_HTTP_ROOT"},
Destination: &cfg.HTTP.Root,
},
&cli.IntFlag{
Name: "http-cache-ttl",
Value: flags.OverrideDefaultInt(cfg.HTTP.CacheTTL, 604800), // 7 days
Usage: "Set the static assets caching duration in seconds",
EnvVars: []string{"ONLYOFFICE_CACHE_TTL"},
Destination: &cfg.HTTP.CacheTTL,
},
&cli.StringFlag{
Name: "asset-path",
Value: flags.OverrideDefaultString(cfg.Asset.Path, ""),
Usage: "Path to custom assets",
EnvVars: []string{"ONLYOFFICE_ASSET_PATH"},
Destination: &cfg.Asset.Path,
},
&cli.StringFlag{
Name: "extensions",
Usage: "Run specific extensions during supervised mode. This flag is set by the runtime",
},
}
}

View File

@@ -1,32 +0,0 @@
package metrics
var (
// Namespace defines the namespace for the defines metrics.
Namespace = "ocis"
// Subsystem defines the subsystem for the defines metrics.
Subsystem = "onlyoffice"
)
// Metrics defines the available metrics of this service.
type Metrics struct {
// Counter *prometheus.CounterVec
}
// New initializes the available metrics.
func New() *Metrics {
m := &Metrics{
// Counter: prometheus.NewCounterVec(prometheus.CounterOpts{
// Namespace: Namespace,
// Subsystem: Subsystem,
// Name: "greet_total",
// Help: "How many greeting requests processed",
// }, []string{}),
}
// prometheus.Register(
// m.Counter,
// )
return m
}

View File

@@ -1,50 +0,0 @@
package debug
import (
"context"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/onlyoffice/pkg/config"
)
// Option defines a single option function.
type Option func(o *Options)
// Options defines the available options for this package.
type Options struct {
Logger log.Logger
Context context.Context
Config *config.Config
}
// newOptions initializes the available default options.
func newOptions(opts ...Option) Options {
opt := Options{}
for _, o := range opts {
o(&opt)
}
return opt
}
// Logger provides a function to set the logger option.
func Logger(val log.Logger) Option {
return func(o *Options) {
o.Logger = val
}
}
// Context provides a function to set the context option.
func Context(val context.Context) Option {
return func(o *Options) {
o.Context = val
}
}
// Config provides a function to set the config option.
func Config(val *config.Config) Option {
return func(o *Options) {
o.Config = val
}
}

View File

@@ -1,55 +0,0 @@
package debug
import (
"io"
"net/http"
"github.com/owncloud/ocis/ocis-pkg/service/debug"
"github.com/owncloud/ocis/onlyoffice/pkg/config"
"github.com/owncloud/ocis/onlyoffice/pkg/version"
)
// Server initializes the debug service and server.
func Server(opts ...Option) (*http.Server, error) {
options := newOptions(opts...)
return debug.NewService(
debug.Logger(options.Logger),
debug.Name("onlyoffice"),
debug.Version(version.String),
debug.Address(options.Config.Debug.Addr),
debug.Token(options.Config.Debug.Token),
debug.Pprof(options.Config.Debug.Pprof),
debug.Zpages(options.Config.Debug.Zpages),
debug.Health(health(options.Config)),
debug.Ready(ready(options.Config)),
), nil
}
// health implements the health check.
func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(http.StatusOK)
// TODO(tboerger): check if services are up and running
if _, err := io.WriteString(w, http.StatusText(http.StatusOK)); err != nil {
panic(err)
}
}
}
// ready implements the ready check.
func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(http.StatusOK)
// TODO(tboerger): check if services are up and running
if _, err := io.WriteString(w, http.StatusText(http.StatusOK)); err != nil {
panic(err)
}
}
}

View File

@@ -1,76 +0,0 @@
package http
import (
"context"
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/onlyoffice/pkg/config"
"github.com/owncloud/ocis/onlyoffice/pkg/metrics"
)
// Option defines a single option function.
type Option func(o *Options)
// Options defines the available options for this package.
type Options struct {
Name string
Logger log.Logger
Context context.Context
Config *config.Config
Metrics *metrics.Metrics
Flags []cli.Flag
}
// newOptions initializes the available default options.
func newOptions(opts ...Option) Options {
opt := Options{}
for _, o := range opts {
o(&opt)
}
return opt
}
// Logger provides a function to set the logger option.
func Logger(val log.Logger) Option {
return func(o *Options) {
o.Logger = val
}
}
// Context provides a function to set the context option.
func Context(val context.Context) Option {
return func(o *Options) {
o.Context = val
}
}
// Config provides a function to set the config option.
func Config(val *config.Config) Option {
return func(o *Options) {
o.Config = val
}
}
// Metrics provides a function to set the metrics option.
func Metrics(val *metrics.Metrics) Option {
return func(o *Options) {
o.Metrics = val
}
}
// Flags provides a function to set the flags option.
func Flags(val []cli.Flag) Option {
return func(o *Options) {
o.Flags = append(o.Flags, val...)
}
}
// Name provides a function to set the Name option.
func Name(val string) Option {
return func(o *Options) {
o.Name = val
}
}

View File

@@ -1,65 +0,0 @@
package http
import (
"github.com/asim/go-micro/v3"
chimiddleware "github.com/go-chi/chi/middleware"
"github.com/owncloud/ocis/ocis-pkg/middleware"
"github.com/owncloud/ocis/ocis-pkg/service/http"
"github.com/owncloud/ocis/onlyoffice/pkg/assets"
svc "github.com/owncloud/ocis/onlyoffice/pkg/service/v0"
"github.com/owncloud/ocis/onlyoffice/pkg/version"
)
// Server initializes the http service and server.
func Server(opts ...Option) (http.Service, error) {
options := newOptions(opts...)
service := http.NewService(
http.Name(options.Name),
http.Logger(options.Logger),
http.Version(version.String),
http.Namespace(options.Config.HTTP.Namespace),
http.Address(options.Config.HTTP.Addr),
http.Context(options.Context),
http.Flags(options.Flags...),
)
handle := svc.NewService(
svc.Logger(options.Logger),
svc.Config(options.Config),
svc.Middleware(
chimiddleware.RealIP,
chimiddleware.RequestID,
middleware.NoCache,
middleware.Cors,
middleware.Secure,
middleware.Version(
options.Name,
version.String,
),
middleware.Logger(
options.Logger,
),
middleware.Static(
options.Config.HTTP.Root,
assets.New(
assets.Logger(options.Logger),
assets.Config(options.Config),
),
options.Config.HTTP.CacheTTL,
),
),
)
{
handle = svc.NewInstrument(handle, options.Metrics)
handle = svc.NewLogging(handle, options.Logger)
handle = svc.NewTracing(handle)
}
if err := micro.RegisterHandler(service.Server(), handle); err != nil {
return http.Service{}, err
}
return service, nil
}

View File

@@ -1,25 +0,0 @@
package svc
import (
"net/http"
"github.com/owncloud/ocis/onlyoffice/pkg/metrics"
)
// NewInstrument returns a service that instruments metrics.
func NewInstrument(next Service, metrics *metrics.Metrics) Service {
return instrument{
next: next,
metrics: metrics,
}
}
type instrument struct {
next Service
metrics *metrics.Metrics
}
// ServeHTTP implements the Service interface.
func (i instrument) ServeHTTP(w http.ResponseWriter, r *http.Request) {
i.next.ServeHTTP(w, r)
}

View File

@@ -1,25 +0,0 @@
package svc
import (
"net/http"
"github.com/owncloud/ocis/ocis-pkg/log"
)
// NewLogging returns a service that logs messages.
func NewLogging(next Service, logger log.Logger) Service {
return logging{
next: next,
logger: logger,
}
}
type logging struct {
next Service
logger log.Logger
}
// ServeHTTP implements the Service interface.
func (l logging) ServeHTTP(w http.ResponseWriter, r *http.Request) {
l.next.ServeHTTP(w, r)
}

View File

@@ -1,50 +0,0 @@
package svc
import (
"net/http"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/onlyoffice/pkg/config"
)
// Option defines a single option function.
type Option func(o *Options)
// Options defines the available options for this package.
type Options struct {
Logger log.Logger
Config *config.Config
Middleware []func(http.Handler) http.Handler
}
// newOptions initializes the available default options.
func newOptions(opts ...Option) Options {
opt := Options{}
for _, o := range opts {
o(&opt)
}
return opt
}
// Logger provides a function to set the logger option.
func Logger(val log.Logger) Option {
return func(o *Options) {
o.Logger = val
}
}
// Config provides a function to set the config option.
func Config(val *config.Config) Option {
return func(o *Options) {
o.Config = val
}
}
// Middleware provides a function to set the middleware option.
func Middleware(val ...func(http.Handler) http.Handler) Option {
return func(o *Options) {
o.Middleware = val
}
}

View File

@@ -1,41 +0,0 @@
package svc
import (
"net/http"
"github.com/go-chi/chi"
"github.com/owncloud/ocis/onlyoffice/pkg/config"
)
// Service defines the extension handlers.
type Service interface {
ServeHTTP(http.ResponseWriter, *http.Request)
}
// NewService returns a service implementation for Service.
func NewService(opts ...Option) Service {
options := newOptions(opts...)
m := chi.NewMux()
m.Use(options.Middleware...)
svc := Onlyoffice{
config: options.Config,
mux: m,
}
m.Route(options.Config.HTTP.Root, func(r chi.Router) {})
return svc
}
// Onlyoffice defines implements the business logic for Service.
type Onlyoffice struct {
config *config.Config
mux *chi.Mux
}
// ServeHTTP implements the Service interface.
func (g Onlyoffice) ServeHTTP(w http.ResponseWriter, r *http.Request) {
g.mux.ServeHTTP(w, r)
}

View File

@@ -1,21 +0,0 @@
package svc
import (
"net/http"
)
// NewTracing returns a service that instruments traces.
func NewTracing(next Service) Service {
return tracing{
next: next,
}
}
type tracing struct {
next Service
}
// ServeHTTP implements the Service interface.
func (t tracing) ServeHTTP(w http.ResponseWriter, r *http.Request) {
t.next.ServeHTTP(w, r)
}

View File

@@ -1,21 +0,0 @@
package tracing
import (
pkgtrace "github.com/owncloud/ocis/ocis-pkg/tracing"
"github.com/owncloud/ocis/onlyoffice/pkg/config"
"go.opentelemetry.io/otel/trace"
)
var (
// TraceProvider is the global trace provider for the onlyoffice service.
TraceProvider = trace.NewNoopTracerProvider()
)
func Configure(cfg *config.Config) error {
var err error
if TraceProvider, err = pkgtrace.GetTraceProvider(cfg.Tracing.Collector, cfg.Tracing.Type, "onlyoffice"); err != nil {
return err
}
return nil
}

View File

@@ -1,19 +0,0 @@
package version
import (
"time"
)
var (
// String gets defined by the build system.
String = "0.0.0"
// Date indicates the build date.
Date = "00000000"
)
// Compiled returns the compile time of this service.
func Compiled() time.Time {
t, _ := time.Parse("20060102", Date)
return t
}

View File

@@ -1,2 +0,0 @@
# backend
-r '^(cmd|pkg)/.*\.go$' -R '^node_modules/' -s -- sh -c 'make bin/ocis-onlyoffice-debug && bin/ocis-onlyoffice-debug --log-level debug server --debug-pprof --debug-zpages'

View File

@@ -1,53 +0,0 @@
import vue from 'rollup-plugin-vue'
import { terser } from 'rollup-plugin-terser'
import replace from '@rollup/plugin-replace'
import filesize from 'rollup-plugin-filesize'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import babel from 'rollup-plugin-babel'
import json from '@rollup/plugin-json'
import builtins from '@erquhart/rollup-plugin-node-builtins'
import globals from 'rollup-plugin-node-globals'
import serve from 'rollup-plugin-serve'
const production = !process.env.ROLLUP_WATCH
// We can't really do much about circular dependencies in node_modules
function onwarn (warning) {
if (warning.code !== 'CIRCULAR_DEPENDENCY') {
console.error(`(!) ${warning.message}`)
}
}
export default {
input: 'ui/src/app.js',
output: {
file: 'assets/onlyoffice.js',
format: 'amd'
},
onwarn,
plugins: [
vue(),
replace({
'process.env.NODE_ENV': JSON.stringify('production')
}),
resolve({
mainFields: ['browser', 'jsnext', 'module', 'main'],
include: 'node_modules/**',
preferBuiltins: true
}),
babel({
exclude: 'node_modules/**',
runtimeHelpers: true
}),
commonjs({
include: 'node_modules/**'
}),
json(),
globals(),
builtins(),
production && terser(),
production && filesize(),
!production && serve('assets')
]
}

View File

@@ -1,82 +0,0 @@
---
title: "Configuration"
date: "{{ date "2006-01-02T15:04:05-0700" now }}"
weight: 20
geekdocRepo: https://github.com/owncloud/ocis
geekdocEditPath: edit/master/onlyoffice/templates
geekdocFilePath: CONFIGURATION.tmpl
---
{{- define "options"}}
{{ $fnNames := (last . ).Flags -}}
{{ range $opt := first . }}
{{ range $fnName := $fnNames }}{{ with list $fnName $opt -}}
{{ $o := last . -}}
{{ if eq $o.FnName $fnName -}}
-{{ $o.Name }} | {{ range $i, $e := $o.Env }} {{ if $i }}, {{ end }}${{ $e }}{{ end }}
: {{ $o.Usage }}. {{- if $o.Default }} Default: `{{ $o.Default }}`.{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end -}}
{{ end }}
{{`{{< toc >}}`}}
## Configuration
oCIS Single Binary is not responsible for configuring extensions. Instead, each extension could either be configured by environment variables, cli flags or config files.
Each extension has its dedicated documentation page (e.g. https://owncloud.dev/extensions/onlyoffice/configuration) which lists all possible configurations. Config files and environment variables are picked up if you use the `./bin/ocis server` command within the oCIS single binary. Command line flags must be set explicitly on the extensions subcommands.
### Configuration using config files
Out of the box extensions will attempt to read configuration details from:
```console
/etc/ocis
$HOME/.ocis
./config
```
For this configuration to be picked up, have a look at your extension `root` command and look for which default config name it has assigned. *i.e: onlyoffice reads `onlyoffice.json | yaml | toml ...`*.
So far we support the file formats `JSON` and `YAML`, if you want to get a full example configuration just take a look at [our repository](https://github.com/owncloud/ocis/tree/master/onlyoffice/config), there you can always see the latest configuration format. These example configurations include all available options and the default values. The configuration file will be automatically loaded if it's placed at `/etc/ocis/ocis.yml`, `${HOME}/.ocis/ocis.yml` or `$(pwd)/config/ocis.yml`.
### Environment variables
If you prefer to configure the service with environment variables you can see the available variables below.
If multiple variables are listed for one option, they are in order of precedence. This means the leftmost variable will always win if given.
### Commandline flags
If you prefer to configure the service with commandline flags you can see the available variables below. Command line flags are only working when calling the subcommand directly.
{{ $options := .Options -}}
{{ range $com := .Commands }}{{ with (list $options $com) -}}
{{ $c := last . -}}
{{ if eq $c.Name "onlyoffice" -}}
## Root Command
{{ $c.Usage }}
Usage: `onlyoffice [global options] command [command options] [arguments...]`
{{ template "options" . -}}
## Sub Commands
{{ end -}}
{{ end -}}
{{ end -}}
{{- range $com := .Commands }}{{ with (list $options $com) -}}
{{- $c := last . }}
{{- if ne $c.Name "onlyoffice" -}}
### onlyoffice {{ $c.Name }}
{{ $c.Usage }}
Usage: `onlyoffice {{ $c.Name }} [command options] [arguments...]`
{{ template "options" . }}
{{- end -}}
{{- end -}}
{{- end -}}

View File

@@ -1,44 +0,0 @@
const appInfo = {
name: 'OnlyOffice',
id: 'onlyoffice',
icon: 'x-office-document',
extensions: [
{
extension: 'docx',
handler: function ({ extensionConfig, filePath, fileId }) {
window.open(
`${extensionConfig.server}/apps/onlyoffice/${fileId}?filePath=${encodeURIComponent(filePath)}`,
'_blank'
)
},
newFileMenu: {
menuTitle ($gettext) {
return $gettext('New OnlyOffice document')
},
icon: 'x-office-document'
}
},
{
extension: 'xlsx',
handler: function ({ extensionConfig, filePath, fileId }) {
window.open(
`${extensionConfig.server}/apps/onlyoffice/${fileId}?filePath=${encodeURIComponent(filePath)}`,
'_blank'
)
}
},
{
extension: 'pptx',
handler: function ({ extensionConfig, filePath, fileId }) {
window.open(
`${extensionConfig.server}/apps/onlyoffice/${fileId}?filePath=${encodeURIComponent(filePath)}`,
'_blank'
)
}
}
]
}
export default {
appInfo
}

File diff suppressed because it is too large Load Diff

View File

@@ -95,10 +95,6 @@
{
"endpoint": "/settings.js",
"backend": "http://localhost:9190"
},
{
"endpoint": "/onlyoffice.js",
"backend": "http://localhost:9220"
}
]
},

View File

@@ -103,10 +103,6 @@
{
"endpoint": "/settings.js",
"backend": "http://localhost:9190"
},
{
"endpoint": "/onlyoffice.js",
"backend": "http://localhost:9220"
}
]
},

View File

@@ -89,10 +89,6 @@
{
"endpoint": "/settings.js",
"backend": "http://localhost:9190"
},
{
"endpoint": "/onlyoffice.js",
"backend": "http://localhost:9220"
}
]
}

View File

@@ -358,10 +358,6 @@ func defaultPolicies() []config.Policy {
Endpoint: "/settings.js",
Backend: "http://localhost:9190",
},
{
Endpoint: "/onlyoffice.js",
Backend: "http://localhost:9220",
},
},
},
{

View File

@@ -33,7 +33,7 @@ sonar.go.coverage.reportPaths=cache/coverage/*
# golangci-lint does not support wildcard
# https://github.com/SonarSource/slang/blob/85b05160bc1b31c6072a35f8818da4376b107afa/sonar-go-plugin/src/main/java/org/sonar/go/externalreport/GolangCILintReportSensor.java#L37
# https://github.com/SonarSource/slang/blob/85b05160bc1b31c6072a35f8818da4376b107afa/sonar-go-plugin/src/main/java/org/sonar/go/externalreport/AbstractReportSensor.java#L76-L90
sonar.go.golangci-lint.reportPaths=cache/checkstyle/accounts_checkstyle.xml,cache/checkstyle/glauth_checkstyle.xml,cache/checkstyle/graph_checkstyle.xml,cache/checkstyle/graph-explorer_checkstyle.xml,cache/checkstyle/idp_checkstyle.xml,cache/checkstyle/ocis_checkstyle.xml,cache/checkstyle/ocis-pkg_checkstyle.xml,cache/checkstyle/ocs_checkstyle.xml,cache/checkstyle/onlyoffice_checkstyle.xml,cache/checkstyle/proxy_checkstyle.xml,cache/checkstyle/settings_checkstyle.xml,cache/checkstyle/storage_checkstyle.xml,cache/checkstyle/store_checkstyle.xml,cache/checkstyle/thumbnails_checkstyle.xml,cache/checkstyle/web_checkstyle.xml,cache/checkstyle/webdav_checkstyle.xml
sonar.go.golangci-lint.reportPaths=cache/checkstyle/accounts_checkstyle.xml,cache/checkstyle/glauth_checkstyle.xml,cache/checkstyle/graph_checkstyle.xml,cache/checkstyle/graph-explorer_checkstyle.xml,cache/checkstyle/idp_checkstyle.xml,cache/checkstyle/ocis_checkstyle.xml,cache/checkstyle/ocis-pkg_checkstyle.xml,cache/checkstyle/ocs_checkstyle.xml,cache/checkstyle/proxy_checkstyle.xml,cache/checkstyle/settings_checkstyle.xml,cache/checkstyle/storage_checkstyle.xml,cache/checkstyle/store_checkstyle.xml,cache/checkstyle/thumbnails_checkstyle.xml,cache/checkstyle/web_checkstyle.xml,cache/checkstyle/webdav_checkstyle.xml
# Exclude files
sonar.exclusions=**/third_party,docs/**,changelog/**,*/pkg/assets/embed.go,idp/assets/identifier/**,**/package.json,**/rollup.config.js,CHANGELOG.md,**/pkg/proto/**/*.pb.*,deployments/**,tests/**,vendor-bin/**,README.md