Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,18 @@ console_bn_SOURCES = \
console/localize.hpp \
console/main.cpp \
console/stack_trace.cpp \
console/stack_trace.hpp
console/stack_trace.hpp \
console/embedded/embedded.hpp \
console/embedded/explore_css.cpp \
console/embedded/explore_ecma.cpp \
console/embedded/explore_font.cpp \
console/embedded/explore_html.cpp \
console/embedded/explore_icon.cpp \
console/embedded/web_css.cpp \
console/embedded/web_ecma.cpp \
console/embedded/web_font.cpp \
console/embedded/web_html.cpp \
console/embedded/web_icon.cpp

endif WITH_CONSOLE

Expand Down
13 changes: 12 additions & 1 deletion builds/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,18 @@ if (with-console)
"../../console/localize.hpp"
"../../console/main.cpp"
"../../console/stack_trace.cpp"
"../../console/stack_trace.hpp" )
"../../console/stack_trace.hpp"
"../../console/embedded/embedded.hpp"
"../../console/embedded/explore_css.cpp"
"../../console/embedded/explore_ecma.cpp"
"../../console/embedded/explore_font.cpp"
"../../console/embedded/explore_html.cpp"
"../../console/embedded/explore_icon.cpp"
"../../console/embedded/web_css.cpp"
"../../console/embedded/web_ecma.cpp"
"../../console/embedded/web_font.cpp"
"../../console/embedded/web_html.cpp"
"../../console/embedded/web_icon.cpp" )

# bn project specific include directories.
#------------------------------------------------------------------------------
Expand Down
11 changes: 11 additions & 0 deletions builds/msvc/vs2022/bn/bn.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,16 @@
<Import Project="$(ProjectDir)$(ProjectName).props" />
</ImportGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\console\embedded\explore_css.cpp" />
<ClCompile Include="..\..\..\..\console\embedded\explore_ecma.cpp" />
<ClCompile Include="..\..\..\..\console\embedded\explore_font.cpp" />
<ClCompile Include="..\..\..\..\console\embedded\explore_html.cpp" />
<ClCompile Include="..\..\..\..\console\embedded\explore_icon.cpp" />
<ClCompile Include="..\..\..\..\console\embedded\web_css.cpp" />
<ClCompile Include="..\..\..\..\console\embedded\web_ecma.cpp" />
<ClCompile Include="..\..\..\..\console\embedded\web_font.cpp" />
<ClCompile Include="..\..\..\..\console\embedded\web_html.cpp" />
<ClCompile Include="..\..\..\..\console\embedded\web_icon.cpp" />
<ClCompile Include="..\..\..\..\console\executor.cpp" />
<ClCompile Include="..\..\..\..\console\executor_commands.cpp" />
<ClCompile Include="..\..\..\..\console\executor_dumps.cpp" />
Expand All @@ -133,6 +143,7 @@
<ClCompile Include="..\..\..\..\console\stack_trace.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\..\console\embedded\embedded.hpp" />
<ClInclude Include="..\..\..\..\console\executor.hpp" />
<ClInclude Include="..\..\..\..\console\localize.hpp" />
<ClInclude Include="..\..\..\..\console\stack_trace.hpp" />
Expand Down
38 changes: 37 additions & 1 deletion builds/msvc/vs2022/bn/bn.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,46 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="resource">
<UniqueIdentifier>{D3404804-C83F-46CE-0000-000000000001}</UniqueIdentifier>
<UniqueIdentifier>{D3404804-C83F-46CE-0000-000000000002}</UniqueIdentifier>
</Filter>
<Filter Include="src">
<UniqueIdentifier>{D3404804-C83F-46CE-0000-000000000000}</UniqueIdentifier>
</Filter>
<Filter Include="src\embedded">
<UniqueIdentifier>{D3404804-C83F-46CE-0000-000000000001}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\console\embedded\explore_css.cpp">
<Filter>src\embedded</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\console\embedded\explore_ecma.cpp">
<Filter>src\embedded</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\console\embedded\explore_font.cpp">
<Filter>src\embedded</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\console\embedded\explore_html.cpp">
<Filter>src\embedded</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\console\embedded\explore_icon.cpp">
<Filter>src\embedded</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\console\embedded\web_css.cpp">
<Filter>src\embedded</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\console\embedded\web_ecma.cpp">
<Filter>src\embedded</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\console\embedded\web_font.cpp">
<Filter>src\embedded</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\console\embedded\web_html.cpp">
<Filter>src\embedded</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\console\embedded\web_icon.cpp">
<Filter>src\embedded</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\console\executor.cpp">
<Filter>src</Filter>
</ClCompile>
Expand Down Expand Up @@ -56,6 +89,9 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\..\console\embedded\embedded.hpp">
<Filter>src\embedded</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\console\executor.hpp">
<Filter>src</Filter>
</ClInclude>
Expand Down
61 changes: 61 additions & 0 deletions console/embedded/embedded.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
*
* This file is part of libbitcoin.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBBITCOIN_BN_EMBEDDED_HPP
#define LIBBITCOIN_BN_EMBEDDED_HPP

#include "../executor.hpp"

#include <iterator>
#include <bitcoin/node.hpp>

#define DECLARE_EMBEDDED_PAGE(page) \
span_value page() const NOEXCEPT override

#define DECLARE_EMBEDDED_PAGES(container) \
struct container : public server::settings::embedded_pages \
{ \
DECLARE_EMBEDDED_PAGE(css); \
DECLARE_EMBEDDED_PAGE(html); \
DECLARE_EMBEDDED_PAGE(ecma); \
DECLARE_EMBEDDED_PAGE(font); \
DECLARE_EMBEDDED_PAGE(icon); \
}

#define DEFINE_EMBEDDED_PAGE(container, type, name, ...) \
span_value container::name() const NOEXCEPT \
{ \
static constexpr type name##_[] = __VA_ARGS__; \
static const span_value out \
( \
const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(&name##_[0])), \
literal_length(name##_) \
); \
return out; \
}

namespace libbitcoin {
namespace server {

DECLARE_EMBEDDED_PAGES(web_pages);
DECLARE_EMBEDDED_PAGES(explore_pages);

} // namespace server
} // namespace libbitcoin

#endif
27 changes: 27 additions & 0 deletions console/embedded/explore_css.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
*
* This file is part of libbitcoin.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../embedded/embedded.hpp"

namespace libbitcoin {
namespace server {

DEFINE_EMBEDDED_PAGE(explore_pages, char, css, "")

} // namespace server
} // namespace libbitcoin
27 changes: 27 additions & 0 deletions console/embedded/explore_ecma.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
*
* This file is part of libbitcoin.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../embedded/embedded.hpp"

namespace libbitcoin {
namespace server {

DEFINE_EMBEDDED_PAGE(explore_pages, char, ecma, "")

} // namespace server
} // namespace libbitcoin
27 changes: 27 additions & 0 deletions console/embedded/explore_font.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
*
* This file is part of libbitcoin.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../embedded/embedded.hpp"

namespace libbitcoin {
namespace server {

DEFINE_EMBEDDED_PAGE(explore_pages, char, font, "")

} // namespace server
} // namespace libbitcoin
28 changes: 28 additions & 0 deletions console/embedded/explore_html.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
*
* This file is part of libbitcoin.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../embedded/embedded.hpp"

namespace libbitcoin {
namespace server {

// Empty page disabled embedded size.
DEFINE_EMBEDDED_PAGE(explore_pages, char, html, "")

} // namespace server
} // namespace libbitcoin
27 changes: 27 additions & 0 deletions console/embedded/explore_icon.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
*
* This file is part of libbitcoin.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../embedded/embedded.hpp"

namespace libbitcoin {
namespace server {

DEFINE_EMBEDDED_PAGE(explore_pages, char, icon, "")

} // namespace server
} // namespace libbitcoin
33 changes: 33 additions & 0 deletions console/embedded/web_css.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
*
* This file is part of libbitcoin.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../embedded/embedded.hpp"

namespace libbitcoin {
namespace server {

// Simple test css for embedded page, links in font.
DEFINE_EMBEDDED_PAGE(web_pages, char, css,
R"(@font-face
{
font-family: 'Boston';
src: url('boston.woff2');
})")

} // namespace server
} // namespace libbitcoin
32 changes: 32 additions & 0 deletions console/embedded/web_ecma.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
*
* This file is part of libbitcoin.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../embedded/embedded.hpp"

namespace libbitcoin {
namespace server {

// Simple test ecma script for embedded page.
DEFINE_EMBEDDED_PAGE(web_pages, char, ecma,
R"(document.addEventListener('DOMContentLoaded', function()
{
console.log('ping');
});)")

} // namespace server
} // namespace libbitcoin
Loading
Loading