Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
client
Commits
7e1f8831
Commit
7e1f8831
authored
6 years ago
by
Tigran Avakyan
Browse files
Options
Downloads
Patches
Plain Diff
Created fake viper JSON variable that is used to get group JSON for registration.
parent
6f8189a3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/root.go
+12
-5
12 additions, 5 deletions
cmd/root.go
user/session.go
+1
-1
1 addition, 1 deletion
user/session.go
with
13 additions
and
6 deletions
cmd/root.go
+
12
−
5
View file @
7e1f8831
...
@@ -17,6 +17,7 @@ import (
...
@@ -17,6 +17,7 @@ import (
"gitlab.com/elixxir/client/bindings"
"gitlab.com/elixxir/client/bindings"
"gitlab.com/elixxir/client/bots"
"gitlab.com/elixxir/client/bots"
"gitlab.com/elixxir/client/cmixproto"
"gitlab.com/elixxir/client/cmixproto"
"gitlab.com/elixxir/client/crypto"
"gitlab.com/elixxir/client/globals"
"gitlab.com/elixxir/client/globals"
"gitlab.com/elixxir/client/parse"
"gitlab.com/elixxir/client/parse"
"gitlab.com/elixxir/primitives/switchboard"
"gitlab.com/elixxir/primitives/switchboard"
...
@@ -123,10 +124,9 @@ func sessionInitialization() {
...
@@ -123,10 +124,9 @@ func sessionInitialization() {
// 64 bits
// 64 bits
grp
:=
cyclic
.
Group
{}
grp
:=
cyclic
.
Group
{}
grpBuff
:=
[]
byte
(
viper
.
GetString
(
"group"
))
grpBuff
:=
[]
byte
(
viper
.
GetString
(
"group"
))
err
:=
grp
.
UnmarshalJSON
(
grpBuff
)
err
:=
grp
.
GobDecode
(
grpBuff
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Printf
(
"Could Not Decode group: %s
\n
"
,
err
.
Error
())
fmt
.
Printf
(
"Could Not Decode group
from JSON
: %s
\n
"
,
err
.
Error
())
return
return
}
}
...
@@ -275,7 +275,6 @@ var rootCmd = &cobra.Command{
...
@@ -275,7 +275,6 @@ var rootCmd = &cobra.Command{
// Only send a message if we have a message to send (except dummy messages)
// Only send a message if we have a message to send (except dummy messages)
recipientId
:=
new
(
id
.
User
)
.
SetUints
(
&
[
4
]
uint64
{
0
,
0
,
0
,
destinationUserId
})
recipientId
:=
new
(
id
.
User
)
.
SetUints
(
&
[
4
]
uint64
{
0
,
0
,
0
,
destinationUserId
})
senderId
:=
new
(
id
.
User
)
.
SetUints
(
&
[
4
]
uint64
{
0
,
0
,
0
,
userId
})
senderId
:=
new
(
id
.
User
)
.
SetUints
(
&
[
4
]
uint64
{
0
,
0
,
0
,
userId
})
grp
:=
user
.
TheSession
.
GetGroup
()
if
message
!=
""
{
if
message
!=
""
{
// Get the recipient's nick
// Get the recipient's nick
recipientNick
:=
""
recipientNick
:=
""
...
@@ -286,6 +285,7 @@ var rootCmd = &cobra.Command{
...
@@ -286,6 +285,7 @@ var rootCmd = &cobra.Command{
// Handle sending to UDB
// Handle sending to UDB
if
*
recipientId
==
*
bots
.
UdbID
{
if
*
recipientId
==
*
bots
.
UdbID
{
grp
:=
user
.
TheSession
.
GetGroup
()
fmt
.
Println
(
parseUdbMessage
(
message
,
grp
))
fmt
.
Println
(
parseUdbMessage
(
message
,
grp
))
}
else
{
}
else
{
// Handle sending to any other destination
// Handle sending to any other destination
...
@@ -421,7 +421,14 @@ func SetCertPath(path string) {
...
@@ -421,7 +421,14 @@ func SetCertPath(path string) {
}
}
// initConfig reads in config file and ENV variables if set.
// initConfig reads in config file and ENV variables if set.
func
initConfig
()
{}
func
initConfig
()
{
// Temporarily need to get group as JSON data into viper
json
,
err
:=
crypto
.
InitCrypto
()
.
MarshalJSON
()
if
err
!=
nil
{
// panic
}
viper
.
Set
(
"group"
,
string
(
json
))
}
// initLog initializes logging thresholds and the log path.
// initLog initializes logging thresholds and the log path.
func
initLog
()
{
func
initLog
()
{
...
...
This diff is collapsed.
Click to expand it.
user/session.go
+
1
−
1
View file @
7e1f8831
...
@@ -199,7 +199,7 @@ func (s *SessionObj) GetCurrentUser() (currentUser *User) {
...
@@ -199,7 +199,7 @@ func (s *SessionObj) GetCurrentUser() (currentUser *User) {
Nick
:
s
.
CurrentUser
.
Nick
,
Nick
:
s
.
CurrentUser
.
Nick
,
}
}
}
}
return
return
currentUser
}
}
func
(
s
*
SessionObj
)
GetGWAddress
()
string
{
func
(
s
*
SessionObj
)
GetGWAddress
()
string
{
...
...
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