diff --git a/.github/tour.sh b/.github/tour.sh
new file mode 100755
index 00000000..e516f1ef
--- /dev/null
+++ b/.github/tour.sh
@@ -0,0 +1,81 @@
+#!/bin/bash -ex
+echo Clone tester repo.
+git clone https://github.com/John-LittleBearLabs/ipfs_client_clitester.git
+
+echo Install dependencies.
+sudo apt-get update
+sudo apt-get install --yes cmake ninja-build binutils libc6{,-dev}
+pip3 install conan
+conan profile detect || echo "Profile detection failed. Perhaps the default profile already existed - perhaps this user has already done some conan-based builds."
+
+echo Build conan library
+conan create --build=missing ipfs_chromium/library/
+
+echo Configure clitester
+mkdir tester_build
+cmake \
+ -G Ninja \
+ -S ipfs_client_clitester \
+ -B tester_build \
+ -D CMAKE_BUILD_TYPE=Release
+
+echo Build clitester
+cmake --build tester_build --config Release
+
+echo Start test server
+( timeout 3600 python3 ./ipfs_chromium/test_data/test_server.py 8080 2>&1 | tee server.log & ) &
+for t in 1{0..9}
+do
+ if grep -n . server.log
+ then
+ break
+ elif curl -m $t 'http://localhost:8080/ping'
+ then
+ sleep 1
+ else
+ sleep ${t}
+ fi
+done
+
+function url_case() {
+ echo "url_case(" "${@}" ")"
+ if timeout 360 ./tester_build/clitester warning "${1}://${2}"
+ then
+ echo clitester exited with successful status
+ else
+ echo "Directly reported error code from clitester run - usually means timeout killed it. " "${@}"
+ exit 7
+ fi
+ n=`sed 's,[^A-Za-z0-9\.],_,g' <<< ${2}`
+ if cat "_${1}_${n}" | md5sum | cut -d ' ' -f 1 > actual
+ then
+ ls -lrth _ip?s_*
+ if [ $# -ge 3 ]
+ then
+ echo "${3}" > expected
+ if diff actual expected
+ then
+ echo good
+ else
+ echo "Got wrong result: " "${@}"
+ exit 8
+ fi
+ fi
+ else
+ grep -n . server.log || sleep 1
+ ls -lrth _ip?s_*
+ echo "Failure: ${*}"
+ exit 9
+ fi
+}
+
+url_case ipfs bafkqacdjmrsw45djor4q ff483d1ff591898a9942916050d2ca3f 'Identity (inlined) CID'
+
+url_case ipfs baguqeerah2nswg7r2pvlpbnsz5y4c4pr4wsgbzixdl632w5qxvedqzryf54q 7750fd7b0928f007e1d181763c0dbdb5 'A DAG-JSON document. The block itself md5s to b92348005af4ae4795e6f312844fb359, but the response we are hashing here is an HTML preview page. This does mean this test breaks if you make the preview less ugly.'
+
+url_case ipns en.wikipedia-on-ipfs.org/I/HFE_Too_Slow_1.JPG.webp 09c09b2654e8529740b5a7625e39e0c8 'An image fetched through DNSLink and HAMT sharded directories.'
+url_case ipfs bafybeieb33pqideyl5ncd33kho622thym5rqv6sujrmelcuhkjlf2hdpu4/Big%20Buck%20Bunny.webm 06d51286e56badb4455594ebed6daba2 'A large UnixFS file - several hundred blocks.'
+url_case ipns k51qzi5uqu5dijv526o4z2z10ejylnel0bfvrtw53itcmsecffo8yf0zb4g9gi/symlinks/relative_link.txt cfe9b69523140b5b5e63874a8e4997e4 'A relative symlink resolves successfully to the file pointed to.'
+
+echo Stop test server.
+killall python3 2>/dev/null || true
diff --git a/.github/ut.sh b/.github/ut.sh
new file mode 100755
index 00000000..2b7cdd38
--- /dev/null
+++ b/.github/ut.sh
@@ -0,0 +1,19 @@
+#!/bin/bash -ex
+
+echo Install dependencies
+ sudo apt-get update
+ sudo apt-get install --yes cmake ninja-build lcov binutils doxygen graphviz libc6{,-dev} valgrind
+ npm install -g @marp-team/marp-cli
+
+echo Configure
+ mkdir build
+ cmake \
+ -G Ninja \
+ -S ipfs_chromium \
+ -B build \
+ -D CMAKE_BUILD_TYPE=Debug
+
+echo Run Tests
+ cmake --build build --config Debug --target run_tests
+echo Generate Coverage Report
+ cmake --build build --config Debug --target cov
diff --git a/.github/workflows/library.yml b/.github/workflows/library.yml
index b28249cd..0605c056 100644
--- a/.github/workflows/library.yml
+++ b/.github/workflows/library.yml
@@ -4,13 +4,24 @@ on:
release:
types: [created]
jobs:
- test:
- uses: little-bear-labs/ipfs-chromium/.github/workflows/ut.yml@flows
- tour:
- uses: little-bear-labs/ipfs-chromium/.github/workflows/tour.yml@flows
+ prechecks:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout ipfs_chromium
+ uses: actions/checkout@v4
+ with:
+ path: 'ipfs_chromium'
+ - name: Run Unit Tests
+ run: ./ipfs_chromium/.github/ut.sh
+ - name: Tour de IPFS
+ run: ./ipfs_chromium/.github/tour.sh
+ - name: Upload coverage reports to Codecov.com
+ uses: codecov/codecov-action@v3
+ with:
+ files: build/library/cov.info
build:
name: ${{ matrix.config.name }}
- needs: [test, tour]
+ needs: [prechecks]
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: true
@@ -18,7 +29,7 @@ jobs:
config:
- {
name: "macOS",
- os: macos-12,
+ os: macos-latest,
build_type: "Release",
cc: "clang",
cxx: "clang++",
diff --git a/.github/workflows/tour.yml b/.github/workflows/tour.yml
index f712526f..ac17d3e1 100644
--- a/.github/workflows/tour.yml
+++ b/.github/workflows/tour.yml
@@ -11,74 +11,6 @@ jobs:
uses: actions/checkout@v4
with:
path: 'ipfs_chromium'
- - name: Checkout ipfs_client_clitester
- uses: actions/checkout@v4
- with:
- path: 'ipfs_client_clitester'
- repository: 'John-LittleBearLabs/ipfs_client_clitester'
- - name: Install dependencies
- shell: bash
- run: |
- sudo apt-get update
- sudo apt-get install --yes cmake ninja-build binutils libc6{,-dev}
- pip3 install conan
- conan profile detect
- - name: Build conan_lib
- run: |
- conan create ipfs_chromium/library/
- - name: Configure clitester
- shell: bash
- run: |
- mkdir tester_build
- set +e
- cmake \
- -G Ninja \
- -S ipfs_client_clitester \
- -B tester_build \
- -D CMAKE_BUILD_TYPE=Release
- - name: Build clitester
- shell: bash
- run: cmake --build tester_build --config Release
- - name: Runit
- shell: bash
- run: |
- set -ex
- ( timeout 3600 python3 ./ipfs_chromium/test_data/test_server.py 8080 2>&1 | tee server.log & ) &
- for t in 1{0..9}
- do
- if grep -n . server.log
- then
- break
- elif curl -m $t 'http://localhost:8080/ping'
- then
- sleep 1
- else
- sleep ${t}
- fi
- done
- function url_case() {
- echo "url_case(" "${@}" ")"
- timeout 360 ./tester_build/clitester note "${1}://${2}"
- n=`sed 's,[^A-Za-z0-9\.],_,g' <<< ${2}`
- if cat "_${1}_${n}" | md5sum | cut -d ' ' -f 1 > actual
- then
- ls -lrth _ip?s_*
- if [ $# -ge 3 ]
- then
- echo "${3}" > expected
- diff actual expected
- fi
- else
- grep -n . server.log || sleep 1
- ls -lrth _ip?s_*
- exit 9
- fi
- }
- url_case ipfs bafkqacdjmrsw45djor4q ff483d1ff591898a9942916050d2ca3f
+ - name: Run committed script
+ run: ./ipfs_chromium/.github/tour.sh
- true the block itself md5s to b92348005af4ae4795e6f312844fb359, but the response is an HTML preview page
- url_case ipfs baguqeerah2nswg7r2pvlpbnsz5y4c4pr4wsgbzixdl632w5qxvedqzryf54q 7750fd7b0928f007e1d181763c0dbdb5
-
- url_case ipns en.wikipedia-on-ipfs.org/I/HFE_Too_Slow_1.JPG.webp 8238a73ddb12e56f8f3879cc91d2739e
- url_case ipfs bafybeieb33pqideyl5ncd33kho622thym5rqv6sujrmelcuhkjlf2hdpu4/Big%20Buck%20Bunny.webm 06d51286e56badb4455594ebed6daba2
- killall python3 2>/dev/null || true
diff --git a/.github/workflows/ut.yml b/.github/workflows/ut.yml
index 72564395..887091fb 100644
--- a/.github/workflows/ut.yml
+++ b/.github/workflows/ut.yml
@@ -11,26 +11,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- - name: Install dependencies
- run: |
- sudo apt-get update
- sudo apt-get install --yes cmake ninja-build lcov binutils doxygen graphviz libc6{,-dev} valgrind
- npm install -g @marp-team/marp-cli
- - name: Configure
- shell: bash
- run: |
- mkdir build
- cmake \
- -G Ninja \
- -S . \
- -B build \
- -D CMAKE_BUILD_TYPE=Debug
- - name: Run Tests
- shell: bash
- run: cmake --build build --config Debug --target run_tests
- - name: Generate Coverage Report
+ with:
+ path: 'ipfs_chromium'
+ - name: Run versioned script
shell: bash
- run: cmake --build build --config Debug --target cov
+ run: ./ipfs_chromium/.github/ut.sh
- name: Upload coverage reports to Codecov.com
uses: codecov/codecov-action@v3
with:
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
index 79ee123c..a55e7a17 100644
--- a/.idea/codeStyles/codeStyleConfig.xml
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/chromium_edits/120.0.6099.71/url/url_util.cc.patch b/chromium_edits/120.0.6099.71/url/url_util.cc.patch
deleted file mode 100644
index 0332e847..00000000
--- a/chromium_edits/120.0.6099.71/url/url_util.cc.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-diff --git a/url/url_util.cc b/url/url_util.cc
-index 9258cfcfada47..daf10e4c3b741 100644
---- a/url/url_util.cc
-+++ b/url/url_util.cc
-@@ -277,6 +277,12 @@ bool DoCanonicalize(const CHAR* spec,
- charset_converter, output,
- output_parsed);
-
-+ } else if (DoCompareSchemeComponent(spec, scheme, "ipfs")) {
-+ // Switch multibase away from case-sensitive ones before continuing canonicalization.
-+ ParseStandardURL(spec, spec_len, &parsed_input);
-+ success = CanonicalizeIpfsURL(spec, spec_len, parsed_input, scheme_type,
-+ charset_converter, output, output_parsed);
-+
- } else if (DoIsStandard(spec, scheme, &scheme_type)) {
- // All "normal" URLs.
- ParseStandardURL(spec, spec_len, &parsed_input);
diff --git a/chromium_edits/122.0.6170.3/chrome/browser/ipfs_extra_parts.cc b/chromium_edits/122.0.6170.3/chrome/browser/ipfs_extra_parts.cc
new file mode 100644
index 00000000..90d2596f
--- /dev/null
+++ b/chromium_edits/122.0.6170.3/chrome/browser/ipfs_extra_parts.cc
@@ -0,0 +1,10 @@
+#include "ipfs_extra_parts.h"
+
+#include "profiles/profile.h"
+
+#include
+
+void IpfsExtraParts::PostProfileInit(Profile* profile, bool /* is_initial_profile */ ) {
+ DCHECK(profile);
+ ipfs::InterRequestState::CreateForBrowserContext(profile, profile->GetPrefs());
+}
diff --git a/chromium_edits/122.0.6170.3/chrome/browser/ipfs_extra_parts.h b/chromium_edits/122.0.6170.3/chrome/browser/ipfs_extra_parts.h
new file mode 100644
index 00000000..2059c437
--- /dev/null
+++ b/chromium_edits/122.0.6170.3/chrome/browser/ipfs_extra_parts.h
@@ -0,0 +1,10 @@
+#ifndef IPFS_EXTRA_PART_H_
+#define IPFS_EXTRA_PART_H_
+
+#include
+
+class IpfsExtraParts : public ChromeBrowserMainExtraParts {
+ void PostProfileInit(Profile* profile, bool is_initial_profile) override;
+};
+
+#endif // IPFS_EXTRA_PART_H_
diff --git a/chromium_edits/122.0.6170.3/chrome/browser/prefs/browser_prefs.cc.patch b/chromium_edits/122.0.6170.3/chrome/browser/prefs/browser_prefs.cc.patch
new file mode 100644
index 00000000..e806d5f6
--- /dev/null
+++ b/chromium_edits/122.0.6170.3/chrome/browser/prefs/browser_prefs.cc.patch
@@ -0,0 +1,36 @@
+diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
+index fc9fcf1ff478a..800961b3c8767 100644
+--- a/chrome/browser/prefs/browser_prefs.cc
++++ b/chrome/browser/prefs/browser_prefs.cc
+@@ -190,6 +190,7 @@
+ #include "printing/buildflags/buildflags.h"
+ #include "rlz/buildflags/buildflags.h"
+ #include "third_party/abseil-cpp/absl/types/optional.h"
++#include "third_party/ipfs_client/ipfs_buildflags.h"
+
+ #if BUILDFLAG(ENABLE_BACKGROUND_MODE)
+ #include "chrome/browser/background/background_mode_manager.h"
+@@ -241,6 +242,11 @@
+ #include "chrome/browser/pdf/pdf_pref_names.h"
+ #endif // BUILDFLAG(ENABLE_PDF)
+
++#if BUILDFLAG(ENABLE_IPFS)
++#include "components/ipfs/ipfs_features.h"
++#include "components/ipfs/preferences.h"
++#endif
++
+ #if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
+ #include "chrome/browser/screen_ai/pref_names.h"
+ #endif
+@@ -1658,6 +1664,11 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
+ IncognitoModePrefs::RegisterProfilePrefs(registry);
+ invalidation::PerUserTopicSubscriptionManager::RegisterProfilePrefs(registry);
+ invalidation::InvalidatorRegistrarWithMemory::RegisterProfilePrefs(registry);
++#if BUILDFLAG(ENABLE_IPFS)
++ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) {
++ ipfs::RegisterPreferences(registry);
++ }
++#endif
+ language::LanguagePrefs::RegisterProfilePrefs(registry);
+ login_detection::prefs::RegisterProfilePrefs(registry);
+ lookalikes::RegisterProfilePrefs(registry);
diff --git a/chromium_edits/122.0.6170.3/url/url_canon_ipfs.cc b/chromium_edits/122.0.6170.3/url/url_canon_ipfs.cc
index da3a5f03..9511e3f5 100644
--- a/chromium_edits/122.0.6170.3/url/url_canon_ipfs.cc
+++ b/chromium_edits/122.0.6170.3/url/url_canon_ipfs.cc
@@ -1,14 +1,10 @@
#include "url_canon_internal.h"
-#include
+#include
#include
#include
-namespace m = libp2p::multi;
-using Cid = m::ContentIdentifier;
-using CidCodec = m::ContentIdentifierCodec;
-
bool url::CanonicalizeIpfsURL(const char* spec,
int spec_len,
const Parsed& parsed,
@@ -22,30 +18,17 @@ bool url::CanonicalizeIpfsURL(const char* spec,
if ( parsed.host.len < 1 ) {
return false;
}
- std::string cid_str{ spec + parsed.host.begin, static_cast(parsed.host.len) };
- auto maybe_cid = CidCodec::fromString(cid_str);
- if ( !maybe_cid.has_value() ) {
- auto e = libp2p::multi::Stringify(maybe_cid.error());
- std::ostringstream err;
- err << e << ' '
- << std::string_view{spec,static_cast(spec_len)};
- maybe_cid = ipfs::id_cid::forText( err.str() );
- }
- auto cid = maybe_cid.value();
- if ( cid.version == Cid::Version::V0 ) {
- //TODO dcheck content_type == DAG_PB && content_address.getType() == sha256
- cid = Cid{
- Cid::Version::V1,
- cid.content_type,
- cid.content_address
- };
+ std::string_view cid_str{ spec + parsed.host.begin, static_cast(parsed.host.len) };
+ auto cid = ipfs::Cid(cid_str);
+ if ( !cid.valid() ) {
+ cid = ipfs::id_cid::forText( std::string{cid_str} + " is not a valid CID." );
}
- auto as_str = CidCodec::toString(cid);
- if ( !as_str.has_value() ) {
+ auto as_str = cid.to_string();
+ if ( as_str.empty() ) {
return false;
}
std::string stdurl{ spec, static_cast(parsed.host.begin) };
- stdurl.append( as_str.value() );
+ stdurl.append( as_str );
stdurl.append( spec + parsed.host.end(), spec_len - parsed.host.end() );
spec = stdurl.data();
spec_len = static_cast(stdurl.size());
diff --git a/chromium_edits/122.0.6182.0/chrome/browser/BUILD.gn.patch b/chromium_edits/122.0.6182.0/chrome/browser/BUILD.gn.patch
index 361a5a1c..680271b3 100644
--- a/chromium_edits/122.0.6182.0/chrome/browser/BUILD.gn.patch
+++ b/chromium_edits/122.0.6182.0/chrome/browser/BUILD.gn.patch
@@ -1,5 +1,5 @@
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
-index 0fb94c9b9b67e..df25995c80baa 100644
+index a188528a9e262..88df13b162858 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -40,6 +40,7 @@ import("//rlz/buildflags/buildflags.gni")
@@ -10,11 +10,23 @@ index 0fb94c9b9b67e..df25995c80baa 100644
import("//third_party/protobuf/proto_library.gni")
import("//third_party/webrtc/webrtc.gni")
import("//third_party/widevine/cdm/widevine.gni")
-@@ -2596,6 +2597,10 @@ static_library("browser") {
+@@ -1912,7 +1913,6 @@ static_library("browser") {
+ "user_education/user_education_service_factory.h",
+ ]
+ }
+-
+ configs += [
+ "//build/config/compiler:wexit_time_destructors",
+ "//build/config:precompiled_headers",
+@@ -2604,6 +2604,14 @@ static_library("browser") {
]
}
+ if (enable_ipfs) {
++ sources += [
++ "ipfs_extra_parts.cc",
++ "ipfs_extra_parts.h",
++ ]
+ deps += [ "//components/ipfs" ]
+ }
+
diff --git a/chromium_edits/122.0.6182.0/chrome/browser/about_flags.cc.patch b/chromium_edits/122.0.6182.0/chrome/browser/about_flags.cc.patch
index addab35d..a9dd9da9 100644
--- a/chromium_edits/122.0.6182.0/chrome/browser/about_flags.cc.patch
+++ b/chromium_edits/122.0.6182.0/chrome/browser/about_flags.cc.patch
@@ -1,5 +1,5 @@
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
-index 52ecc40da0226..42d45b977471e 100644
+index a7907d8b188d8..68a96934ccf48 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -213,6 +213,7 @@
@@ -10,7 +10,7 @@ index 52ecc40da0226..42d45b977471e 100644
#include "ui/accessibility/accessibility_features.h"
#include "ui/accessibility/accessibility_switches.h"
#include "ui/base/ui_base_features.h"
-@@ -313,6 +314,10 @@
+@@ -308,6 +309,10 @@
#include "extensions/common/switches.h"
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
@@ -21,7 +21,7 @@ index 52ecc40da0226..42d45b977471e 100644
#if BUILDFLAG(ENABLE_PDF)
#include "pdf/pdf_features.h"
#endif
-@@ -9851,6 +9856,14 @@ const FeatureEntry kFeatureEntries[] = {
+@@ -9731,6 +9736,14 @@ const FeatureEntry kFeatureEntries[] = {
flag_descriptions::kOmitCorsClientCertDescription, kOsAll,
FEATURE_VALUE_TYPE(network::features::kOmitCorsClientCert)},
diff --git a/chromium_edits/122.0.6182.0/chrome/browser/chrome_content_browser_client.cc.patch b/chromium_edits/122.0.6182.0/chrome/browser/chrome_content_browser_client.cc.patch
index f212961c..157b9909 100644
--- a/chromium_edits/122.0.6182.0/chrome/browser/chrome_content_browser_client.cc.patch
+++ b/chromium_edits/122.0.6182.0/chrome/browser/chrome_content_browser_client.cc.patch
@@ -1,8 +1,8 @@
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
-index a9b87ac2fcd74..987686c621664 100644
+index d3d67d83a514e..a5b1ef6339211 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
-@@ -377,6 +377,7 @@
+@@ -378,6 +378,7 @@
#include "third_party/blink/public/common/switches.h"
#include "third_party/blink/public/mojom/browsing_topics/browsing_topics.mojom.h"
#include "third_party/blink/public/public_buildflags.h"
@@ -10,11 +10,12 @@ index a9b87ac2fcd74..987686c621664 100644
#include "third_party/widevine/cdm/buildflags.h"
#include "ui/base/clipboard/clipboard_format_type.h"
#include "ui/base/l10n/l10n_util.h"
-@@ -499,6 +500,12 @@
+@@ -500,6 +501,13 @@
#include "chrome/browser/fuchsia/chrome_browser_main_parts_fuchsia.h"
#endif
+#if BUILDFLAG(ENABLE_IPFS)
++#include "chrome/browser/ipfs_extra_parts.h"
+#include "components/ipfs/interceptor.h"
+#include "components/ipfs/ipfs_features.h"
+#include "components/ipfs/url_loader_factory.h"
@@ -23,7 +24,19 @@ index a9b87ac2fcd74..987686c621664 100644
#if BUILDFLAG(IS_CHROMEOS)
#include "base/debug/leak_annotations.h"
#include "chrome/browser/apps/app_service/app_install/app_install_navigation_throttle.h"
-@@ -6157,12 +6164,23 @@ void ChromeContentBrowserClient::
+@@ -1712,6 +1720,11 @@ ChromeContentBrowserClient::CreateBrowserMainParts(bool is_integration_test) {
+ main_parts->AddParts(
+ std::make_unique());
+
++#if BUILDFLAG(ENABLE_IPFS)
++ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) {
++ main_parts->AddParts(std::make_unique());
++ }
++#endif
+ return main_parts;
+ }
+
+@@ -6084,12 +6097,25 @@ void ChromeContentBrowserClient::
const absl::optional& request_initiator_origin,
NonNetworkURLLoaderFactoryMap* factories) {
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(ENABLE_EXTENSIONS) || \
@@ -38,18 +51,20 @@ index a9b87ac2fcd74..987686c621664 100644
+#if BUILDFLAG(ENABLE_IPFS)
+ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) {
+ network::mojom::URLLoaderFactory* default_factory = g_browser_process->system_network_context_manager()->GetURLLoaderFactory();
++ auto* context = web_contents->GetBrowserContext();
+ ipfs::IpfsURLLoaderFactory::Create(
+ factories,
-+ web_contents->GetBrowserContext(),
++ context,
+ default_factory,
-+ GetSystemNetworkContext()
++ GetSystemNetworkContext(),
++ Profile::FromBrowserContext(context)->GetPrefs()
+ );
+ }
+#endif // BUILDFLAG(ENABLE_IPFS)
#if BUILDFLAG(IS_CHROMEOS_ASH)
if (web_contents) {
-@@ -6304,6 +6322,11 @@ ChromeContentBrowserClient::WillCreateURLLoaderRequestInterceptors(
+@@ -6231,6 +6257,11 @@ ChromeContentBrowserClient::WillCreateURLLoaderRequestInterceptors(
scoped_refptr navigation_response_task_runner) {
std::vector>
interceptors;
diff --git a/chromium_edits/122.0.6182.0/chrome/browser/flag-metadata.json.patch b/chromium_edits/122.0.6182.0/chrome/browser/flag-metadata.json.patch
index b1fe0af9..1894add3 100644
--- a/chromium_edits/122.0.6182.0/chrome/browser/flag-metadata.json.patch
+++ b/chromium_edits/122.0.6182.0/chrome/browser/flag-metadata.json.patch
@@ -1,8 +1,8 @@
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
-index 5e02e86a700cb..1f06bded184bf 100644
+index 0b51e78fcb8b9..9571b2c92c57f 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
-@@ -2956,6 +2956,11 @@
+@@ -2948,6 +2948,11 @@
"owners": [ "hanxi@chromium.org", "wychen@chromium.org" ],
"expiry_milestone": 130
},
diff --git a/chromium_edits/122.0.6182.0/chrome/browser/flag_descriptions.cc.patch b/chromium_edits/122.0.6182.0/chrome/browser/flag_descriptions.cc.patch
index 15c80675..7f1bc89b 100644
--- a/chromium_edits/122.0.6182.0/chrome/browser/flag_descriptions.cc.patch
+++ b/chromium_edits/122.0.6182.0/chrome/browser/flag_descriptions.cc.patch
@@ -1,5 +1,5 @@
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
-index d6073d3514930..f80f1330f9865 100644
+index b2992e30f9811..f92d8a322b634 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -288,6 +288,11 @@ const char kEnableBenchmarkingDescription[] =
diff --git a/chromium_edits/122.0.6182.0/chrome/browser/flag_descriptions.h.patch b/chromium_edits/122.0.6182.0/chrome/browser/flag_descriptions.h.patch
index f5e7ba0e..d83ce8f4 100644
--- a/chromium_edits/122.0.6182.0/chrome/browser/flag_descriptions.h.patch
+++ b/chromium_edits/122.0.6182.0/chrome/browser/flag_descriptions.h.patch
@@ -1,5 +1,5 @@
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
-index 4df49302f94b5..f7d3b65112d8b 100644
+index ad76d832395a1..438facecff519 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -23,6 +23,7 @@
diff --git a/chromium_edits/122.0.6182.0/chrome/browser/ipfs_extra_parts.cc b/chromium_edits/122.0.6182.0/chrome/browser/ipfs_extra_parts.cc
new file mode 100644
index 00000000..90d2596f
--- /dev/null
+++ b/chromium_edits/122.0.6182.0/chrome/browser/ipfs_extra_parts.cc
@@ -0,0 +1,10 @@
+#include "ipfs_extra_parts.h"
+
+#include "profiles/profile.h"
+
+#include
+
+void IpfsExtraParts::PostProfileInit(Profile* profile, bool /* is_initial_profile */ ) {
+ DCHECK(profile);
+ ipfs::InterRequestState::CreateForBrowserContext(profile, profile->GetPrefs());
+}
diff --git a/chromium_edits/122.0.6182.0/chrome/browser/ipfs_extra_parts.h b/chromium_edits/122.0.6182.0/chrome/browser/ipfs_extra_parts.h
new file mode 100644
index 00000000..2059c437
--- /dev/null
+++ b/chromium_edits/122.0.6182.0/chrome/browser/ipfs_extra_parts.h
@@ -0,0 +1,10 @@
+#ifndef IPFS_EXTRA_PART_H_
+#define IPFS_EXTRA_PART_H_
+
+#include
+
+class IpfsExtraParts : public ChromeBrowserMainExtraParts {
+ void PostProfileInit(Profile* profile, bool is_initial_profile) override;
+};
+
+#endif // IPFS_EXTRA_PART_H_
diff --git a/chromium_edits/122.0.6182.0/chrome/browser/prefs/browser_prefs.cc.patch b/chromium_edits/122.0.6182.0/chrome/browser/prefs/browser_prefs.cc.patch
new file mode 100644
index 00000000..e806d5f6
--- /dev/null
+++ b/chromium_edits/122.0.6182.0/chrome/browser/prefs/browser_prefs.cc.patch
@@ -0,0 +1,36 @@
+diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
+index fc9fcf1ff478a..800961b3c8767 100644
+--- a/chrome/browser/prefs/browser_prefs.cc
++++ b/chrome/browser/prefs/browser_prefs.cc
+@@ -190,6 +190,7 @@
+ #include "printing/buildflags/buildflags.h"
+ #include "rlz/buildflags/buildflags.h"
+ #include "third_party/abseil-cpp/absl/types/optional.h"
++#include "third_party/ipfs_client/ipfs_buildflags.h"
+
+ #if BUILDFLAG(ENABLE_BACKGROUND_MODE)
+ #include "chrome/browser/background/background_mode_manager.h"
+@@ -241,6 +242,11 @@
+ #include "chrome/browser/pdf/pdf_pref_names.h"
+ #endif // BUILDFLAG(ENABLE_PDF)
+
++#if BUILDFLAG(ENABLE_IPFS)
++#include "components/ipfs/ipfs_features.h"
++#include "components/ipfs/preferences.h"
++#endif
++
+ #if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
+ #include "chrome/browser/screen_ai/pref_names.h"
+ #endif
+@@ -1658,6 +1664,11 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
+ IncognitoModePrefs::RegisterProfilePrefs(registry);
+ invalidation::PerUserTopicSubscriptionManager::RegisterProfilePrefs(registry);
+ invalidation::InvalidatorRegistrarWithMemory::RegisterProfilePrefs(registry);
++#if BUILDFLAG(ENABLE_IPFS)
++ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) {
++ ipfs::RegisterPreferences(registry);
++ }
++#endif
+ language::LanguagePrefs::RegisterProfilePrefs(registry);
+ login_detection::prefs::RegisterProfilePrefs(registry);
+ lookalikes::RegisterProfilePrefs(registry);
diff --git a/chromium_edits/122.0.6182.0/url/url_canon.h.patch b/chromium_edits/122.0.6182.0/url/url_canon.h.patch
index 24ae1ba4..0d4fbfdf 100644
--- a/chromium_edits/122.0.6182.0/url/url_canon.h.patch
+++ b/chromium_edits/122.0.6182.0/url/url_canon.h.patch
@@ -1,8 +1,8 @@
diff --git a/url/url_canon.h b/url/url_canon.h
-index d3a7fabf09fa8..06db17242248f 100644
+index 913b3685c6fec..3c3c55e580564 100644
--- a/url/url_canon.h
+++ b/url/url_canon.h
-@@ -697,6 +697,23 @@ bool CanonicalizeMailtoURL(const char16_t* spec,
+@@ -792,6 +792,23 @@ bool CanonicalizeMailtoURL(const char16_t* spec,
CanonOutput* output,
Parsed* new_parsed);
diff --git a/chromium_edits/120.0.6099.71/chrome/browser/BUILD.gn.patch b/chromium_edits/122.0.6194.0/chrome/browser/BUILD.gn.patch
similarity index 72%
rename from chromium_edits/120.0.6099.71/chrome/browser/BUILD.gn.patch
rename to chromium_edits/122.0.6194.0/chrome/browser/BUILD.gn.patch
index 6045c760..3f644ee6 100644
--- a/chromium_edits/120.0.6099.71/chrome/browser/BUILD.gn.patch
+++ b/chromium_edits/122.0.6194.0/chrome/browser/BUILD.gn.patch
@@ -1,8 +1,8 @@
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
-index 44d3b5e543101..ece46a3db0bea 100644
+index ea574b1863e18..7239008b4e215 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
-@@ -40,6 +40,7 @@ import("//rlz/buildflags/buildflags.gni")
+@@ -39,6 +39,7 @@ import("//rlz/buildflags/buildflags.gni")
import("//sandbox/features.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//third_party/blink/public/public_features.gni")
@@ -10,11 +10,15 @@ index 44d3b5e543101..ece46a3db0bea 100644
import("//third_party/protobuf/proto_library.gni")
import("//third_party/webrtc/webrtc.gni")
import("//third_party/widevine/cdm/widevine.gni")
-@@ -2660,6 +2661,10 @@ static_library("browser") {
+@@ -2615,6 +2616,14 @@ static_library("browser") {
]
}
+ if (enable_ipfs) {
++ sources += [
++ "ipfs_extra_parts.cc",
++ "ipfs_extra_parts.h",
++ ]
+ deps += [ "//components/ipfs" ]
+ }
+
diff --git a/chromium_edits/120.0.6099.71/chrome/browser/about_flags.cc.patch b/chromium_edits/122.0.6194.0/chrome/browser/about_flags.cc.patch
similarity index 88%
rename from chromium_edits/120.0.6099.71/chrome/browser/about_flags.cc.patch
rename to chromium_edits/122.0.6194.0/chrome/browser/about_flags.cc.patch
index bec369fa..6e4ac390 100644
--- a/chromium_edits/120.0.6099.71/chrome/browser/about_flags.cc.patch
+++ b/chromium_edits/122.0.6194.0/chrome/browser/about_flags.cc.patch
@@ -1,16 +1,16 @@
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
-index 8736a91998f6b..da556109dcbb1 100644
+index b076446400486..2b2f2724d3b75 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
-@@ -213,6 +213,7 @@
+@@ -214,6 +214,7 @@
#include "third_party/blink/public/common/features_generated.h"
#include "third_party/blink/public/common/forcedark/forcedark_switches.h"
#include "third_party/blink/public/common/switches.h"
+#include "third_party/ipfs_client/ipfs_buildflags.h"
#include "ui/accessibility/accessibility_features.h"
#include "ui/accessibility/accessibility_switches.h"
- #include "ui/base/ui_base_features.h"
-@@ -314,6 +315,10 @@
+ #include "ui/base/ozone_buildflags.h"
+@@ -310,6 +311,10 @@
#include "extensions/common/switches.h"
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
@@ -21,7 +21,7 @@ index 8736a91998f6b..da556109dcbb1 100644
#if BUILDFLAG(ENABLE_PDF)
#include "pdf/pdf_features.h"
#endif
-@@ -9922,6 +9927,14 @@ const FeatureEntry kFeatureEntries[] = {
+@@ -9459,6 +9464,14 @@ const FeatureEntry kFeatureEntries[] = {
flag_descriptions::kOmitCorsClientCertDescription, kOsAll,
FEATURE_VALUE_TYPE(network::features::kOmitCorsClientCert)},
diff --git a/chromium_edits/120.0.6099.71/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch b/chromium_edits/122.0.6194.0/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch
similarity index 100%
rename from chromium_edits/120.0.6099.71/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch
rename to chromium_edits/122.0.6194.0/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.patch
diff --git a/chromium_edits/120.0.6099.71/chrome/browser/chrome_content_browser_client.cc.patch b/chromium_edits/122.0.6194.0/chrome/browser/chrome_content_browser_client.cc.patch
similarity index 72%
rename from chromium_edits/120.0.6099.71/chrome/browser/chrome_content_browser_client.cc.patch
rename to chromium_edits/122.0.6194.0/chrome/browser/chrome_content_browser_client.cc.patch
index 580e2fee..2f68a7f3 100644
--- a/chromium_edits/120.0.6099.71/chrome/browser/chrome_content_browser_client.cc.patch
+++ b/chromium_edits/122.0.6194.0/chrome/browser/chrome_content_browser_client.cc.patch
@@ -1,17 +1,8 @@
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
-index d9c675c8aca73..cb360f4e7ca5b 100644
+index 667370e623970..c09550c753e8e 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
-@@ -228,6 +228,8 @@
- #include "components/error_page/common/localized_error.h"
- #include "components/error_page/content/browser/net_error_auto_reloader.h"
- #include "components/google/core/common/google_switches.h"
-+#include "components/ipfs/interceptor.h"
-+#include "components/ipfs/url_loader_factory.h"
- #include "components/keep_alive_registry/keep_alive_types.h"
- #include "components/keep_alive_registry/scoped_keep_alive.h"
- #include "components/language/core/browser/pref_names.h"
-@@ -364,6 +366,7 @@
+@@ -377,6 +377,7 @@
#include "third_party/blink/public/common/switches.h"
#include "third_party/blink/public/mojom/browsing_topics/browsing_topics.mojom.h"
#include "third_party/blink/public/public_buildflags.h"
@@ -19,11 +10,12 @@ index d9c675c8aca73..cb360f4e7ca5b 100644
#include "third_party/widevine/cdm/buildflags.h"
#include "ui/base/clipboard/clipboard_format_type.h"
#include "ui/base/l10n/l10n_util.h"
-@@ -487,6 +490,12 @@
+@@ -499,6 +500,13 @@
#include "chrome/browser/fuchsia/chrome_browser_main_parts_fuchsia.h"
#endif
+#if BUILDFLAG(ENABLE_IPFS)
++#include "chrome/browser/ipfs_extra_parts.h"
+#include "components/ipfs/interceptor.h"
+#include "components/ipfs/ipfs_features.h"
+#include "components/ipfs/url_loader_factory.h"
@@ -31,8 +23,20 @@ index d9c675c8aca73..cb360f4e7ca5b 100644
+
#if BUILDFLAG(IS_CHROMEOS)
#include "base/debug/leak_annotations.h"
- #include "chrome/browser/apps/intent_helper/chromeos_disabled_apps_throttle.h"
-@@ -6180,12 +6189,23 @@ void ChromeContentBrowserClient::
+ #include "chrome/browser/apps/app_service/app_install/app_install_navigation_throttle.h"
+@@ -1711,6 +1719,11 @@ ChromeContentBrowserClient::CreateBrowserMainParts(bool is_integration_test) {
+ main_parts->AddParts(
+ std::make_unique());
+
++#if BUILDFLAG(ENABLE_IPFS)
++ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) {
++ main_parts->AddParts(std::make_unique());
++ }
++#endif
+ return main_parts;
+ }
+
+@@ -6075,12 +6088,25 @@ void ChromeContentBrowserClient::
const absl::optional& request_initiator_origin,
NonNetworkURLLoaderFactoryMap* factories) {
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(ENABLE_EXTENSIONS) || \
@@ -42,23 +46,24 @@ index d9c675c8aca73..cb360f4e7ca5b 100644
RenderFrameHost::FromID(render_process_id, render_frame_id);
WebContents* web_contents = WebContents::FromRenderFrameHost(frame_host);
#endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(ENABLE_EXTENSIONS) || \
-- // !BUILDFLAG(IS_ANDROID)
-+ // !BUILDFLAG(IS_ANDROID) || BUILDFLAG(ENABLE_IPFS)
+ // !BUILDFLAG(IS_ANDROID)
+#if BUILDFLAG(ENABLE_IPFS)
+ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) {
+ network::mojom::URLLoaderFactory* default_factory = g_browser_process->system_network_context_manager()->GetURLLoaderFactory();
++ auto* context = web_contents->GetBrowserContext();
+ ipfs::IpfsURLLoaderFactory::Create(
+ factories,
-+ web_contents->GetBrowserContext(),
++ context,
+ default_factory,
-+ GetSystemNetworkContext()
++ GetSystemNetworkContext(),
++ Profile::FromBrowserContext(context)->GetPrefs()
+ );
+ }
+#endif // BUILDFLAG(ENABLE_IPFS)
#if BUILDFLAG(IS_CHROMEOS_ASH)
if (web_contents) {
-@@ -6327,6 +6347,11 @@ ChromeContentBrowserClient::WillCreateURLLoaderRequestInterceptors(
+@@ -6222,6 +6248,11 @@ ChromeContentBrowserClient::WillCreateURLLoaderRequestInterceptors(
scoped_refptr navigation_response_task_runner) {
std::vector>
interceptors;
diff --git a/chromium_edits/120.0.6099.71/chrome/browser/flag-metadata.json.patch b/chromium_edits/122.0.6194.0/chrome/browser/flag-metadata.json.patch
similarity index 88%
rename from chromium_edits/120.0.6099.71/chrome/browser/flag-metadata.json.patch
rename to chromium_edits/122.0.6194.0/chrome/browser/flag-metadata.json.patch
index f7c408d8..75727bd8 100644
--- a/chromium_edits/120.0.6099.71/chrome/browser/flag-metadata.json.patch
+++ b/chromium_edits/122.0.6194.0/chrome/browser/flag-metadata.json.patch
@@ -1,8 +1,8 @@
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json
-index 400505f9d64e6..320b730d894c6 100644
+index 7a0c7c06f4e8e..8af9a104e1fe8 100644
--- a/chrome/browser/flag-metadata.json
+++ b/chrome/browser/flag-metadata.json
-@@ -2868,6 +2868,11 @@
+@@ -2931,6 +2931,11 @@
"owners": [ "hanxi@chromium.org", "wychen@chromium.org" ],
"expiry_milestone": 130
},
diff --git a/chromium_edits/120.0.6099.71/chrome/browser/flag_descriptions.cc.patch b/chromium_edits/122.0.6194.0/chrome/browser/flag_descriptions.cc.patch
similarity index 85%
rename from chromium_edits/120.0.6099.71/chrome/browser/flag_descriptions.cc.patch
rename to chromium_edits/122.0.6194.0/chrome/browser/flag_descriptions.cc.patch
index d021535f..a687852a 100644
--- a/chromium_edits/120.0.6099.71/chrome/browser/flag_descriptions.cc.patch
+++ b/chromium_edits/122.0.6194.0/chrome/browser/flag_descriptions.cc.patch
@@ -1,8 +1,8 @@
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
-index f92c5df0fc600..e131baa70cce2 100644
+index b4f75320e4669..fc2ef00f6eb5c 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
-@@ -248,6 +248,11 @@ const char kEnableBenchmarkingDescription[] =
+@@ -289,6 +289,11 @@ const char kEnableBenchmarkingDescription[] =
"after 3 restarts. On the third restart, the flag will appear to be off "
"but the effect is still active.";
diff --git a/chromium_edits/120.0.6099.71/chrome/browser/flag_descriptions.h.patch b/chromium_edits/122.0.6194.0/chrome/browser/flag_descriptions.h.patch
similarity index 87%
rename from chromium_edits/120.0.6099.71/chrome/browser/flag_descriptions.h.patch
rename to chromium_edits/122.0.6194.0/chrome/browser/flag_descriptions.h.patch
index e7d95550..40c0f537 100644
--- a/chromium_edits/120.0.6099.71/chrome/browser/flag_descriptions.h.patch
+++ b/chromium_edits/122.0.6194.0/chrome/browser/flag_descriptions.h.patch
@@ -1,8 +1,8 @@
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
-index 71eae84724eab..a8e4b29ee3cc5 100644
+index 65b8bcb40770c..d5ae8dca53910 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
-@@ -22,6 +22,7 @@
+@@ -23,6 +23,7 @@
#include "pdf/buildflags.h"
#include "printing/buildflags/buildflags.h"
#include "third_party/blink/public/common/buildflags.h"
@@ -10,7 +10,7 @@ index 71eae84724eab..a8e4b29ee3cc5 100644
// This file declares strings used in chrome://flags. These messages are not
// translated, because instead of end-users they target Chromium developers and
-@@ -165,6 +166,11 @@ extern const char kDownloadWarningImprovementsDescription[];
+@@ -179,6 +180,11 @@ extern const char kDownloadWarningImprovementsDescription[];
extern const char kEnableBenchmarkingName[];
extern const char kEnableBenchmarkingDescription[];
diff --git a/chromium_edits/122.0.6194.0/chrome/browser/ipfs_extra_parts.cc b/chromium_edits/122.0.6194.0/chrome/browser/ipfs_extra_parts.cc
new file mode 100644
index 00000000..90d2596f
--- /dev/null
+++ b/chromium_edits/122.0.6194.0/chrome/browser/ipfs_extra_parts.cc
@@ -0,0 +1,10 @@
+#include "ipfs_extra_parts.h"
+
+#include "profiles/profile.h"
+
+#include
+
+void IpfsExtraParts::PostProfileInit(Profile* profile, bool /* is_initial_profile */ ) {
+ DCHECK(profile);
+ ipfs::InterRequestState::CreateForBrowserContext(profile, profile->GetPrefs());
+}
diff --git a/chromium_edits/122.0.6194.0/chrome/browser/ipfs_extra_parts.h b/chromium_edits/122.0.6194.0/chrome/browser/ipfs_extra_parts.h
new file mode 100644
index 00000000..2059c437
--- /dev/null
+++ b/chromium_edits/122.0.6194.0/chrome/browser/ipfs_extra_parts.h
@@ -0,0 +1,10 @@
+#ifndef IPFS_EXTRA_PART_H_
+#define IPFS_EXTRA_PART_H_
+
+#include
+
+class IpfsExtraParts : public ChromeBrowserMainExtraParts {
+ void PostProfileInit(Profile* profile, bool is_initial_profile) override;
+};
+
+#endif // IPFS_EXTRA_PART_H_
diff --git a/chromium_edits/122.0.6194.0/chrome/browser/prefs/browser_prefs.cc.patch b/chromium_edits/122.0.6194.0/chrome/browser/prefs/browser_prefs.cc.patch
new file mode 100644
index 00000000..c32f6471
--- /dev/null
+++ b/chromium_edits/122.0.6194.0/chrome/browser/prefs/browser_prefs.cc.patch
@@ -0,0 +1,36 @@
+diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
+index 86a09cfe49376..d8e166f76179e 100644
+--- a/chrome/browser/prefs/browser_prefs.cc
++++ b/chrome/browser/prefs/browser_prefs.cc
+@@ -189,6 +189,7 @@
+ #include "printing/buildflags/buildflags.h"
+ #include "rlz/buildflags/buildflags.h"
+ #include "third_party/abseil-cpp/absl/types/optional.h"
++#include "third_party/ipfs_client/ipfs_buildflags.h"
+
+ #if BUILDFLAG(ENABLE_BACKGROUND_MODE)
+ #include "chrome/browser/background/background_mode_manager.h"
+@@ -233,6 +234,11 @@
+ #include "chrome/browser/pdf/pdf_pref_names.h"
+ #endif // BUILDFLAG(ENABLE_PDF)
+
++#if BUILDFLAG(ENABLE_IPFS)
++#include "components/ipfs/ipfs_features.h"
++#include "components/ipfs/preferences.h"
++#endif
++
+ #if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
+ #include "chrome/browser/screen_ai/pref_names.h"
+ #endif
+@@ -1678,6 +1684,11 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
+ IncognitoModePrefs::RegisterProfilePrefs(registry);
+ invalidation::PerUserTopicSubscriptionManager::RegisterProfilePrefs(registry);
+ invalidation::InvalidatorRegistrarWithMemory::RegisterProfilePrefs(registry);
++#if BUILDFLAG(ENABLE_IPFS)
++ if (base::FeatureList::IsEnabled(ipfs::kEnableIpfs)) {
++ ipfs::RegisterPreferences(registry);
++ }
++#endif
+ language::LanguagePrefs::RegisterProfilePrefs(registry);
+ login_detection::prefs::RegisterProfilePrefs(registry);
+ lookalikes::RegisterProfilePrefs(registry);
diff --git a/chromium_edits/120.0.6099.71/chrome/common/chrome_content_client.cc.patch b/chromium_edits/122.0.6194.0/chrome/common/chrome_content_client.cc.patch
similarity index 100%
rename from chromium_edits/120.0.6099.71/chrome/common/chrome_content_client.cc.patch
rename to chromium_edits/122.0.6194.0/chrome/common/chrome_content_client.cc.patch
diff --git a/chromium_edits/120.0.6099.71/components/cbor/reader.cc.patch b/chromium_edits/122.0.6194.0/components/cbor/reader.cc.patch
similarity index 100%
rename from chromium_edits/120.0.6099.71/components/cbor/reader.cc.patch
rename to chromium_edits/122.0.6194.0/components/cbor/reader.cc.patch
diff --git a/chromium_edits/120.0.6099.71/components/cbor/reader.h.patch b/chromium_edits/122.0.6194.0/components/cbor/reader.h.patch
similarity index 100%
rename from chromium_edits/120.0.6099.71/components/cbor/reader.h.patch
rename to chromium_edits/122.0.6194.0/components/cbor/reader.h.patch
diff --git a/chromium_edits/120.0.6099.71/components/cbor/reader_unittest.cc.patch b/chromium_edits/122.0.6194.0/components/cbor/reader_unittest.cc.patch
similarity index 100%
rename from chromium_edits/120.0.6099.71/components/cbor/reader_unittest.cc.patch
rename to chromium_edits/122.0.6194.0/components/cbor/reader_unittest.cc.patch
diff --git a/chromium_edits/120.0.6099.71/components/cbor/values.cc.patch b/chromium_edits/122.0.6194.0/components/cbor/values.cc.patch
similarity index 100%
rename from chromium_edits/120.0.6099.71/components/cbor/values.cc.patch
rename to chromium_edits/122.0.6194.0/components/cbor/values.cc.patch
diff --git a/chromium_edits/120.0.6099.71/components/cbor/values.h.patch b/chromium_edits/122.0.6194.0/components/cbor/values.h.patch
similarity index 100%
rename from chromium_edits/120.0.6099.71/components/cbor/values.h.patch
rename to chromium_edits/122.0.6194.0/components/cbor/values.h.patch
diff --git a/chromium_edits/120.0.6099.71/components/cbor/writer.cc.patch b/chromium_edits/122.0.6194.0/components/cbor/writer.cc.patch
similarity index 100%
rename from chromium_edits/120.0.6099.71/components/cbor/writer.cc.patch
rename to chromium_edits/122.0.6194.0/components/cbor/writer.cc.patch
diff --git a/chromium_edits/120.0.6099.71/components/cbor/writer_unittest.cc.patch b/chromium_edits/122.0.6194.0/components/cbor/writer_unittest.cc.patch
similarity index 100%
rename from chromium_edits/120.0.6099.71/components/cbor/writer_unittest.cc.patch
rename to chromium_edits/122.0.6194.0/components/cbor/writer_unittest.cc.patch
diff --git a/chromium_edits/120.0.6099.71/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch b/chromium_edits/122.0.6194.0/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch
similarity index 100%
rename from chromium_edits/120.0.6099.71/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch
rename to chromium_edits/122.0.6194.0/components/open_from_clipboard/clipboard_recent_content_generic.cc.patch
diff --git a/chromium_edits/120.0.6099.71/net/dns/dns_config_service_linux.cc.patch b/chromium_edits/122.0.6194.0/net/dns/dns_config_service_linux.cc.patch
similarity index 100%
rename from chromium_edits/120.0.6099.71/net/dns/dns_config_service_linux.cc.patch
rename to chromium_edits/122.0.6194.0/net/dns/dns_config_service_linux.cc.patch
diff --git a/chromium_edits/120.0.6099.71/third_party/blink/renderer/platform/weborigin/scheme_registry.cc.patch b/chromium_edits/122.0.6194.0/third_party/blink/renderer/platform/weborigin/scheme_registry.cc.patch
similarity index 100%
rename from chromium_edits/120.0.6099.71/third_party/blink/renderer/platform/weborigin/scheme_registry.cc.patch
rename to chromium_edits/122.0.6194.0/third_party/blink/renderer/platform/weborigin/scheme_registry.cc.patch
diff --git a/chromium_edits/120.0.6099.71/url/BUILD.gn.patch b/chromium_edits/122.0.6194.0/url/BUILD.gn.patch
similarity index 87%
rename from chromium_edits/120.0.6099.71/url/BUILD.gn.patch
rename to chromium_edits/122.0.6194.0/url/BUILD.gn.patch
index 63fb8f8b..293eb89e 100644
--- a/chromium_edits/120.0.6099.71/url/BUILD.gn.patch
+++ b/chromium_edits/122.0.6194.0/url/BUILD.gn.patch
@@ -1,5 +1,5 @@
diff --git a/url/BUILD.gn b/url/BUILD.gn
-index c525c166979d6..ce2b1ae43c0a7 100644
+index 0ac17c08dc5bc..2497d02658bb3 100644
--- a/url/BUILD.gn
+++ b/url/BUILD.gn
@@ -5,6 +5,7 @@
@@ -10,7 +10,7 @@ index c525c166979d6..ce2b1ae43c0a7 100644
import("features.gni")
import("//build/config/cronet/config.gni")
-@@ -67,6 +68,7 @@ component("url") {
+@@ -68,6 +69,7 @@ component("url") {
public_deps = [
"//base",
"//build:robolectric_buildflags",
@@ -18,7 +18,7 @@ index c525c166979d6..ce2b1ae43c0a7 100644
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
-@@ -89,6 +91,11 @@ component("url") {
+@@ -90,6 +92,11 @@ component("url") {
public_configs = [ "//third_party/jdk" ]
}
diff --git a/chromium_edits/120.0.6099.71/url/url_canon.h.patch b/chromium_edits/122.0.6194.0/url/url_canon.h.patch
similarity index 91%
rename from chromium_edits/120.0.6099.71/url/url_canon.h.patch
rename to chromium_edits/122.0.6194.0/url/url_canon.h.patch
index 24ae1ba4..7ffd3a2f 100644
--- a/chromium_edits/120.0.6099.71/url/url_canon.h.patch
+++ b/chromium_edits/122.0.6194.0/url/url_canon.h.patch
@@ -1,8 +1,8 @@
diff --git a/url/url_canon.h b/url/url_canon.h
-index d3a7fabf09fa8..06db17242248f 100644
+index 8c48f9825d8cf..b9ad961e1b123 100644
--- a/url/url_canon.h
+++ b/url/url_canon.h
-@@ -697,6 +697,23 @@ bool CanonicalizeMailtoURL(const char16_t* spec,
+@@ -804,6 +804,23 @@ bool CanonicalizeMailtoURL(const char16_t* spec,
CanonOutput* output,
Parsed* new_parsed);
diff --git a/chromium_edits/120.0.6099.71/url/url_canon_ipfs.cc b/chromium_edits/122.0.6194.0/url/url_canon_ipfs.cc
similarity index 62%
rename from chromium_edits/120.0.6099.71/url/url_canon_ipfs.cc
rename to chromium_edits/122.0.6194.0/url/url_canon_ipfs.cc
index da3a5f03..d7c9fdc7 100644
--- a/chromium_edits/120.0.6099.71/url/url_canon_ipfs.cc
+++ b/chromium_edits/122.0.6194.0/url/url_canon_ipfs.cc
@@ -1,14 +1,10 @@
#include "url_canon_internal.h"
-#include
+#include
#include
#include
-namespace m = libp2p::multi;
-using Cid = m::ContentIdentifier;
-using CidCodec = m::ContentIdentifierCodec;
-
bool url::CanonicalizeIpfsURL(const char* spec,
int spec_len,
const Parsed& parsed,
@@ -22,37 +18,24 @@ bool url::CanonicalizeIpfsURL(const char* spec,
if ( parsed.host.len < 1 ) {
return false;
}
- std::string cid_str{ spec + parsed.host.begin, static_cast(parsed.host.len) };
- auto maybe_cid = CidCodec::fromString(cid_str);
- if ( !maybe_cid.has_value() ) {
- auto e = libp2p::multi::Stringify(maybe_cid.error());
- std::ostringstream err;
- err << e << ' '
- << std::string_view{spec,static_cast(spec_len)};
- maybe_cid = ipfs::id_cid::forText( err.str() );
- }
- auto cid = maybe_cid.value();
- if ( cid.version == Cid::Version::V0 ) {
- //TODO dcheck content_type == DAG_PB && content_address.getType() == sha256
- cid = Cid{
- Cid::Version::V1,
- cid.content_type,
- cid.content_address
- };
+ std::string_view cid_str{ spec + parsed.host.begin, static_cast(parsed.host.len) };
+ auto cid = ipfs::Cid(cid_str);
+ if ( !cid.valid() ) {
+ cid = ipfs::id_cid::forText( std::string{cid_str} + " is not a valid CID." );
}
- auto as_str = CidCodec::toString(cid);
- if ( !as_str.has_value() ) {
+ auto as_str = cid.to_string();
+ if ( as_str.empty() ) {
return false;
}
std::string stdurl{ spec, static_cast(parsed.host.begin) };
- stdurl.append( as_str.value() );
+ stdurl.append( as_str );
stdurl.append( spec + parsed.host.end(), spec_len - parsed.host.end() );
spec = stdurl.data();
spec_len = static_cast(stdurl.size());
Parsed parsed_input;
ParseStandardURL(spec, spec_len, &parsed_input);
return CanonicalizeStandardURL(
- spec, spec_len,
+ spec,
parsed_input,
scheme_type,
charset_converter,
diff --git a/chromium_edits/122.0.6194.0/url/url_util.cc.patch b/chromium_edits/122.0.6194.0/url/url_util.cc.patch
new file mode 100644
index 00000000..814f4b82
--- /dev/null
+++ b/chromium_edits/122.0.6194.0/url/url_util.cc.patch
@@ -0,0 +1,22 @@
+diff --git a/url/url_util.cc b/url/url_util.cc
+index 6f83f33c01c6b..a248e11c49445 100644
+--- a/url/url_util.cc
++++ b/url/url_util.cc
+@@ -273,8 +273,15 @@ bool DoCanonicalize(const CHAR* spec,
+ } else if (DoCompareSchemeComponent(spec, scheme, url::kFileSystemScheme)) {
+ // Filesystem URLs are special.
+ ParseFileSystemURL(spec, spec_len, &parsed_input);
+- success = CanonicalizeFileSystemURL(spec, parsed_input, charset_converter,
+- output, output_parsed);
++ success = CanonicalizeFileSystemURL(spec, parsed_input,
++ charset_converter, output,
++ output_parsed);
++
++ } else if (DoCompareSchemeComponent(spec, scheme, "ipfs")) {
++ // Switch multibase away from case-sensitive ones before continuing canonicalization.
++ ParseStandardURL(spec, spec_len, &parsed_input);
++ success = CanonicalizeIpfsURL(spec, spec_len, parsed_input, scheme_type,
++ charset_converter, output, output_parsed);
+
+ } else if (DoIsStandard(spec, scheme, &scheme_type)) {
+ // All "normal" URLs.
diff --git a/cmake/chromium.py b/cmake/chromium.py
index 0cd38b36..f3dfc84e 100755
--- a/cmake/chromium.py
+++ b/cmake/chromium.py
@@ -1,8 +1,8 @@
#!/usr/bin/env python3
+from verbose import verbose
from cache_vars import build_dir, vars
from patch import Patcher
-from verbose import verbose
from glob import glob
from os import environ, makedirs, remove
@@ -115,13 +115,7 @@ def runpy(args, silent=False):
if not isfile(join(src, '.landmines')):
run([python, join(depot_tools_dir, 'gclient.py'), 'runhooks', '-j', jobs])
-with open(join(src, 'chrome', 'browser', 'BUILD.gn')) as w:
- content = w.read()
- if 'components/ipfs' in content:
- verbose('Chromium seems to be already patched.')
- else:
- print('Apply patch file...', file=stderr)
- patcher.apply()
+patcher.apply()
ipfs_dir = join(src, 'components', 'ipfs')
diff --git a/cmake/inc_link.py b/cmake/inc_link.py
index 529b6532..65930363 100755
--- a/cmake/inc_link.py
+++ b/cmake/inc_link.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
-from cache_vars import build_dir, vars, verbose
+from verbose import verbose
+from cache_vars import build_dir, vars
from glob import glob
import os
@@ -35,6 +36,7 @@ def makedirs(p):
# makedirs(join(inc_link,'google'))
# symlink(join(chromium_src,'third_party','protobuf','src','google','protobuf'), join(inc_link,'google','protobuf'))
if not exists(join(inc_link,'absl')):
+ makedirs(inc_link)
symlink(join(chromium_src,'third_party','abseil-cpp','absl'),join(inc_link,'absl'))
def quoted(inc):
diff --git a/cmake/patch.py b/cmake/patch.py
index 8f791d30..2bf78f3f 100755
--- a/cmake/patch.py
+++ b/cmake/patch.py
@@ -1,9 +1,11 @@
#!/usr/bin/env python3
import sys
+from enum import auto, Enum
+from glob import glob
from os import listdir, makedirs, remove
-from os.path import exists, dirname, isdir, join, realpath, splitext
+from os.path import exists, dirname, isdir, isfile, join, realpath, relpath, splitext
from shutil import copyfile, rmtree
-from subprocess import check_call, check_output
+from subprocess import call, check_call, check_output
from sys import argv, executable, platform, stderr
from time import ctime
from verbose import verbose
@@ -34,6 +36,19 @@ def as_int(v):
return result
+def content_differs(ap,bp):
+ if not isfile(ap) or not isfile(bp):
+ return True
+ with open(ap) as a:
+ with open(bp) as b:
+ return a.read() != b.read()
+
+class Result(Enum):
+ Output = auto()
+ RawOutput = auto()
+ OrDie = auto()
+ ExitCode = auto()
+ StrippedOutput = Output
class Patcher:
def __init__(self, chromium_source_dir, git_bin, build_type):
@@ -46,12 +61,17 @@ def __init__(self, chromium_source_dir, git_bin, build_type):
def create_patch_file(self):
tag = self.tag_name()
- write_dir = join(self.edir, tag)
+ name = tag
+ write_dir = join(self.edir, name)
if exists(write_dir):
rmtree(write_dir)
- for lin in self.git(['status', '--porcelain'], and_strip=False).splitlines():
- stat = lin[0:2]
- path = lin[3:]
+ paths = self.git(['diff', tag, '--name-only'], Result.RawOutput).splitlines()
+ for lin in self.git(['status', '--porcelain'], Result.RawOutput).splitlines():
+ if lin[0:3] != '?? ':
+ continue
+ verbose('Unversioned', lin[3:])
+ paths.append( lin[3:] )
+ for path in paths:
from_path = join(self.csrc, path)
to_path = join(write_dir, path)
to_dir = dirname(to_path)
@@ -59,32 +79,36 @@ def create_patch_file(self):
verbose('Not putting component into edit tree')
elif 'third_party/ipfs_client' in path:
verbose('Not putting library into edit tree')
- elif stat == ' M':
- diff_out = self.git(['diff', '--patch', tag, path], and_strip=False)
+ elif not self.file_in_branch(tag, path):
+ print('Copy', from_path, '->', to_path)
+ makedirs(to_dir, exist_ok=True)
+ copyfile(from_path, to_path)
+ elif not self.file_in_branch('HEAD', path):
+ to_path += '.rm'
+ print('Remembering the removal of', from_path, 'with', to_path)
+ makedirs(to_dir, exist_ok=True)
+ with open(to_path, 'w') as rm_f:
+ rm_f.write('//Remember to remove the corresponding file from the Chromium source tree')
+ else:
+ diff_out = self.git(['diff', '--patch', tag, path], Result.RawOutput)
if diff_out:
makedirs(to_dir, exist_ok=True)
to_path += '.patch'
with open(to_path, 'w') as to_f:
to_f.write(diff_out)
print(to_path)
- elif stat == '??':
- print('Copy', from_path, '->', to_path)
- makedirs(to_dir, exist_ok=True)
- copyfile(from_path, to_path)
- else:
- print('Unhandled git status', stat, 'for', path)
- exit(32)
- self.git(['add', 'url/url_canon_ipfs.cc'])
- diff = self.git(['diff', '--patch', tag])
- name = tag
- if self.curr_hash() != self.hash_of(tag):
- print('NOT ON A TAG. Patching for hash instead')
- name = self.curr_hash()
+ self.git(['add', 'url/url_canon_ipfs.cc'], Result.OrDie)
+ diff = self.git(['diff', '--patch', tag], Result.RawOutput)
file_name = join(self.pdir, name+'.patch')
- print('Patch file:', file_name)
+ print('Old patch file:', file_name)
with open(file_name, 'w') as patch_file:
patch_file.write(diff+"\n")
+ def file_in_branch(self, ref: str, path: str):
+ out = self.git(['ls-tree', '--name-only', ref, path], Result.Output)
+ verbose('ls-tree gave me', out)
+ return out == path
+
def apply(self):
win = ''
win_dist = 9876543210
@@ -94,29 +118,75 @@ def apply(self):
if d < win_dist or (d == win_dist and len(ref) < len(win)):
win_dist = d
win = ref
- print('Best patch file is', win, file=stderr)
- patch_path = join(self.pdir, win+'.patch')
- self.git(['apply', '--verbose', patch_path], out=False)
-
- def git(self, args: list[str], out: bool = True, and_strip: bool = True) -> str:
- if out:
- result = check_output([self.gbin, '-C', self.csrc] + args, text=True)
- if and_strip:
- return result.strip()
+ edits_dir = join(self.edir, win)
+ edit_glob = f'{edits_dir}/**/*'
+ print('Best edits version is', win, 'look for edits by', edit_glob, file=stderr)
+ for edit in glob(edit_glob, recursive=True):
+ if not isfile(edit):
+ continue
+ verbose('Have edit:', edit)
+ ext = splitext(edit)[1]
+ rel = relpath(edit, edits_dir)
+ to_path = join(self.csrc, rel)
+ if ext == '.patch':
+ self.check_patch(edit, rel, to_path)
+ elif ext == '.rm':
+ if isfile(to_path):
+ print("Remove", to_path, 'due to', edit)
+ remove(to_path)
+ else:
+ verbose(f"{to_path} already removed")
+ elif not isfile(to_path):
+ print('Copy', edit, '->', to_path)
+ copyfile(edit, to_path)
+ elif content_differs(edit, to_path):
+ print('Warning:', to_path, 'exists, is different from ', edit, ' and is not being overwritten.')
else:
- return result
+ verbose(f"{to_path} already copied")
+ verbose('Done patching')
+
+
+ def check_patch(self, patch_path: str, relative: str, target_path: str):
+ if 0 == self.git(['apply', '--check', '--reverse', '--verbose', patch_path], Result.ExitCode):
+ verbose(patch_path, 'already applied.')
+ return
+ src = splitext(relative)[0]
+ ec = self.git(['apply', '--verbose', patch_path], Result.ExitCode)
+ verbose('Applying patch', patch_path, 'gave exit code', ec)
+ if ec == 0:
+ print('Patched', src, 'with', patch_path)
else:
- check_call([self.gbin, '-C', self.csrc] + args, text=True)
- return ''
+ with open(join(self.csrc,src)) as target_file:
+ text = target_file.read()
+ if 'ipfs' in text:
+ verbose("Patch file", patch_path, 'may have already been applied.')
+ else:
+ print("Failed to patch", src, '( at', join(self.csrc,src), ') with', patch_path)
+ exit(8)
+
+ def git(self, args: list[str], result: Result) -> str:
+ a = [self.gbin, '-C', self.csrc] + args
+ verbose('Running', a)
+ match result:
+ case Result.RawOutput:
+ return check_output(a, text=True)
+ case Result.StrippedOutput:
+ return check_output(a, text=True).strip()
+ case Result.OrDie:
+ check_call(a)
+ case Result.ExitCode:
+ return call(a)
+ case _:
+ raise RuntimeError('result type not handled')
def tag_name(self) -> str:
- return self.git(['describe', '--tags', '--abbrev=0'])
+ return self.git(['describe', '--tags', '--abbrev=0'], Result.Output)
def curr_hash(self) -> str:
return self.hash_of('HEAD')
def hash_of(self, ref) -> str:
- return self.git(['rev-parse', ref])
+ return self.git(['rev-parse', ref], Result.Output)
def distance(self, ref) -> int:
a, b = self.distances('HEAD', ref)
@@ -146,8 +216,8 @@ def available(self):
return map(lambda p: splitext(p)[0], listdir(self.pdir))
def distances(self, frm, ref):
- a = int(self.git(['rev-list', '--count', frm+'..'+ref]))
- b = int(self.git(['rev-list', '--count', ref+'..'+frm]))
+ a = int(self.git(['rev-list', '--count', frm+'..'+ref], Result.Output))
+ b = int(self.git(['rev-list', '--count', ref+'..'+frm], Result.Output))
return (a, b)
def maybe_newer(self, x, y):
@@ -185,7 +255,7 @@ def electron_version(self, branch='main'):
def unavailable(self):
avail = list(map(as_int, self.available()))
version_set = {}
- fudge = 59888
+ fudge = 59891
def check(version, version_set, s):
i = as_int(version)
by = (fudge,0)
@@ -226,6 +296,9 @@ def out_of_date(self, p):
if not Patcher.has_file_line(lines, 'chrome/browser/flag-metadata.json', '+ "name": "enable-ipfs",'):
print(p, 'does not have enable-ipfs in flag-metadata.json', file_path, file=sys.stderr)
return True
+ if not Patcher.has_file_line(lines, 'chrome/browser/chrome_content_browser_client.cc', '+ main_parts->AddParts(std::make_unique());'):
+ print(p, 'does not have enable-ipfs in flag-metadata.json', file_path, file=sys.stderr)
+ return True
return False
@staticmethod
@@ -288,7 +361,7 @@ def list_ood(self, to_check: list[str], sense: bool):
pr = Patcher(realpath(join(dirname(__file__), '..')), 'git', 'Debug')
pre = '?? component/patches/'
suf = 'patch'
- for line in pr.git(['status','--porcelain']).splitlines():
+ for line in pr.git(['status','--porcelain'], Result.RawOutput).splitlines():
if line.startswith(pre) and line.endswith(suf):
end = len(line) - len(suf) - 1
pch = line[len(pre):end]
diff --git a/cmake/tidy.py b/cmake/tidy.py
new file mode 100755
index 00000000..64b25c85
--- /dev/null
+++ b/cmake/tidy.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+
+import json
+
+from glob import glob
+from os import remove
+from os.path import splitext
+
+with open('compile_commands.json') as compile_commands_json:
+ keeps = {}
+ for command in json.load(compile_commands_json):
+ keeps[command['output']] = command['file']
+ for obj in glob('**/*.o', recursive=True):
+ if not 'CMakeFiles' in obj:
+ continue
+ if not obj in keeps:
+ print('rm', obj)
+ remove(obj)
+ for cov in glob('**/*.gc??', recursive=True):
+ obj = splitext(cov)[0] + '.o'
+ if not obj in keeps:
+ print('rm', cov)
+ remove(cov)
diff --git a/cmake/verbose.py b/cmake/verbose.py
index 7de4f354..bc89fd88 100644
--- a/cmake/verbose.py
+++ b/cmake/verbose.py
@@ -1,4 +1,5 @@
-from sys import argv
+
+from sys import argv, stderr
if '--verbose' in argv:
argv.remove('--verbose')
diff --git a/component/CMakeLists.txt b/component/CMakeLists.txt
index 0248aa96..7cd3e38f 100644
--- a/component/CMakeLists.txt
+++ b/component/CMakeLists.txt
@@ -133,6 +133,7 @@ add_custom_command(
)
add_custom_target(inc_link
+ ALL
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/cmake/inc_link.py" "${CMAKE_BINARY_DIR}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
DEPENDS in_tree_gen
diff --git a/component/block_http_request.cc b/component/block_http_request.cc
index 67e32592..76244b0a 100644
--- a/component/block_http_request.cc
+++ b/component/block_http_request.cc
@@ -67,7 +67,8 @@ void Self::OnResponse(std::shared_ptr,
status = 408;
break;
default:
- VLOG(2) << "NetErr " << loader_->NetError() << " for " << inf_.url;
+ // VLOG(2) << "NetErr " << loader_->NetError() << " for " <<
+ // inf_.url;
status = 500;
}
// auto sz = body ? body->size() : 0UL;
@@ -77,10 +78,7 @@ void Self::OnResponse(std::shared_ptr,
}
auto sp = status_line_.find(' ');
if (sp < status_line_.size()) {
- VLOG(2) << "HTTP response status='" << status_line_ << "'.";
status = std::atoi(status_line_.c_str() + sp + 1);
- } else {
- VLOG(2) << "Status line malformed/missing : '" << status_line_ << "'";
}
if (body) {
callback_(status, *body, header_accessor_);
diff --git a/component/chromium_ipfs_context.cc b/component/chromium_ipfs_context.cc
index 4a853033..7ef6ad8f 100644
--- a/component/chromium_ipfs_context.cc
+++ b/component/chromium_ipfs_context.cc
@@ -5,6 +5,7 @@
#include "chromium_json_adapter.h"
#include "crypto_api.h"
#include "inter_request_state.h"
+#include "preferences.h"
#include
#include
@@ -52,7 +53,7 @@ std::string Self::MimeType(std::string extension,
}
if (result.empty() || result == "application/octet-stream") {
net::SniffMimeTypeFromLocalData({content.data(), head_size}, &result);
- VLOG(1) << "Falling all the way back to content type " << result;
+ VLOG(2) << "Falling all the way back to content type " << result;
}
return result;
}
@@ -75,8 +76,8 @@ void Self::SendDnsTextRequest(std::string host,
LOG(INFO) << "Finished resolving " << host << " via DNSLink";
dns_reqs_.erase(host);
};
- dns_reqs_[host] = std::make_unique(host, res, don_wrap,
- network_context_.get());
+ auto* nc = state_->network_context();
+ dns_reqs_[host] = std::make_unique(host, res, don_wrap, nc);
}
void Self::SendHttpRequest(HttpRequestDescription req_inf,
HttpCompleteCallback cb) const {
@@ -88,8 +89,7 @@ bool Self::VerifyKeySignature(SigningKeyType t,
ByteView signature,
ByteView data,
ByteView key_bytes) const {
- return crypto_api::VerifySignature(static_cast(t), signature,
- data, key_bytes);
+ return crypto_api::VerifySignature(t, signature, data, key_bytes);
}
auto Self::ParseCbor(ipfs::ContextApi::ByteView bytes) const
-> std::unique_ptr {
@@ -110,11 +110,22 @@ auto Self::ParseJson(std::string_view j_str) const
}
return {};
}
+unsigned int Self::GetGatewayRate(std::string_view prefix) {
+ return rates_.GetRate(prefix);
+}
+void Self::SetGatewayRate(std::string_view prefix, unsigned int new_rate) {
+ rates_.SetRate(prefix, new_rate);
+}
+auto Self::GetGateway(std::size_t index) const -> std::optional {
+ auto [gw, r] = rates_.at(index);
+ if (gw) {
+ return GatewaySpec{*gw, r};
+ }
+ return std::nullopt;
+}
-Self::ChromiumIpfsContext(
- InterRequestState& state,
- raw_ptr network_context)
- : network_context_{network_context}, state_{state} {}
+Self::ChromiumIpfsContext(InterRequestState& state, PrefService* prefs)
+ : state_{state}, rates_{prefs} {}
Self::~ChromiumIpfsContext() noexcept {
LOG(WARNING) << "API dtor - are all URIs loaded?";
}
diff --git a/component/chromium_ipfs_context.h b/component/chromium_ipfs_context.h
index f43bed83..b274746e 100644
--- a/component/chromium_ipfs_context.h
+++ b/component/chromium_ipfs_context.h
@@ -2,6 +2,7 @@
#define IPFS_CHROMIUM_IPFS_CONTEXT_H_
#include "dns_txt_request.h"
+#include "preferences.h"
#include
#include
@@ -13,6 +14,8 @@
#include