mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-07 12:50:21 -06:00
Merge branch 'master' into StoreSettingsViaMetadata
This commit is contained in:
28
CHANGELOG.md
28
CHANGELOG.md
@@ -2,7 +2,24 @@
|
||||
|
||||
The following sections list the changes for unreleased.
|
||||
|
||||
[unreleased]: https://github.com/owncloud/ocis/compare/v1.17.0...master
|
||||
[unreleased]: https://github.com/owncloud/ocis/compare/v1.18.0...master
|
||||
|
||||
## Summary
|
||||
|
||||
* Enhancement - Include etags in drives listing: [#3267](https://github.com/owncloud/ocis/pull/3267)
|
||||
|
||||
## Details
|
||||
|
||||
* Enhancement - Include etags in drives listing: [#3267](https://github.com/owncloud/ocis/pull/3267)
|
||||
|
||||
Added etags in the response of list drives.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/3267
|
||||
# Changelog for [1.18.0] (2022-03-03)
|
||||
|
||||
The following sections list the changes for 1.18.0.
|
||||
|
||||
[1.18.0]: https://github.com/owncloud/ocis/compare/v1.17.0...v1.18.0
|
||||
|
||||
## Summary
|
||||
|
||||
@@ -15,7 +32,6 @@ The following sections list the changes for unreleased.
|
||||
* Enhancement - Re-Enabling web cache control: [#3109](https://github.com/owncloud/ocis/pull/3109)
|
||||
* Enhancement - Add SPA conform fileserver for web: [#3109](https://github.com/owncloud/ocis/pull/3109)
|
||||
* Enhancement - Implement notifications service: [#3217](https://github.com/owncloud/ocis/pull/3217)
|
||||
* Enhancement - Include etags in drives listing: [#3267](https://github.com/owncloud/ocis/pull/3267)
|
||||
* Enhancement - Thumbnails in spaces: [#3219](https://github.com/owncloud/ocis/pull/3219)
|
||||
* Enhancement - Update reva to v2.0.0: [#3231](https://github.com/owncloud/ocis/pull/3231)
|
||||
* Enhancement - Update ownCloud Web to v5.2.0: [#6506](https://github.com/owncloud/web/pull/6506)
|
||||
@@ -93,12 +109,6 @@ The following sections list the changes for unreleased.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/3217
|
||||
|
||||
* Enhancement - Include etags in drives listing: [#3267](https://github.com/owncloud/ocis/pull/3267)
|
||||
|
||||
Added etags in the response of list drives.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/3267
|
||||
|
||||
* Enhancement - Thumbnails in spaces: [#3219](https://github.com/owncloud/ocis/pull/3219)
|
||||
|
||||
Added support for thumbnails in spaces.
|
||||
@@ -204,7 +214,7 @@ The following sections list the changes for unreleased.
|
||||
* Enh [cs3org/reva#2526](https://github.com/cs3org/reva/pull/2526) : Upgrade ginkgo to v2
|
||||
|
||||
https://github.com/owncloud/ocis/pull/3231
|
||||
https://github.com/owncloud/ocis/pull/3231
|
||||
https://github.com/owncloud/ocis/pull/3258
|
||||
|
||||
* Enhancement - Update ownCloud Web to v5.2.0: [#6506](https://github.com/owncloud/web/pull/6506)
|
||||
|
||||
|
||||
@@ -96,5 +96,4 @@ We updated reva to the version 2.0.0.
|
||||
* Enh [cs3org/reva#2526](https://github.com/cs3org/reva/pull/2526) : Upgrade ginkgo to v2
|
||||
|
||||
https://github.com/owncloud/ocis/pull/3231
|
||||
https://github.com/owncloud/ocis/pull/3231
|
||||
|
||||
https://github.com/owncloud/ocis/pull/3258
|
||||
@@ -1,20 +1,16 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/cs3org/reva/v2/pkg/events/server"
|
||||
"github.com/oklog/run"
|
||||
|
||||
"github.com/owncloud/ocis/nats/pkg/config"
|
||||
"github.com/owncloud/ocis/nats/pkg/config/parser"
|
||||
"github.com/owncloud/ocis/nats/pkg/logging"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
"github.com/owncloud/ocis/nats/pkg/server/nats"
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
// TODO: .Logger Option on events/server would make this import redundant
|
||||
stanServer "github.com/nats-io/nats-streaming-server/server"
|
||||
)
|
||||
|
||||
// Server is the entrypoint for the server command.
|
||||
@@ -28,65 +24,45 @@ func Server(cfg *config.Config) *cli.Command {
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
logger := logging.Configure(cfg.Service.Name, cfg.Log)
|
||||
ch := make(chan os.Signal, 1)
|
||||
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM)
|
||||
err := server.RunNatsServer(server.Host(cfg.Nats.Host), server.Port(cfg.Nats.Port), server.StanOpts(func(o *stanServer.Options) {
|
||||
o.CustomLogger = &logWrapper{logger}
|
||||
}))
|
||||
|
||||
gr := run.Group{}
|
||||
ctx, cancel := func() (context.Context, context.CancelFunc) {
|
||||
if cfg.Context == nil {
|
||||
return context.WithCancel(context.Background())
|
||||
}
|
||||
return context.WithCancel(cfg.Context)
|
||||
}()
|
||||
|
||||
defer cancel()
|
||||
|
||||
natsServer, err := nats.NewNATSServer(
|
||||
ctx,
|
||||
nats.Host(cfg.Nats.Host),
|
||||
nats.Port(cfg.Nats.Port),
|
||||
nats.Logger(logging.NewLogWrapper(logger)),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for {
|
||||
|
||||
gr.Add(func() error {
|
||||
err := make(chan error)
|
||||
select {
|
||||
case <-ch:
|
||||
// TODO: Should we shut down the NatsServer in a proper way here?
|
||||
// That would require a reference to the StanServer instance for being able to call
|
||||
// StanServer.Shutdown() github.com/cs3org/reva/pkg/events/server doesn't provide that
|
||||
// currently
|
||||
case <-ctx.Done():
|
||||
return nil
|
||||
case err <- natsServer.ListenAndServe():
|
||||
return <-err
|
||||
}
|
||||
}
|
||||
|
||||
}, func(_ error) {
|
||||
logger.Info().
|
||||
Msg("Shutting down server")
|
||||
|
||||
natsServer.Shutdown()
|
||||
cancel()
|
||||
})
|
||||
|
||||
return gr.Run()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// we need to wrap our logger so we can pass it to the nats server
|
||||
type logWrapper struct {
|
||||
logger log.Logger
|
||||
}
|
||||
|
||||
// Noticef logs a notice statement
|
||||
func (l *logWrapper) Noticef(format string, v ...interface{}) {
|
||||
msg := fmt.Sprintf(format, v...)
|
||||
l.logger.Info().Msg(msg)
|
||||
}
|
||||
|
||||
// Warnf logs a warning statement
|
||||
func (l *logWrapper) Warnf(format string, v ...interface{}) {
|
||||
msg := fmt.Sprintf(format, v...)
|
||||
l.logger.Warn().Msg(msg)
|
||||
}
|
||||
|
||||
// Fatalf logs a fatal statement
|
||||
func (l *logWrapper) Fatalf(format string, v ...interface{}) {
|
||||
msg := fmt.Sprintf(format, v...)
|
||||
l.logger.Fatal().Msg(msg)
|
||||
}
|
||||
|
||||
// Errorf logs an error statement
|
||||
func (l *logWrapper) Errorf(format string, v ...interface{}) {
|
||||
msg := fmt.Sprintf(format, v...)
|
||||
l.logger.Error().Msg(msg)
|
||||
}
|
||||
|
||||
// Debugf logs a debug statement
|
||||
func (l *logWrapper) Debugf(format string, v ...interface{}) {
|
||||
msg := fmt.Sprintf(format, v...)
|
||||
l.logger.Debug().Msg(msg)
|
||||
}
|
||||
|
||||
// Tracef logs a trace statement
|
||||
func (l *logWrapper) Tracef(format string, v ...interface{}) {
|
||||
msg := fmt.Sprintf(format, v...)
|
||||
l.logger.Trace().Msg(msg)
|
||||
}
|
||||
|
||||
52
nats/pkg/logging/nats.go
Normal file
52
nats/pkg/logging/nats.go
Normal file
@@ -0,0 +1,52 @@
|
||||
package logging
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
)
|
||||
|
||||
func NewLogWrapper(logger log.Logger) *LogWrapper {
|
||||
return &LogWrapper{logger}
|
||||
}
|
||||
|
||||
// we need to wrap our logger so we can pass it to the nats server
|
||||
type LogWrapper struct {
|
||||
logger log.Logger
|
||||
}
|
||||
|
||||
// Noticef logs a notice statement
|
||||
func (l *LogWrapper) Noticef(format string, v ...interface{}) {
|
||||
msg := fmt.Sprintf(format, v...)
|
||||
l.logger.Info().Msg(msg)
|
||||
}
|
||||
|
||||
// Warnf logs a warning statement
|
||||
func (l *LogWrapper) Warnf(format string, v ...interface{}) {
|
||||
msg := fmt.Sprintf(format, v...)
|
||||
l.logger.Warn().Msg(msg)
|
||||
}
|
||||
|
||||
// Fatalf logs a fatal statement
|
||||
func (l *LogWrapper) Fatalf(format string, v ...interface{}) {
|
||||
msg := fmt.Sprintf(format, v...)
|
||||
l.logger.Fatal().Msg(msg)
|
||||
}
|
||||
|
||||
// Errorf logs an error statement
|
||||
func (l *LogWrapper) Errorf(format string, v ...interface{}) {
|
||||
msg := fmt.Sprintf(format, v...)
|
||||
l.logger.Error().Msg(msg)
|
||||
}
|
||||
|
||||
// Debugf logs a debug statement
|
||||
func (l *LogWrapper) Debugf(format string, v ...interface{}) {
|
||||
msg := fmt.Sprintf(format, v...)
|
||||
l.logger.Debug().Msg(msg)
|
||||
}
|
||||
|
||||
// Tracef logs a trace statement
|
||||
func (l *LogWrapper) Tracef(format string, v ...interface{}) {
|
||||
msg := fmt.Sprintf(format, v...)
|
||||
l.logger.Trace().Msg(msg)
|
||||
}
|
||||
69
nats/pkg/server/nats/nats.go
Normal file
69
nats/pkg/server/nats/nats.go
Normal file
@@ -0,0 +1,69 @@
|
||||
package nats
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
natsServer "github.com/nats-io/nats-server/v2/server"
|
||||
stanServer "github.com/nats-io/nats-streaming-server/server"
|
||||
)
|
||||
|
||||
var NATSListenAndServeLoopTimer = 1 * time.Second
|
||||
|
||||
type NATSServer struct {
|
||||
ctx context.Context
|
||||
|
||||
natsOpts *natsServer.Options
|
||||
stanOpts *stanServer.Options
|
||||
|
||||
server *stanServer.StanServer
|
||||
}
|
||||
|
||||
// NewNATSServer returns a new NATSServer
|
||||
func NewNATSServer(ctx context.Context, opts ...Option) (*NATSServer, error) {
|
||||
|
||||
server := &NATSServer{
|
||||
ctx: ctx,
|
||||
natsOpts: &stanServer.DefaultNatsServerOptions,
|
||||
stanOpts: stanServer.GetDefaultOptions(),
|
||||
}
|
||||
|
||||
for _, o := range opts {
|
||||
o(server.natsOpts, server.stanOpts)
|
||||
}
|
||||
|
||||
return server, nil
|
||||
}
|
||||
|
||||
// ListenAndServe runs the NATSServer in a blocking way until the server is shutdown or an error occurs
|
||||
func (n *NATSServer) ListenAndServe() (err error) {
|
||||
n.server, err = stanServer.RunServerWithOpts(
|
||||
n.stanOpts,
|
||||
n.natsOpts,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer n.Shutdown()
|
||||
|
||||
for {
|
||||
// check if NATs server has an encountered an error
|
||||
if err := n.server.LastError(); err != nil {
|
||||
return err
|
||||
}
|
||||
// check if the NATs server is still running
|
||||
if n.server.State() == stanServer.Shutdown {
|
||||
return nil
|
||||
}
|
||||
// check if context was cancelled
|
||||
if n.ctx.Err() != nil {
|
||||
return nil
|
||||
}
|
||||
time.Sleep(NATSListenAndServeLoopTimer)
|
||||
}
|
||||
}
|
||||
|
||||
func (n *NATSServer) Shutdown() {
|
||||
n.server.Shutdown()
|
||||
}
|
||||
31
nats/pkg/server/nats/options.go
Normal file
31
nats/pkg/server/nats/options.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package nats
|
||||
|
||||
import (
|
||||
natsServer "github.com/nats-io/nats-server/v2/server"
|
||||
"github.com/nats-io/nats-streaming-server/logger"
|
||||
stanServer "github.com/nats-io/nats-streaming-server/server"
|
||||
)
|
||||
|
||||
// Option configures the nats server
|
||||
type Option func(*natsServer.Options, *stanServer.Options)
|
||||
|
||||
// Host sets the host URL for the nats server
|
||||
func Host(url string) Option {
|
||||
return func(no *natsServer.Options, _ *stanServer.Options) {
|
||||
no.Host = url
|
||||
}
|
||||
}
|
||||
|
||||
// Port sets the host URL for the nats server
|
||||
func Port(port int) Option {
|
||||
return func(no *natsServer.Options, _ *stanServer.Options) {
|
||||
no.Port = port
|
||||
}
|
||||
}
|
||||
|
||||
// Port sets the host URL for the nats server
|
||||
func Logger(logger logger.Logger) Option {
|
||||
return func(no *natsServer.Options, so *stanServer.Options) {
|
||||
so.CustomLogger = logger
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@
|
||||
"eslint-plugin-vue": "^7.8.0",
|
||||
"fs-extra": "^10.0.0",
|
||||
"join-path": "^1.1.1",
|
||||
"ldapjs": "^2.2.4",
|
||||
"ldapjs": "^2.3.2",
|
||||
"lodash-es": "^4.17.21",
|
||||
"nightwatch": "1.7.11",
|
||||
"nightwatch-api": "3.0.2",
|
||||
@@ -69,7 +69,7 @@
|
||||
"rollup": "^2.55.1",
|
||||
"rollup-plugin-babel": "^4.3.3",
|
||||
"rollup-plugin-eslint": "^7.0.0",
|
||||
"rollup-plugin-filesize": "^9.1.0",
|
||||
"rollup-plugin-filesize": "^9.1.2",
|
||||
"rollup-plugin-node-globals": "^1.4.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
|
||||
@@ -2708,7 +2708,7 @@ colorette@^1.2.2:
|
||||
resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.3.0.tgz#ff45d2f0edb244069d3b772adeb04fed38d0a0af"
|
||||
integrity sha512-ecORCqbSFP7Wm8Y6lyqMJjexBQqXSF7SSeaTyGGphogUjBlFP9m9o08wy86HL2uB7fMTxtOUzLMk7ogKcxMg1w==
|
||||
|
||||
colors@^1.1.2, colors@^1.4.0:
|
||||
colors@1.4.0, colors@^1.1.2, colors@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78"
|
||||
integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==
|
||||
@@ -5066,10 +5066,10 @@ ldap-filter@^0.3.3:
|
||||
dependencies:
|
||||
assert-plus "^1.0.0"
|
||||
|
||||
ldapjs@^2.2.4:
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/ldapjs/-/ldapjs-2.3.1.tgz#04136815fb1f21d692ac87fab5961a04d86e8b04"
|
||||
integrity sha512-kf0tHHLrpwKaBAQOhYHXgdeh2PkFuCCxWgLb1MRn67ZQVo787D2pij3mmHVZx193GIdM8xcfi8HF6AIYYnj0fQ==
|
||||
ldapjs@^2.3.2:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/ldapjs/-/ldapjs-2.3.2.tgz#a599d081519f70462941cc33a50e9354c32f35b7"
|
||||
integrity sha512-FU+GR/qbQ96WUZ2DUb7FzaEybYvv3240wTVPcbsdELB3o4cK92zGVjntsh68siVkLeCmlCcsd/cIQzyGXSS7LA==
|
||||
dependencies:
|
||||
abstract-logging "^2.0.0"
|
||||
asn1 "^0.2.4"
|
||||
@@ -7158,15 +7158,15 @@ rollup-plugin-eslint@^7.0.0:
|
||||
eslint "^6.0.0"
|
||||
rollup-pluginutils "^2.7.1"
|
||||
|
||||
rollup-plugin-filesize@^9.1.0:
|
||||
version "9.1.1"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-filesize/-/rollup-plugin-filesize-9.1.1.tgz#31a6b02b27ce08082ef0970cfe4c451714ff91c4"
|
||||
integrity sha512-x0r2A85TCEdRwF3rm+bcN4eAmbER8tt+YVf88gBQ6sLyH4oGcnNLPQqAUX+v7mIvHC/y59QwZvo6vxaC2ias6Q==
|
||||
rollup-plugin-filesize@^9.1.2:
|
||||
version "9.1.2"
|
||||
resolved "https://registry.yarnpkg.com/rollup-plugin-filesize/-/rollup-plugin-filesize-9.1.2.tgz#958eea26880698d0bc008fa9d214657ee180b934"
|
||||
integrity sha512-m2fE9hFaKgWKisJzyWXctOFKlgMRelo/58HgeC0lXUK/qykxiqkr6bsrotlvo2bvrwPsjgT7scNdQSr6qtl37A==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.13.8"
|
||||
boxen "^5.0.0"
|
||||
brotli-size "4.0.0"
|
||||
colors "^1.4.0"
|
||||
colors "1.4.0"
|
||||
filesize "^6.1.0"
|
||||
gzip-size "^6.0.0"
|
||||
pacote "^11.2.7"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
sonar.projectKey=owncloud_ocis
|
||||
sonar.organization=owncloud-1
|
||||
sonar.projectName=ocis
|
||||
sonar.projectVersion=1.17.0
|
||||
sonar.projectVersion=1.18.0
|
||||
sonar.host.url=https://sonarcloud.io
|
||||
|
||||
# =====================================================
|
||||
|
||||
Reference in New Issue
Block a user