Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xxdk-wasm
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
xxdk-wasm
Commits
0448bb99
Commit
0448bb99
authored
2 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Add some logging
parent
ef50518a
No related branches found
No related tags found
2 merge requests
!67
fix for latest client release
,
!61
Add emoji sanitizater
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
emoji/emojiSet.go
+5
-0
5 additions, 0 deletions
emoji/emojiSet.go
emoji/main.go
+8
-0
8 additions, 0 deletions
emoji/main.go
with
13 additions
and
0 deletions
emoji/emojiSet.go
+
5
−
0
View file @
0448bb99
...
...
@@ -11,6 +11,7 @@ import (
"encoding/json"
"github.com/forPelevin/gomoji"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
cEmoji
"gitlab.com/elixxir/client/v4/emoji"
"strings"
)
...
...
@@ -54,9 +55,13 @@ func (s *Set) SanitizeEmojiMartSet(frontendEmojiSetJson []byte) ([]byte, error)
"failed to unmarshal emoji-mart set JSON: %+v"
,
err
)
}
jww
.
INFO
.
Printf
(
"Finding incompatible emojis..."
)
// Find all incompatible emojis in the front end set
emojisToRemove
:=
s
.
findIncompatibleEmojis
(
&
frontEndEmojiSet
)
jww
.
INFO
.
Printf
(
"Removing incompatible emojis..."
)
// Remove all incompatible emojis from the set
removeIncompatibleEmojis
(
&
frontEndEmojiSet
,
emojisToRemove
)
...
...
This diff is collapsed.
Click to expand it.
emoji/main.go
+
8
−
0
View file @
0448bb99
...
...
@@ -57,6 +57,8 @@ var sanitizeEmojis = &cobra.Command{
initLog
(
viper
.
GetInt
(
logFileFlag
),
logFile
)
}
jww
.
INFO
.
Printf
(
"Retrieving emoji-mart JSON file..."
)
// Retrieve emoji-mart file from URL
resp
,
err
:=
http
.
Get
(
emojiMartUrl
)
if
err
!=
nil
{
...
...
@@ -64,6 +66,8 @@ var sanitizeEmojis = &cobra.Command{
"Failed to retrieve emoji-mart JSON from URL: %+v"
,
err
)
}
jww
.
INFO
.
Printf
(
"Reading emoji-mart JSON file into bytes..."
)
// Read HTTP response into byte slice
var
buf
bytes
.
Buffer
_
,
err
=
buf
.
ReadFrom
(
resp
.
Body
)
...
...
@@ -75,6 +79,8 @@ var sanitizeEmojis = &cobra.Command{
}
emojiMartJson
:=
buf
.
Bytes
()
jww
.
INFO
.
Printf
(
"Sanitizing emoji-mart JSON..."
)
// Sanitize the JSON file
backendSet
:=
NewSet
()
sanitizedJSON
,
err
:=
backendSet
.
SanitizeEmojiMartSet
(
emojiMartJson
)
...
...
@@ -82,6 +88,8 @@ var sanitizeEmojis = &cobra.Command{
jww
.
FATAL
.
Panicf
(
"Failed to sanitize emoji-mart list: %+v"
,
err
)
}
jww
.
INFO
.
Printf
(
"Outputting sanitized emoji JSON to file..."
)
// Write sanitized JSON to file
sanitizedOutputFilePath
:=
viper
.
GetString
(
sanitizedOutputFlag
)
err
=
utils
.
WriteFileDef
(
sanitizedOutputFilePath
,
sanitizedJSON
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment