Commit c080d173 authored by Eriksson Monteiro's avatar Eriksson Monteiro

update millix bar integration

parent c90c34ba
......@@ -28,16 +28,14 @@ window.addEventListener('message', ({ data }) => {
function refreshIframe() {
let iframe = document.getElementById('millix_frame');
let page = '';
if (window.location.hash) {
page = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
}
let page = window.location.pathname.substring(1) + window.location.search + window.location.hash;
if (iframe) {
iframe.src = `chrome-untrusted://millix/${page}`
} else {
iframe = document.createElement('iframe');
iframe.id = 'millix_frame';
iframe.allow = "clipboard-write"
iframe.onload = onFrameReady;
iframe.src = `chrome-untrusted://millix/${page}`
document.body.appendChild(iframe);
......
......@@ -394,10 +394,10 @@ cr.define('millix_bar', function () {
$('#wallet').click(() => showMillixWallet());
$('#wallet_unlock').click(() => showMillixWallet());
$('#wallet_network').click(() => showMillixWallet());
$('#wallet_log').click(() => showMillixWallet());
$('#wallet_backlog').click(() => showMillixWallet());
$('#wallet_transaction').click(() => chrome.send('showMillixWallet', ['history']));
$('#wallet_network').click(() => chrome.send('showMillixWallet', ['peers']));
$('#wallet_log').click(() => chrome.send('showMillixWallet', ['event-log']));
$('#wallet_backlog').click(() => chrome.send('showMillixWallet', ['backlog']));
$('#wallet_transaction').click(() => chrome.send('showMillixWallet', ['transaction-list']));
$('#wallet_restart').click(() => {
doNodeRestart();
});
......
......@@ -109,7 +109,7 @@ void MillixBarUI::MillixBarMessageHandler::ShowMillixWallet(
params.path_behavior = NavigateParams::IGNORE_AND_NAVIGATE;
ShowSingletonTabOverwritingNTP(browser, std::move(params));
} else {
std::string url = base::StringPrintf("%s#%s", chrome::kChromeUIMillixAppURL,
std::string url = base::StringPrintf("%s/%s", chrome::kChromeUIMillixAppURL,
page.c_str());
NavigateParams params(GetSingletonTabNavigateParams(browser, GURL(url)));
params.path_behavior = NavigateParams::IGNORE_AND_NAVIGATE;
......
......@@ -52,6 +52,9 @@ UntrustedMillixAppUI::UntrustedMillixAppUI(content::WebUI* web_ui)
untrusted_source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::DefaultSrc, "default-src 'self' 'unsafe-inline';");
untrusted_source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::ImgSrc, "img-src 'self' data: blob:;");
untrusted_source->OverrideContentSecurityPolicy(
network::mojom::CSPDirectiveName::ScriptSrc, "script-src tangled://resources 'self' 'unsafe-inline';");
untrusted_source->AddFrameAncestor(GURL(chrome::kChromeUIMillixAppURL));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment