Skip to content

Commit

Permalink
Merge pull request #99 from owncloud/maintanence
Browse files Browse the repository at this point in the history
Maintanence
  • Loading branch information
C0rby authored Jan 26, 2021
2 parents db33b08 + f284156 commit 8104c07
Show file tree
Hide file tree
Showing 22 changed files with 229 additions and 56 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-api-path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Fix api path

The server path coming from ownCloud Web now has an enforced trailing slash.
Concatenating the api path to the server path resulted in a path containing a double slash.

https://github.com/owncloud/ocis-hello/pull/99
File renamed without changes.
6 changes: 6 additions & 0 deletions changelog/unreleased/update-ocis-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Change: update ocis-pkg and ocis settings

ocis-pkg and ocis settings have been moved to the ocis mono-repo.

https://github.com/owncloud/ocis/pull/593
https://github.com/owncloud/ocis-hello/pull/99
File renamed without changes.
18 changes: 8 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,29 @@ require (
github.com/cespare/reflex v0.2.0
github.com/go-chi/chi v4.1.2+incompatible
github.com/go-chi/render v1.0.1
github.com/golang/protobuf v1.4.2
github.com/golang/protobuf v1.4.3
github.com/grpc-ecosystem/grpc-gateway v1.14.6
github.com/haya14busa/goverage v0.0.0-20180129164344-eec3514a20b5
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/kr/pty v1.1.8 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/micro/cli/v2 v2.1.2
github.com/micro/go-micro/v2 v2.9.1
github.com/mitchellh/gox v1.0.1
github.com/ogier/pflag v0.0.1 // indirect
github.com/oklog/run v1.1.0
github.com/openzipkin/zipkin-go v0.2.2
github.com/owncloud/ocis-pkg/v2 v2.4.0
github.com/owncloud/ocis-settings v0.3.2-0.20200827193534-8caf098e6537
github.com/owncloud/ocis/ocis-pkg v0.0.0-20210126115657-daceb0279a1c
github.com/owncloud/ocis/settings v0.0.0-20210126115657-daceb0279a1c
github.com/prometheus/client_golang v1.7.1
github.com/restic/calens v0.2.0
github.com/spf13/viper v1.6.3
github.com/spf13/viper v1.7.0
github.com/stretchr/testify v1.6.1
go.opencensus.io v0.22.4
go.opencensus.io v0.22.5
golang.org/x/lint v0.0.0-20200302205851-738671d3881b
golang.org/x/net v0.0.0-20200625001655-4c5254603344
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884
google.golang.org/protobuf v1.23.0
golang.org/x/net v0.0.0-20200822124328-c89045814202
google.golang.org/genproto v0.0.0-20200624020401-64a14ca9d1ad
google.golang.org/protobuf v1.25.0
honnef.co/go/tools v0.0.1-2020.1.5
)

Expand Down
183 changes: 171 additions & 12 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/assets/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"path"

"github.com/owncloud/ocis-hello/pkg/config"
"github.com/owncloud/ocis-pkg/v2/log"
"github.com/owncloud/ocis/ocis-pkg/log"
)

//go:generate go run github.com/UnnoTed/fileb0x embed.yml
Expand Down
6 changes: 3 additions & 3 deletions pkg/assets/embed.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/assets/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package assets

import (
"github.com/owncloud/ocis-hello/pkg/config"
"github.com/owncloud/ocis-pkg/v2/log"
"github.com/owncloud/ocis/ocis-pkg/log"
)

// Option defines a single option function.
Expand Down
2 changes: 1 addition & 1 deletion pkg/command/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/owncloud/ocis-hello/pkg/config"
"github.com/owncloud/ocis-hello/pkg/flagset"
"github.com/owncloud/ocis-hello/pkg/version"
"github.com/owncloud/ocis-pkg/v2/log"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/spf13/viper"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/metrics/option.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package metrics

import (
"github.com/owncloud/ocis-pkg/v2/log"
"github.com/owncloud/ocis/ocis-pkg/log"
)

// 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
Logger log.Logger
}

// newOptions initializes the available default options.
Expand Down
6 changes: 3 additions & 3 deletions pkg/proto/v0/hello.pb.micro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"

"github.com/owncloud/ocis-hello/pkg/proto/v0"
"github.com/owncloud/ocis-pkg/v2/service/grpc"
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
"github.com/stretchr/testify/assert"

svc "github.com/owncloud/ocis-hello/pkg/service/v0"
Expand Down Expand Up @@ -116,7 +116,7 @@ func TestWrongService(t *testing.T) {

for _, testCase := range tests {
t.Run(testCase, func(t *testing.T) {
request := proto.GreetRequest{Name: "Milan",}
request := proto.GreetRequest{Name: "Milan"}
client := service.Client()
cl := proto.NewHelloService(testCase, client)
response, err := cl.Greet(context.Background(), &request)
Expand All @@ -125,7 +125,7 @@ func TestWrongService(t *testing.T) {
var errorData ErrorMessage
json.Unmarshal([]byte(err.Error()), &errorData)
assert.Equal(t, 500, errorData.Code)
assert.Equal(t, "service " + testCase + ": not found", errorData.Detail)
assert.Equal(t, "service "+testCase+": not found", errorData.Detail)
assert.Equal(t, "Internal Server Error", errorData.Status)
})
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/debug/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"

"github.com/owncloud/ocis-hello/pkg/config"
"github.com/owncloud/ocis-pkg/v2/log"
"github.com/owncloud/ocis/ocis-pkg/log"
)

// Option defines a single option function.
Expand Down
4 changes: 2 additions & 2 deletions pkg/server/debug/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"net/http"

"github.com/owncloud/ocis-hello/pkg/version"
"github.com/owncloud/ocis-pkg/v2/log"
"github.com/owncloud/ocis-pkg/v2/service/debug"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/ocis-pkg/service/debug"
)

// Server initializes the debug service and server.
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/grpc/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis-hello/pkg/config"
"github.com/owncloud/ocis-hello/pkg/metrics"
"github.com/owncloud/ocis-pkg/v2/log"
"github.com/owncloud/ocis/ocis-pkg/log"
)

// Option defines a single option function.
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/grpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/owncloud/ocis-hello/pkg/proto/v0"
svc "github.com/owncloud/ocis-hello/pkg/service/v0"
"github.com/owncloud/ocis-hello/pkg/version"
"github.com/owncloud/ocis-pkg/v2/service/grpc"
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
)

// Server initializes the grpc service and server.
Expand Down
12 changes: 6 additions & 6 deletions pkg/server/http/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis-hello/pkg/config"
"github.com/owncloud/ocis-hello/pkg/metrics"
"github.com/owncloud/ocis-pkg/v2/log"
"github.com/owncloud/ocis/ocis-pkg/log"
)

// Option defines a single option function.
Expand All @@ -15,11 +15,11 @@ 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
Logger log.Logger
Context context.Context
Config *config.Config
Metrics *metrics.Metrics
Flags []cli.Flag
}

// newOptions initializes the available default options.
Expand Down
13 changes: 8 additions & 5 deletions pkg/server/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"github.com/owncloud/ocis-hello/pkg/proto/v0"
svc "github.com/owncloud/ocis-hello/pkg/service/v0"
"github.com/owncloud/ocis-hello/pkg/version"
"github.com/owncloud/ocis-pkg/v2/account"
"github.com/owncloud/ocis-pkg/v2/middleware"
"github.com/owncloud/ocis-pkg/v2/service/http"
"github.com/owncloud/ocis/ocis-pkg/account"
"github.com/owncloud/ocis/ocis-pkg/middleware"
"github.com/owncloud/ocis/ocis-pkg/service/http"
)

// Server initializes the http service and server.
Expand Down Expand Up @@ -37,7 +37,7 @@ func Server(opts ...Option) http.Service {

mux.Use(middleware.RealIP)
mux.Use(middleware.RequestID)
mux.Use(middleware.Cache)
mux.Use(middleware.NoCache)
mux.Use(middleware.Cors)
mux.Use(middleware.Secure)
mux.Use(middleware.ExtractAccountUUID(
Expand All @@ -60,7 +60,10 @@ func Server(opts ...Option) http.Service {
assets.Logger(options.Logger),
assets.Config(options.Config),
),
))
// Currently this option does not affect anything but might again in the future
// when the static middleware implements caching again.
// TTL = 7 days in seconds = 60 * 60 * 24 * 7
604800))

mux.Route(options.Config.HTTP.Root, func(r chi.Router) {
proto.RegisterHelloWeb(r, handle)
Expand Down
2 changes: 1 addition & 1 deletion pkg/service/v0/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"

v0proto "github.com/owncloud/ocis-hello/pkg/proto/v0"
"github.com/owncloud/ocis-pkg/v2/log"
"github.com/owncloud/ocis/ocis-pkg/log"
)

// NewLogging returns a service that logs messages.
Expand Down
8 changes: 4 additions & 4 deletions pkg/service/v0/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (

mclient "github.com/micro/go-micro/v2/client"
v0proto "github.com/owncloud/ocis-hello/pkg/proto/v0"
olog "github.com/owncloud/ocis-pkg/v2/log"
"github.com/owncloud/ocis-pkg/v2/middleware"
settings "github.com/owncloud/ocis-settings/pkg/proto/v0"
ssvc "github.com/owncloud/ocis-settings/pkg/service/v0"
olog "github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/ocis-pkg/middleware"
settings "github.com/owncloud/ocis/settings/pkg/proto/v0"
ssvc "github.com/owncloud/ocis/settings/pkg/service/v0"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions ui/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const state = {

const getters = {
config: state => state.config,
message: state => state.message
message: state => state.message,
getServerForJsClient: (state, getters, rootState, rootGetters) => rootGetters.configuration.server.replace(/\/$/, '')
}

const actions = {
Expand All @@ -21,7 +22,7 @@ const actions = {
submitName ({ commit, dispatch, getters, rootGetters }, value) {
injectAuthToken(rootGetters)
Hello_Greet({
$domain: rootGetters.configuration.server,
$domain: getters.getServerForJsClient,
body: { name: value }
})
.then(response => {
Expand Down

0 comments on commit 8104c07

Please sign in to comment.