Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1464 from OpenBazaar/fengzie
Browse files Browse the repository at this point in the history
Rebase: Fix issue: cannot create and save listing with full Chinese name
  • Loading branch information
cpacia committed Feb 25, 2019
2 parents c92e4d4 + f4a1073 commit 4f30cff
Show file tree
Hide file tree
Showing 35 changed files with 47,896 additions and 1,708 deletions.
24 changes: 14 additions & 10 deletions Godeps/Godeps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import (
peer "gx/ipfs/QmTRhk7cgjUf2gfQ3p2M9KPECNZEW9XUrmHcFCgog4cPgB/go-libp2p-peer"
"gx/ipfs/QmaRb5yNXKonhbkpNxNawoydk4N6es6b4fPj19sjEKsh5D/go-datastore"
routing "gx/ipfs/QmcQ81jSyWCp1jpkQ8CMbtpXT3jK7Wg6ZtYmoyWFgBoF9c/go-libp2p-routing"
"net/url"
"path"
"strings"
"sync"
"time"

Expand All @@ -23,9 +21,9 @@ import (
"github.com/OpenBazaar/openbazaar-go/repo"
sto "github.com/OpenBazaar/openbazaar-go/storage"
"github.com/btcsuite/btcutil/hdkeychain"
"github.com/gosimple/slug"
"github.com/ipfs/go-ipfs/core"
"github.com/kennygrant/sanitize"
"github.com/op/go-logging"
logging "github.com/op/go-logging"
"golang.org/x/net/context"
"golang.org/x/net/proxy"
)
Expand Down Expand Up @@ -308,11 +306,13 @@ func (n *OpenBazaarNode) IPFSIdentityString() string {
return n.IpfsNode.Identity.Pretty()
}

// createSlugFor Create a slug from a string
// createSlugFor Create a slug from a multi-lang string
func createSlugFor(slugName string) string {
l := SentenceMaxCharacters - SlugBuffer
if len(slugName) < SentenceMaxCharacters-SlugBuffer {
l = len(slugName)

slug := slug.Make(slugName)
if len(slug) < SentenceMaxCharacters-SlugBuffer {
l = len(slug)
}
return url.QueryEscape(sanitize.Path(strings.ToLower(slugName[:l])))
return slug[:l]
}
7 changes: 5 additions & 2 deletions mobile/config.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package mobile

import (
"github.com/OpenBazaar/wallet-interface"
"github.com/op/go-logging"
wallet "github.com/OpenBazaar/wallet-interface"
logging "github.com/op/go-logging"
)

var stdoutLogFormat = logging.MustStringFormatter(
`%{color:reset}%{color}%{time:15:04:05.000} [%{shortfunc}] [%{level}] %{message}`,
)
var fileLogFormat = logging.MustStringFormatter(
`%{time:15:04:05.000} [%{level}] [%{module}/%{shortfunc}] %{message}`,
)

var logger logging.Backend

Expand Down
20 changes: 16 additions & 4 deletions mobile/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"

dht "gx/ipfs/QmPpYHPRGVpSJTkQDQDwTYZ1cYUR2NM4HS6M3iAXi8aoUa/go-libp2p-kad-dht"
dhtopts "gx/ipfs/QmPpYHPRGVpSJTkQDQDwTYZ1cYUR2NM4HS6M3iAXi8aoUa/go-libp2p-kad-dht/opts"
ma "gx/ipfs/QmT4U94DnD8FRfqr21obWY32HLM5VExccPKMjQHofeYqr9/go-multiaddr"
Expand All @@ -15,6 +16,7 @@ import (
routing "gx/ipfs/QmcQ81jSyWCp1jpkQ8CMbtpXT3jK7Wg6ZtYmoyWFgBoF9c/go-libp2p-routing"
p2phost "gx/ipfs/QmdJfsSbKSZnMkfZ1kpopiyB9i3Hd6cp8VKWZmtWPa7Moc/go-libp2p-host"
proto "gx/ipfs/QmdxUuburamoF6zF9qjeQC4WYcWGbWuRmdLacMEsW8ioD8/gogo-protobuf/proto"

"io/ioutil"
"net/http"
"os"
Expand Down Expand Up @@ -50,8 +52,9 @@ import (
"github.com/ipfs/go-ipfs/core/corehttp"
"github.com/ipfs/go-ipfs/namesys"
"github.com/ipfs/go-ipfs/repo/fsrepo"
"github.com/op/go-logging"
"github.com/tyler-smith/go-bip39"
"github.com/natefinch/lumberjack"
logging "github.com/op/go-logging"
bip39 "github.com/tyler-smith/go-bip39"
)

// Node configuration structure
Expand Down Expand Up @@ -89,9 +92,18 @@ func NewNodeWithConfig(config *NodeConfig, password string, mnemonic string) (*N
os.Remove(repoLockFile)

// Logging
w := &lumberjack.Logger{
Filename: path.Join(config.RepoPath, "logs", "ob.log"),
MaxSize: 10, // Megabytes
MaxBackups: 3,
MaxAge: 30, // Days
}
backendFile := logging.NewLogBackend(w, "", 0)
backendFileFormatter := logging.NewBackendFormatter(backendFile, fileLogFormat)

backendStdout := logging.NewLogBackend(os.Stdout, "", 0)
logger = logging.NewBackendFormatter(backendStdout, stdoutLogFormat)
logging.SetBackend(logger)
backendStdoutFormatter := logging.NewBackendFormatter(backendStdout, stdoutLogFormat)
logging.SetBackend(backendFileFormatter, backendStdoutFormatter)

migrations.WalletCoinType = config.CoinType

Expand Down
62 changes: 0 additions & 62 deletions vendor/github.com/google/uuid/json_test.go

This file was deleted.

66 changes: 0 additions & 66 deletions vendor/github.com/google/uuid/seq_test.go

This file was deleted.

Loading

0 comments on commit 4f30cff

Please sign in to comment.