Skip to content

Commit

Permalink
Create onlyoffice extension
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasHirt committed Nov 18, 2020
1 parent 94ceea6 commit 75e41b4
Show file tree
Hide file tree
Showing 65 changed files with 11,363 additions and 14 deletions.
7 changes: 7 additions & 0 deletions changelog/unreleased/create-onlyoffice-extension.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: Create OnlyOFFICE extension

Tags: OnlyOFFICE

We've created an OnlyOFFICE extension which enables users to create and edit docx documents.

https://github.com/owncloud/ocis/pull/857
4 changes: 4 additions & 0 deletions ocis-phoenix/pkg/service/v0/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ func (p Phoenix) getPayload() (payload []byte, err error) {
ID: "accounts",
Path: "/accounts.js",
},
{
ID: "onlyoffice",
Path: "/onlyoffice.js",
},
}
}

Expand Down
2 changes: 2 additions & 0 deletions ocis/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ require (
github.com/owncloud/ocis/ocis-phoenix v0.0.0-00010101000000-000000000000
github.com/owncloud/ocis/ocis-pkg v0.1.0
github.com/owncloud/ocis/ocs v0.0.0-00010101000000-000000000000
github.com/owncloud/ocis/onlyoffice v0.0.0-00010101000000-000000000000
github.com/owncloud/ocis/proxy v0.0.0-00010101000000-000000000000
github.com/owncloud/ocis/settings v0.0.0-20200918114005-1a0ddd2190ee
github.com/owncloud/ocis/storage v0.0.0-20201015120921-38358ba4d4df
Expand All @@ -43,6 +44,7 @@ replace (
github.com/owncloud/ocis/ocis-phoenix => ../ocis-phoenix
github.com/owncloud/ocis/ocis-pkg => ../ocis-pkg
github.com/owncloud/ocis/ocs => ../ocs
github.com/owncloud/ocis/onlyoffice => ../onlyoffice
github.com/owncloud/ocis/proxy => ../proxy
github.com/owncloud/ocis/settings => ../settings
github.com/owncloud/ocis/storage => ../storage
Expand Down
3 changes: 3 additions & 0 deletions ocis/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ github.com/go-asn1-ber/asn1-ber v1.5.1 h1:pDbRAunXzIUXfx4CB2QJFv5IuPiuoW+sWvr/Us
github.com/go-asn1-ber/asn1-ber v1.5.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
github.com/go-bindata/go-bindata v3.1.1+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo=
github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/go-chi/chi v4.1.0+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/go-chi/chi v4.1.2+incompatible h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec=
github.com/go-chi/chi v4.1.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/go-chi/render v1.0.1 h1:4/5tis2cKaNdnv9zFLfXzcquC9HbeZgCnxGnKrltBS8=
Expand Down Expand Up @@ -1076,6 +1077,8 @@ github.com/owncloud/ocis-graph-explorer v0.0.0-20200210111049-017eeb40dc0c/go.mo
github.com/owncloud/ocis-hello v0.1.0-alpha1.0.20200828085053-37fcf3c8f853 h1:ei0C5Wmppw+9oiSB0XpAdwymD8+ZnmewNdVVzYE3UvQ=
github.com/owncloud/ocis-hello v0.1.0-alpha1.0.20200828085053-37fcf3c8f853/go.mod h1:vnpYlDkhVoiuUAuTnY4Ajz2d5Alz0c/49AxptOLTpYA=
github.com/owncloud/ocis-pkg/v2 v2.0.1/go.mod h1:7bVnn3VUaqdmvpMkXF0QVEF1fRugs35hSkuVTAq9yjk=
github.com/owncloud/ocis-pkg/v2 v2.2.0/go.mod h1:MXv7QzsYsu4YWuyJxhq1kLLmJa/r5gbqHe1FXulMHaw=
github.com/owncloud/ocis-pkg/v2 v2.4.0 h1:/3ZOd4txtwjiNKJA9iLT9BjrJw5YgHSX13fQR4BYfGY=
github.com/owncloud/ocis-pkg/v2 v2.4.0/go.mod h1:FSzIvhx9HcZcq4jgNaDowNvM7PTX/XCyoMvyfzidUpE=
github.com/owncloud/ocis-settings v0.3.2-0.20200827193534-8caf098e6537/go.mod h1:vRge9QDkOsc6j76gPBmZs1Z5uOPrV4DIkZCgZCEFwBA=
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
Expand Down
56 changes: 56 additions & 0 deletions ocis/pkg/command/onlyoffice.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package command

import (
"strings"

"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"
"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(c *cli.Context) error {
if cfg.HTTP.Root != "/" {
cfg.HTTP.Root = strings.TrimSuffix(cfg.HTTP.Root, "/")
}

return nil
},
Action: func(c *cli.Context) error {
onlyofficeCommand := command.Server(configureOnlyoffice(cfg).Onlyoffice)

if err := onlyofficeCommand.Before(c); err != nil {
return err
}

return cli.HandleAction(onlyofficeCommand.Action, c)
},
}
}

func configureOnlyoffice(cfg *config.Config) *config.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
}

func init() {
register.AddCommand(OnlyofficeCommand)
}
17 changes: 10 additions & 7 deletions ocis/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
konnectd "github.com/owncloud/ocis/konnectd/pkg/config"
phoenix "github.com/owncloud/ocis/ocis-phoenix/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"
Expand Down Expand Up @@ -70,39 +71,41 @@ type Config struct {
TokenManager TokenManager

Accounts *accounts.Config
GLAuth *glauth.Config
Graph *graph.Config
GraphExplorer *graphExplorer.Config
GLAuth *glauth.Config
Hello *hello.Config
Konnectd *konnectd.Config
OCS *ocs.Config
Onlyoffice *onlyoffice.Config
Phoenix *phoenix.Config
Proxy *proxy.Config
Settings *settings.Config
Storage *storage.Config
Store *store.Config
Thumbnails *thumbnails.Config
WebDAV *webdav.Config
Settings *settings.Config
Store *store.Config
Runtime *pman.Config
}

// New initializes a new configuration with or without defaults.
func New() *Config {
return &Config{
Accounts: accounts.New(),
GLAuth: glauth.New(),
Graph: graph.New(),
GraphExplorer: graphExplorer.New(),
Hello: hello.New(),
Konnectd: konnectd.New(),
OCS: ocs.New(),
Onlyoffice: onlyoffice.New(),
Phoenix: phoenix.New(),
WebDAV: webdav.New(),
Storage: storage.New(),
GLAuth: glauth.New(),
Proxy: proxy.New(),
Thumbnails: thumbnails.New(),
Settings: settings.New(),
Storage: storage.New(),
Store: store.New(),
Thumbnails: thumbnails.New(),
WebDAV: webdav.New(),
Runtime: pman.NewConfig(),
}
}
15 changes: 8 additions & 7 deletions ocis/pkg/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ var (

// Extensions are ocis extension services
Extensions = []string{
"proxy",
"store",
"settings",
"phoenix",
"glauth",
"graph",
"graph-explorer",
"konnectd",
"ocs",
"webdav",
"onlyoffice",
"phoenix",
"proxy",
"settings",
"store",
"storage-frontend",
"storage-gateway",
"storage-userprovider",
Expand All @@ -50,9 +52,8 @@ var (
"storage-users",
"storage-metadata",
"storage-public-link",
"glauth",
"konnectd",
"thumbnails",
"webdav",
}

// There seem to be a race condition when reva-sharing needs to read the sharing.json file and the parent folder is not present.
Expand Down
8 changes: 8 additions & 0 deletions onlyoffice/.codacy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
exclude_paths:
- CHANGELOG.md
- changelog/**
- docs/**
- pkg/proto/**

...
Loading

0 comments on commit 75e41b4

Please sign in to comment.