Skip to content

Commit

Permalink
Revert "Add packaging for commentapi"
Browse files Browse the repository at this point in the history
This reverts commit 3b4b688.
  • Loading branch information
tiger5226 committed Jan 12, 2022
1 parent 4a549d1 commit c37ecf1
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 241 deletions.
2 changes: 1 addition & 1 deletion commentapi/api.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package commentapi

import "github.com/lbryio/lbry.go/v2/extras/api"
import "github.com/lbryio/lbry.go/extras/api"

// Validator for api arguments that should have some checks applied for every request.
type Validator interface {
Expand Down
2 changes: 1 addition & 1 deletion commentapi/blocked_lists.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/volatiletech/null"

"github.com/lbryio/commentron/commentapi/validator"
"github.com/lbryio/commentron/validator"

"github.com/lbryio/lbry.go/v2/extras/api"
"github.com/lbryio/lbry.go/v2/extras/errors"
Expand Down
2 changes: 1 addition & 1 deletion commentapi/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"time"

"github.com/lbryio/commentron/commentapi/lbry"
"github.com/lbryio/commentron/server/lbry"

"github.com/fatih/structs"
"github.com/lbryio/lbry.go/v2/extras/errors"
Expand Down
2 changes: 1 addition & 1 deletion commentapi/comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http"
"regexp"

"github.com/lbryio/commentron/commentapi/validator"
"github.com/lbryio/commentron/validator"
"github.com/lbryio/lbry.go/v2/extras/api"
"github.com/lbryio/lbry.go/v2/extras/errors"
v "github.com/lbryio/ozzo-validation"
Expand Down
34 changes: 0 additions & 34 deletions commentapi/go.mod

This file was deleted.

168 changes: 0 additions & 168 deletions commentapi/go.sum

This file was deleted.

10 changes: 0 additions & 10 deletions commentapi/helper/bytes.go

This file was deleted.

21 changes: 0 additions & 21 deletions commentapi/lbry/validator.go

This file was deleted.

4 changes: 2 additions & 2 deletions commentapi/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package commentapi
import (
"net/http"

"github.com/lbryio/commentron/commentapi/validator"
"github.com/lbryio/commentron/validator"

"github.com/lbryio/lbry.go/v2/extras/api"
"github.com/lbryio/lbry.go/extras/api"
"github.com/lbryio/lbry.go/v2/extras/errors"
v "github.com/lbryio/ozzo-validation"
)
Expand Down
40 changes: 40 additions & 0 deletions commentapi/test/comment.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package main

import (
"github.com/lbryio/commentron/commentapi"
"github.com/lbryio/commentron/env"
"github.com/sirupsen/logrus"
)

func main() {
conf, err := env.NewWithEnvVars() //
if err != nil {
logrus.Panic(err)
}
testCommenting(conf)
testReacting(conf)
}

func testReacting(conf *env.Config) {
c := commentapi.NewClient(conf.TestURL).WithSigning(conf.TestChannel)
_, err := c.ReactionReact(commentapi.ReactArgs{
CommentIDs: "0000125eb5349851d3aecfef344092e801a3b84ea5ab055158d2911b3b96dd57",
Type: "like",
})
if err != nil {
logrus.Error(err)
}
}

func testCommenting(conf *env.Config) {
c := commentapi.NewClient(conf.TestURL).WithSigning(conf.TestChannel)
_, err := c.CommentCreate(commentapi.CreateArgs{
CommentText: "Can I create comments?",
ClaimID: "ca1ab0d129060ad12774b239976fd3379d571846",
ChannelID: c.Channel.ChannelID,
ChannelName: c.Channel.Name,
})
if err != nil {
logrus.Error(err)
}
}
4 changes: 2 additions & 2 deletions commentapi/lbry/channel.go → server/lbry/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strconv"
"time"

"github.com/lbryio/commentron/commentapi/helper"
"github.com/lbryio/commentron/helper"

"github.com/sirupsen/logrus"

Expand Down Expand Up @@ -93,7 +93,7 @@ func (l *Channel) Sign(data []byte) (string, string, error) {
timestamp := strconv.FormatInt(time.Now().Unix(), 10)
hash := sha256.Sum256(helper.CreateDigest(
[]byte(timestamp),
UnhelixifyAndReverse(l.ChannelID),
unhelixifyAndReverse(l.ChannelID),
data))
hashBytes := make([]byte, len(hash))
for i, b := range hash {
Expand Down
File renamed without changes.

0 comments on commit c37ecf1

Please sign in to comment.