Skip to content

Commit

Permalink
Fix #91 #97
Browse files Browse the repository at this point in the history
  • Loading branch information
mdouchement committed Sep 2, 2023
1 parent ccfd7f0 commit 9a38fa1
Show file tree
Hide file tree
Showing 20 changed files with 128 additions and 1,105 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches and tags
#
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
go-version: ${{ env.GO_VERSION }}
check-latest: true
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
cp task /usr/local/bin/
#
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
#
- name: Build binaries
run: task build-all
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
- name: Tooling
run: go install gotest.tools/gotestsum@latest
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Test
run: gotestsum
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ sfc.log
auth_params.json
items_*.json
notes_*.json
subscription.json
features.json
dist/
TODO.md
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Yet Another Standardfile Implementation in Go

This project is **maintained for the basic features** as encrypted notes because on its own it already takes hours to figure out what is the issue when a breaking change or bug happens (e.g. [#87](https://github.com/mdouchement/standardfile/issues/87)).

People's pull requests that implement or fix extra features (revision, file storage, etc.) will be gladly reviewed and merged.

<hr>

[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg)](https://pkg.go.dev/github.com/mdouchement/standardfile)
[![Go Report Card](https://goreportcard.com/badge/github.com/mdouchement/standardfile)](https://goreportcard.com/report/github.com/mdouchement/standardfile)
[![License](https://img.shields.io/github/license/mdouchement/standardfile.svg)](http://opensource.org/licenses/MIT)
Expand Down
2 changes: 1 addition & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
version: '3'

vars:
VERSION: 0.11.0
VERSION: 0.12.0
REVISION: { sh: git rev-parse HEAD }
WORKDIR: { sh: pwd }

Expand Down
18 changes: 16 additions & 2 deletions cmd/standardfile/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"runtime"
"strings"

"github.com/knadh/koanf"
"github.com/knadh/koanf/parsers/yaml"
"github.com/knadh/koanf/providers/file"
"github.com/knadh/koanf/v2"
"github.com/mdouchement/standardfile/internal/database"
"github.com/mdouchement/standardfile/internal/server"
"github.com/pkg/errors"
Expand Down Expand Up @@ -166,12 +166,26 @@ var (
}
defer db.Close()

var subscription, features []byte
if konf.String("subscription_file") != "" {
subscription, err = os.ReadFile(konf.String("subscription_file"))
if err != nil {
return errors.Wrap(err, "could not read subscription_file")
}

features, err = os.ReadFile(konf.String("features_file"))
if err != nil {
return errors.Wrap(err, "could not read features_file")
}
}

engine := server.EchoEngine(server.Controller{
Version: version,
Database: db,
NoRegistration: konf.Bool("no_registration"),
ShowRealVersion: konf.Bool("show_real_version"),
EnableSubscription: konf.Bool("enable_subscription"),
SubscriptionPayload: subscription,
FeaturesPayload: features,
SigningKey: configSecretKey,
SessionSecret: kdf(32, configSessionSecret),
AccessTokenExpirationTime: konf.MustDuration("session.access_token_ttl"),
Expand Down
24 changes: 13 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ require (
github.com/gofrs/uuid v4.4.0+incompatible
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/golang-jwt/jwt/v5 v5.0.0
github.com/knadh/koanf v1.5.0
github.com/knadh/koanf/parsers/yaml v0.1.0
github.com/knadh/koanf/providers/file v0.1.0
github.com/knadh/koanf/v2 v2.0.1
github.com/labstack/echo-jwt/v4 v4.2.0
github.com/labstack/echo/v4 v4.11.0
github.com/labstack/echo/v4 v4.11.1
github.com/mdouchement/middlewarex v0.3.4
github.com/mdouchement/simple-argon2 v0.1.5
github.com/o1egl/paseto/v2 v2.1.1
Expand All @@ -25,11 +27,11 @@ require (
github.com/sanity-io/litter v1.5.5
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.7.0
github.com/stretchr/testify v1.8.1
github.com/stretchr/testify v1.8.4
github.com/ugorji/go/codec v1.2.11
github.com/valyala/fastjson v1.6.4
github.com/xwb1989/sqlparser v0.0.0-20180606152119-120387863bf2
golang.org/x/crypto v0.11.0
golang.org/x/crypto v0.12.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
)

Expand All @@ -38,28 +40,28 @@ require (
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gdamore/encoding v1.0.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/knadh/koanf/maps v0.1.1 // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
go.etcd.io/bbolt v1.3.7 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
Loading

0 comments on commit 9a38fa1

Please sign in to comment.