Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
T
tangled
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eriksson monteiro
tangled
Commits
c458db90
Commit
c458db90
authored
May 17, 2021
by
eriksson_monteiro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable macos build
parent
6fecb8ec
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
11 deletions
+34
-11
chrome/browser/resources/millix/millix_bar.css
chrome/browser/resources/millix/millix_bar.css
+1
-1
chrome/browser/resources/millix/millix_ws.js
chrome/browser/resources/millix/millix_ws.js
+1
-1
chrome/browser/ui/webui/millix/millix_bar.cc
chrome/browser/ui/webui/millix/millix_bar.cc
+30
-7
chrome/browser/ui/webui/millix/millix_bar.h
chrome/browser/ui/webui/millix/millix_bar.h
+1
-1
chrome/browser/ui/webui/millix/untrusted_millix_app.cc
chrome/browser/ui/webui/millix/untrusted_millix_app.cc
+1
-1
No files found.
chrome/browser/resources/millix/millix_bar.css
View file @
c458db90
...
...
@@ -324,7 +324,7 @@ input:focus {
margin-top
:
0px
;
border
:
solid
1px
lightgray
;
border-radius
:
4px
0px
0px
4px
;
width
:
20
0px
;
width
:
19
0px
;
padding-left
:
10px
;
}
...
...
chrome/browser/resources/millix/millix_ws.js
View file @
c458db90
...
...
@@ -178,7 +178,7 @@ window.addEventListener('message', ({ data }) => {
addressKeyIdentifier
=
data
.
wallet
.
address_key_identifier
;
}
window
.
parent
.
postMessage
({
type
:
'
millix_session
'
,
data
},
'
tangled://millix-bar
'
)
}).
catch
(
_
=>
setTimeout
(()
=>
window
.
postMessage
({
type
:
'
get_session
'
,
data
}),
1000
));
}).
catch
(
_
=>
setTimeout
(()
=>
window
.
postMessage
({
type
:
'
get_session
'
}),
1000
));
break
;
case
'
new_session
'
:
API
.
newSession
(
data
.
password
)
...
...
chrome/browser/ui/webui/millix/millix_bar.cc
View file @
c458db90
...
...
@@ -158,6 +158,7 @@ void MillixBarUI::ReadNodeConfig() {
base
::
FilePath
file_path
;
base
::
PathService
::
Get
(
base
::
DIR_HOME
,
&
file_path
);
file_path
=
file_path
.
AppendASCII
(
"millix-tangled"
).
AppendASCII
(
"node.json"
);
LOG
(
ERROR
)
<<
"reading node config from "
<<
file_path
.
value
().
c_str
();
this
->
node_config_file_reader
=
storage
::
FileStreamReader
::
CreateForLocalFile
(
base
::
ThreadPool
::
CreateTaskRunner
(
{
base
::
MayBlock
(),
base
::
TaskPriority
::
USER_VISIBLE
}),
...
...
@@ -167,6 +168,7 @@ void MillixBarUI::ReadNodeConfig() {
}
void
MillixBarUI
::
ReadNodeConfigJson
(
int64_t
size
=
-
1
)
{
LOG
(
ERROR
)
<<
"reading node config. size: "
<<
size
;
if
(
size
<=
0
)
{
// retry later
content
::
GetIOThreadTaskRunner
({})
->
PostDelayedTask
(
...
...
@@ -175,35 +177,56 @@ void MillixBarUI::ReadNodeConfigJson(int64_t size = -1) {
base
::
TimeDelta
::
FromMilliseconds
(
1000
));
return
;
}
this
->
node_config_buffer
=
new
net
::
IOBuffer
(
size
);
this
->
node_config_file_reader
->
Read
(
this
->
node_config_buffer
,
size
,
this
->
node_config_buffer
=
base
::
MakeRefCounted
<
net
::
IOBufferWithSize
>
(
size
);
int
rv
=
this
->
node_config_file_reader
->
Read
(
this
->
node_config_buffer
.
get
()
,
size
,
base
::
BindOnce
(
&
MillixBarUI
::
OnReadNodeConfigJson
,
base
::
Unretained
(
this
)));
if
(
rv
>
0
)
{
this
->
OnReadNodeConfigJson
(
rv
);
}
}
void
MillixBarUI
::
OnReadNodeConfigJson
(
int
result
)
{
char
*
data
=
this
->
node_config_buffer
->
data
();
LOG
(
ERROR
)
<<
"reading node config. json ("
<<
result
<<
") "
<<
base
::
StringPiece
(
data
);
#if defined(OS_WIN)
base
::
Optional
<
base
::
Value
>
node_config_json
=
base
::
JSONReader
::
Read
(
base
::
StringPiece
(
data
).
substr
(
0
,
result
));
#else
base
::
Optional
<
base
::
Value
>
node_config_json
=
base
::
JSONReader
::
Read
(
base
::
StringPiece
(
data
));
#endif
if
(
node_config_json
.
has_value
())
{
std
::
string
*
node_id
=
node_config_json
->
FindStringKey
(
"node_id"
);
std
::
string
*
node_signature
=
node_config_json
->
FindStringKey
(
"node_signature"
);
if
(
!
node_id
||
!
node_signature
)
{
if
(
!
node_id
||
!
node_signature
||
node_id
->
empty
()
||
node_signature
->
empty
())
{
LOG
(
ERROR
)
<<
"reading node config. invalid configs! "
;
this
->
ReadNodeConfigJson
();
return
;
}
LOG
(
ERROR
)
<<
"reading node config. id "
<<
*
node_id
<<
" signature "
<<
*
node_signature
;
this
->
message_handler
->
node_id
=
*
node_id
;
this
->
message_handler
->
node_signature
=
*
node_signature
;
content
::
GetUIThreadTaskRunner
({})
->
PostTask
(
FROM_HERE
,
base
::
BindOnce
(
&
MillixBarUI
::
OnUpdateNodeApiConfig
,
base
::
Unretained
(
this
)));
}
else
{
LOG
(
ERROR
)
<<
"reading node config. invalid json"
;
// retry later
content
::
GetIOThreadTaskRunner
({})
->
PostDelayedTask
(
FROM_HERE
,
base
::
BindOnce
(
&
MillixBarUI
::
ReadNodeConfig
,
base
::
Unretained
(
this
)),
base
::
TimeDelta
::
FromMilliseconds
(
1000
));
}
this
->
node_config_buffer
=
nullptr
;
}
void
MillixBarUI
::
OnUpdateNodeApiConfig
()
{
LOG
(
ERROR
)
<<
"sending node config. id "
<<
this
->
message_handler
->
node_id
<<
" signature "
<<
this
->
message_handler
->
node_signature
;
base
::
DictionaryValue
apiConfig
;
apiConfig
.
SetStringKey
(
"node_id"
,
this
->
message_handler
->
node_id
);
apiConfig
.
SetStringKey
(
"node_signature"
,
...
...
chrome/browser/ui/webui/millix/millix_bar.h
View file @
c458db90
...
...
@@ -41,7 +41,7 @@ class MillixBarUI : public ui::MojoWebUIController {
void
OnReadNodeConfigJson
(
int
result
);
void
OnUpdateNodeApiConfig
();
std
::
unique_ptr
<
storage
::
FileStreamReader
>
node_config_file_reader
;
net
::
IOBuffer
*
node_config_buffer
;
scoped_refptr
<
net
::
IOBufferWithSize
>
node_config_buffer
;
MillixBarMessageHandler
*
message_handler
;
DISALLOW_COPY_AND_ASSIGN
(
MillixBarUI
);
};
...
...
chrome/browser/ui/webui/millix/untrusted_millix_app.cc
View file @
c458db90
...
...
@@ -53,7 +53,7 @@ UntrustedMillixAppUI::UntrustedMillixAppUI(content::WebUI* web_ui)
network
::
mojom
::
CSPDirectiveName
::
ConnectSrc
,
"connect-src https:;"
);
untrusted_source
->
OverrideContentSecurityPolicy
(
network
::
mojom
::
CSPDirectiveName
::
DefaultSrc
,
"scrip
t-src 'self' 'unsafe-inline';"
);
network
::
mojom
::
CSPDirectiveName
::
DefaultSrc
,
"defaul
t-src 'self' 'unsafe-inline';"
);
untrusted_source
->
OverrideContentSecurityPolicy
(
network
::
mojom
::
CSPDirectiveName
::
ScriptSrc
,
"script-src tangled://resources 'self' 'unsafe-inline';"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment