mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-16 06:22:17 +00:00
Base: Move config files out of home/anon and into default-config
This commit is contained in:
parent
4ef0a123ea
commit
a443f50807
Notes:
sideshowbarker
2024-07-18 02:44:17 +09:00
Author: https://github.com/circl-lastname
Commit: a443f50807
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/672
8 changed files with 34 additions and 29 deletions
|
@ -106,9 +106,7 @@ ErrorOr<NonnullRefPtr<Client>> bind_service(void (*bind_method)(int))
|
||||||
|
|
||||||
static ErrorOr<void> load_content_filters()
|
static ErrorOr<void> load_content_filters()
|
||||||
{
|
{
|
||||||
auto file_or_error = Core::File::open(ByteString::formatted("{}/home/anon/.config/BrowserContentFilters.txt", s_serenity_resource_root), Core::File::OpenMode::Read);
|
auto file_or_error = Core::File::open(ByteString::formatted("{}/res/ladybird/default-config/BrowserContentFilters.txt", s_serenity_resource_root), Core::File::OpenMode::Read);
|
||||||
if (file_or_error.is_error())
|
|
||||||
file_or_error = Core::File::open(ByteString::formatted("{}/res/ladybird/BrowserContentFilters.txt", s_serenity_resource_root), Core::File::OpenMode::Read);
|
|
||||||
if (file_or_error.is_error())
|
if (file_or_error.is_error())
|
||||||
return file_or_error.release_error();
|
return file_or_error.release_error();
|
||||||
|
|
||||||
|
@ -135,9 +133,7 @@ static ErrorOr<void> load_content_filters()
|
||||||
|
|
||||||
static ErrorOr<void> load_autoplay_allowlist()
|
static ErrorOr<void> load_autoplay_allowlist()
|
||||||
{
|
{
|
||||||
auto file_or_error = Core::File::open(TRY(String::formatted("{}/home/anon/.config/BrowserAutoplayAllowlist.txt", s_serenity_resource_root)), Core::File::OpenMode::Read);
|
auto file_or_error = Core::File::open(TRY(String::formatted("{}/res/ladybird/default-config/BrowserAutoplayAllowlist.txt", s_serenity_resource_root)), Core::File::OpenMode::Read);
|
||||||
if (file_or_error.is_error())
|
|
||||||
file_or_error = Core::File::open(TRY(String::formatted("{}/res/ladybird/BrowserAutoplayAllowlist.txt", s_serenity_resource_root)), Core::File::OpenMode::Read);
|
|
||||||
if (file_or_error.is_error())
|
if (file_or_error.is_error())
|
||||||
return file_or_error.release_error();
|
return file_or_error.release_error();
|
||||||
|
|
||||||
|
|
|
@ -197,7 +197,7 @@ static ErrorOr<void> load_content_filters()
|
||||||
{
|
{
|
||||||
auto buffer = TRY(ByteBuffer::create_uninitialized(4096));
|
auto buffer = TRY(ByteBuffer::create_uninitialized(4096));
|
||||||
|
|
||||||
auto resource = TRY(Core::Resource::load_from_uri("resource://ladybird/BrowserContentFilters.txt"sv));
|
auto resource = TRY(Core::Resource::load_from_uri("resource://ladybird/default-config/BrowserContentFilters.txt"sv));
|
||||||
auto ad_filter_list = TRY(InputBufferedSeekable<FixedMemoryStream>::create(make<FixedMemoryStream>(resource->data())));
|
auto ad_filter_list = TRY(InputBufferedSeekable<FixedMemoryStream>::create(make<FixedMemoryStream>(resource->data())));
|
||||||
|
|
||||||
Vector<String> patterns;
|
Vector<String> patterns;
|
||||||
|
@ -221,7 +221,7 @@ static ErrorOr<void> load_autoplay_allowlist()
|
||||||
{
|
{
|
||||||
auto buffer = TRY(ByteBuffer::create_uninitialized(4096));
|
auto buffer = TRY(ByteBuffer::create_uninitialized(4096));
|
||||||
|
|
||||||
auto resource = TRY(Core::Resource::load_from_uri("resource://ladybird/BrowserAutoplayAllowlist.txt"sv));
|
auto resource = TRY(Core::Resource::load_from_uri("resource://ladybird/default-config/BrowserAutoplayAllowlist.txt"sv));
|
||||||
auto allowlist = TRY(InputBufferedSeekable<FixedMemoryStream>::create(make<FixedMemoryStream>(resource->data())));
|
auto allowlist = TRY(InputBufferedSeekable<FixedMemoryStream>::create(make<FixedMemoryStream>(resource->data())));
|
||||||
|
|
||||||
Vector<String> origins;
|
Vector<String> origins;
|
||||||
|
|
|
@ -22,22 +22,12 @@ copy_res_folder(fonts)
|
||||||
copy_res_folder(icons)
|
copy_res_folder(icons)
|
||||||
copy_res_folder(emoji)
|
copy_res_folder(emoji)
|
||||||
copy_res_folder(themes)
|
copy_res_folder(themes)
|
||||||
add_custom_target(copy-autoplay-allowlist
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
||||||
"${LADYBIRD_SOURCE_DIR}/Base/home/anon/.config/BrowserAutoplayAllowlist.txt"
|
|
||||||
"asset-bundle/res/ladybird/BrowserAutoplayAllowlist.txt"
|
|
||||||
)
|
|
||||||
add_custom_target(copy-content-filters
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
||||||
"${LADYBIRD_SOURCE_DIR}/Base/home/anon/.config/BrowserContentFilters.txt"
|
|
||||||
"asset-bundle/res/ladybird/BrowserContentFilters.txt"
|
|
||||||
)
|
|
||||||
add_custom_target(copy-certs
|
add_custom_target(copy-certs
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
"${Lagom_BINARY_DIR}/cacert.pem"
|
"${Lagom_BINARY_DIR}/cacert.pem"
|
||||||
"asset-bundle/res/ladybird/cacert.pem"
|
"asset-bundle/res/ladybird/cacert.pem"
|
||||||
)
|
)
|
||||||
add_dependencies(archive-assets copy-autoplay-allowlist copy-content-filters copy-certs)
|
add_dependencies(archive-assets copy-certs)
|
||||||
add_custom_target(copy-assets COMMAND ${CMAKE_COMMAND} -E copy_if_different ladybird-assets.tar "${CMAKE_SOURCE_DIR}/Ladybird/Android/src/main/assets/")
|
add_custom_target(copy-assets COMMAND ${CMAKE_COMMAND} -E copy_if_different ladybird-assets.tar "${CMAKE_SOURCE_DIR}/Ladybird/Android/src/main/assets/")
|
||||||
add_dependencies(copy-assets archive-assets)
|
add_dependencies(copy-assets archive-assets)
|
||||||
add_dependencies(ladybird copy-assets)
|
add_dependencies(ladybird copy-assets)
|
||||||
|
|
|
@ -82,10 +82,11 @@ set(THEMES
|
||||||
list(TRANSFORM THEMES PREPEND "${LADYBIRD_SOURCE_DIR}/Base/res/themes/")
|
list(TRANSFORM THEMES PREPEND "${LADYBIRD_SOURCE_DIR}/Base/res/themes/")
|
||||||
|
|
||||||
set(CONFIG_RESOURCES
|
set(CONFIG_RESOURCES
|
||||||
|
bookmarks.json
|
||||||
BrowserAutoplayAllowlist.txt
|
BrowserAutoplayAllowlist.txt
|
||||||
BrowserContentFilters.txt
|
BrowserContentFilters.txt
|
||||||
)
|
)
|
||||||
list(TRANSFORM CONFIG_RESOURCES PREPEND "${LADYBIRD_SOURCE_DIR}/Base/home/anon/.config/")
|
list(TRANSFORM CONFIG_RESOURCES PREPEND "${LADYBIRD_SOURCE_DIR}/Base/res/ladybird/default-config/")
|
||||||
|
|
||||||
set(DOWNLOADED_RESOURCES
|
set(DOWNLOADED_RESOURCES
|
||||||
cacert.pem
|
cacert.pem
|
||||||
|
@ -168,7 +169,7 @@ function(copy_resources_to_build base_directory bundle_target)
|
||||||
DESTINATION ${base_directory} TARGET ${bundle_target}
|
DESTINATION ${base_directory} TARGET ${bundle_target}
|
||||||
)
|
)
|
||||||
|
|
||||||
copy_resource_set(ladybird RESOURCES ${CONFIG_RESOURCES}
|
copy_resource_set(ladybird/default-config RESOURCES ${CONFIG_RESOURCES}
|
||||||
DESTINATION ${base_directory} TARGET ${bundle_target}
|
DESTINATION ${base_directory} TARGET ${bundle_target}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -190,6 +191,6 @@ function(install_ladybird_resources destination component)
|
||||||
install(FILES ${THEMES} DESTINATION "${destination}/themes" COMPONENT ${component})
|
install(FILES ${THEMES} DESTINATION "${destination}/themes" COMPONENT ${component})
|
||||||
install(FILES ${WEB_RESOURCES} DESTINATION "${destination}/ladybird" COMPONENT ${component})
|
install(FILES ${WEB_RESOURCES} DESTINATION "${destination}/ladybird" COMPONENT ${component})
|
||||||
install(FILES ${WEB_TEMPLATES} DESTINATION "${destination}/ladybird/templates" COMPONENT ${component})
|
install(FILES ${WEB_TEMPLATES} DESTINATION "${destination}/ladybird/templates" COMPONENT ${component})
|
||||||
install(FILES ${CONFIG_RESOURCES} DESTINATION "${destination}/ladybird" COMPONENT ${component})
|
install(FILES ${CONFIG_RESOURCES} DESTINATION "${destination}/ladybird/default-config" COMPONENT ${component})
|
||||||
install(FILES ${DOWNLOADED_RESOURCES} DESTINATION "${destination}/ladybird" COMPONENT ${component})
|
install(FILES ${DOWNLOADED_RESOURCES} DESTINATION "${destination}/ladybird" COMPONENT ${component})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -155,6 +155,7 @@ executable("ladybird_executable") {
|
||||||
deps += [ "//Userland/Libraries/LibThreading" ]
|
deps += [ "//Userland/Libraries/LibThreading" ]
|
||||||
} else {
|
} else {
|
||||||
data_deps += [
|
data_deps += [
|
||||||
|
":ladybird_copy_cacert",
|
||||||
":ladybird_copy_config_resources",
|
":ladybird_copy_config_resources",
|
||||||
":ladybird_copy_emoji",
|
":ladybird_copy_emoji",
|
||||||
":ladybird_copy_fonts",
|
":ladybird_copy_fonts",
|
||||||
|
@ -279,10 +280,12 @@ web_templates = [
|
||||||
"//Base/res/ladybird/templates/version.html",
|
"//Base/res/ladybird/templates/version.html",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
cacert = [ "$root_build_dir/cacert.pem" ]
|
||||||
|
|
||||||
config_resources = [
|
config_resources = [
|
||||||
"$root_build_dir/cacert.pem",
|
"//Base/res/ladybird/default-config/BrowserAutoplayAllowlist.txt",
|
||||||
"//Base/home/anon/.config/BrowserAutoplayAllowlist.txt",
|
"//Base/res/ladybird/default-config/BrowserContentFilters.txt",
|
||||||
"//Base/home/anon/.config/BrowserContentFilters.txt",
|
"//Base/res/ladybird/default-config/bookmarks.json",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (current_os != "mac") {
|
if (current_os != "mac") {
|
||||||
|
@ -337,11 +340,18 @@ if (current_os != "mac") {
|
||||||
[ "$root_out_dir/share/Lagom/ladybird/templates/{{source_file_part}}" ]
|
[ "$root_out_dir/share/Lagom/ladybird/templates/{{source_file_part}}" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
copy("ladybird_copy_config_resources") {
|
copy("ladybird_copy_cacert") {
|
||||||
public_deps = [ "//Userland/Libraries/LibTLS:ca_certificates_download" ]
|
public_deps = [ "//Userland/Libraries/LibTLS:ca_certificates_download" ]
|
||||||
sources = config_resources
|
sources = cacert
|
||||||
outputs = [ "$root_out_dir/share/Lagom/ladybird/{{source_file_part}}" ]
|
outputs = [ "$root_out_dir/share/Lagom/ladybird/{{source_file_part}}" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copy("ladybird_copy_config_resources") {
|
||||||
|
sources = config_resources
|
||||||
|
outputs = [
|
||||||
|
"$root_out_dir/share/Lagom/ladybird/default-config/{{source_file_part}}",
|
||||||
|
]
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
# macOS bundle steps
|
# macOS bundle steps
|
||||||
bundle_data("ladybird_bundle_info_plist") {
|
bundle_data("ladybird_bundle_info_plist") {
|
||||||
|
@ -477,12 +487,19 @@ if (current_os != "mac") {
|
||||||
[ "{{bundle_resources_dir}}/ladybird/templates/{{source_file_part}}" ]
|
[ "{{bundle_resources_dir}}/ladybird/templates/{{source_file_part}}" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
bundle_data("ladybird_config_resources") {
|
bundle_data("ladybird_cacert") {
|
||||||
public_deps = [ "//Userland/Libraries/LibTLS:ca_certificates_download" ]
|
public_deps = [ "//Userland/Libraries/LibTLS:ca_certificates_download" ]
|
||||||
sources = config_resources
|
sources = cacert
|
||||||
outputs = [ "{{bundle_resources_dir}}/ladybird/{{source_file_part}}" ]
|
outputs = [ "{{bundle_resources_dir}}/ladybird/{{source_file_part}}" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bundle_data("ladybird_config_resources") {
|
||||||
|
sources = config_resources
|
||||||
|
outputs = [
|
||||||
|
"{{bundle_resources_dir}}/ladybird/default-config/{{source_file_part}}",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
action("ladybird_create_icon") {
|
action("ladybird_create_icon") {
|
||||||
script = "//Meta/gn/build/invoke_process_with_args.py"
|
script = "//Meta/gn/build/invoke_process_with_args.py"
|
||||||
icon_path = "//Ladybird/Icons/macos/app_icon.iconset"
|
icon_path = "//Ladybird/Icons/macos/app_icon.iconset"
|
||||||
|
@ -527,6 +544,7 @@ if (current_os != "mac") {
|
||||||
":ladybird_bundle_executables",
|
":ladybird_bundle_executables",
|
||||||
":ladybird_bundle_info_plist",
|
":ladybird_bundle_info_plist",
|
||||||
":ladybird_bundle_libs",
|
":ladybird_bundle_libs",
|
||||||
|
":ladybird_cacert",
|
||||||
":ladybird_config_resources",
|
":ladybird_config_resources",
|
||||||
":ladybird_emoji",
|
":ladybird_emoji",
|
||||||
":ladybird_fonts",
|
":ladybird_fonts",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue