[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser-build][main] Bug 42343 (TB): Pass pt_config.json to the browser



Title: GitLab

Pier Angelo Vendrame pushed to branch main at The Tor Project / Applications / tor-browser-build

Commits:

  • 1c1deba7
    by Pier Angelo Vendrame at 2024-01-08T14:42:54+01:00
    Bug 42343 (TB): Pass pt_config.json to the browser
    
    We modified TorSettings to handle pt_config.json, so we do not need to
    convert it to pref lines anymore, but we need to inject the updated
    file to omni.ja.
    

2 changed files:

Changes:

  • projects/browser/build
    ... ... @@ -257,26 +257,6 @@ done
    257 257
           echo "${line/\$\{pt_path\}/${PT_PATH}}" >> "$TORRC_DEFAULTS"
    
    258 258
         done
    
    259 259
       done
    
    260
    -
    
    261
    -  # Write Default Bridge Prefs
    
    262
    -  echo "# Tor Launcher preferences (default bridges):" >> "$GENERATEDPREFSPATH"
    
    263
    -  RECOMMMENDED_DEFAULT=$(jq -r .recommendedDefault "${PT_CONFIG}")
    
    264
    -  echo "pref(\"extensions.torlauncher.default_bridge_recommended_type\", \"${RECOMMMENDED_DEFAULT}\");" >> "$GENERATEDPREFSPATH"
    
    265
    -
    
    266
    -  # Writes bridge-line prefs for a given bridge type
    
    267
    -  function bridges_conf {
    
    268
    -    local bridge_type="$1"
    
    269
    -    local i=1
    
    270
    -    jq -r ".bridges.\"$bridge_type\" | .[]" "${PT_CONFIG}" | while read -r line; do
    
    271
    -      echo "pref(\"extensions.torlauncher.default_bridge.$bridge_type.$i\", \"$line\");" >> "$GENERATEDPREFSPATH"
    
    272
    -      i=$((i + 1))
    
    273
    -    done
    
    274
    -  }
    
    275
    -
    
    276
    -  # Iterate over our bridge types and write default bridgelines for each
    
    277
    -  for bridge_type in $(jq -r ".bridges | keys[]" "${PT_CONFIG}"); do
    
    278
    -    bridges_conf $bridge_type
    
    279
    -  done
    
    280 260
     [% END -%]
    
    281 261
     
    
    282 262
     [% IF c("var/linux") && c("var/tor-browser") %]
    
    ... ... @@ -293,8 +273,17 @@ PKG_DIR='[% c("var/project-name") %]'
    293 273
     
    
    294 274
     for tbdir in "${TBDIRS[@]}"
    
    295 275
     do
    
    296
    -  tbdir="$tbdir[% IF c('var/macos') %]/Contents/Resources[% END %]/browser/"
    
    297
    -  pushd "$tbdir"
    
    276
    +  tbdir="$tbdir[% IF c('var/macos') %]/Contents/Resources[% END %]/"
    
    277
    +  [% IF c("var/tor-browser") -%]
    
    278
    +    pushd "$rootdir"
    
    279
    +    pt_config_dir=chrome/toolkit/content/global
    
    280
    +    mkdir -p "$pt_config_dir"
    
    281
    +    cp "pt_config.json" "$pt_config_dir/"
    
    282
    +    zip -Xm "$tbdir/omni.ja" "$pt_config_dir/pt_config.json"
    
    283
    +    rm -rf chrome
    
    284
    +    popd
    
    285
    +  [% END -%]
    
    286
    +  pushd "$tbdir/browser"
    
    298 287
       unzip omni.ja defaults/preferences/[% c("var/prefs_file") %] || [ $? -lt 3 ]
    
    299 288
       # Append our built extension-overrides.js to the preferences file
    
    300 289
       cat "$GENERATEDPREFSPATH" >> defaults/preferences/[% c("var/prefs_file") %]
    

  • projects/browser/build.android
    ... ... @@ -14,7 +14,7 @@ sorted_baseline_apk=$(basename $apk .apk)_sorted_baseline.apk
    14 14
     $rootdir/sort-baseline.py --apk $apk $sorted_baseline_apk
    
    15 15
     mv $sorted_baseline_apk $apk
    
    16 16
     
    
    17
    -# Bundle our extensioni(s).
    
    17
    +# Bundle our extension(s).
    
    18 18
     # NoScript will be copied over to the profile folder
    
    19 19
     # as a "regular" browser extension receiving regular AMO updates.
    
    20 20
     noscript_path="$ext_dir/{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi"
    
    ... ... @@ -23,6 +23,21 @@ mkdir -p /var/tmp/build/$ext_dir [% dest_dir _ '/' _ c('filename') %]
    23 23
     cd /var/tmp/build
    
    24 24
     mv $rootdir/[% c('input_files_by_name/noscript') %] "$noscript_path"
    
    25 25
     
    
    26
    +[%IF c("var/tor-browser") -%]
    
    27
    +  unzip -j "$apk" assets/omni.ja
    
    28
    +  tar -xaf "$rootdir/[% c("input_files_by_name/tor-expert-bundle") %]" tor/pluggable_transports/pt_config.json
    
    29
    +  mkdir omni
    
    30
    +  pushd omni
    
    31
    +  unzip ../omni.ja
    
    32
    +  cp ../tor/pluggable_transports/pt_config.json chrome/toolkit/content/global/pt_config.json
    
    33
    +  [% c('zip', {
    
    34
    +      zip_src => [ '.' ],
    
    35
    +      zip_args => '../assets/omni.ja',
    
    36
    +    }) %]
    
    37
    +  popd
    
    38
    +[% END -%]
    
    39
    +
    
    40
    +
    
    26 41
     [% IF c("var/verify_allowed_addons") %]
    
    27 42
       # Check that allowed_addons.json contains the right versions of our bundled extension(s).
    
    28 43
       # If so, replace the default allowed_addons.json by ours in the apk assets folder.
    
    ... ... @@ -32,9 +47,9 @@ mv $rootdir/[% c('input_files_by_name/noscript') %] "$noscript_path"
    32 47
     mv $rootdir/allowed_addons.json $assets_dir/allowed_addons.json
    
    33 48
     
    
    34 49
     [% c('zip', {
    
    35
    -        zip_src => [ '$assets_dir' ],
    
    36
    -        zip_args => '$apk',
    
    37
    -    }) %]
    
    50
    +    zip_src => [ '$assets_dir' ],
    
    51
    +    zip_args => '$apk',
    
    52
    +  }) %]
    
    38 53
     
    
    39 54
     aligned_apk=$(basename $apk .apk)_aligned.apk
    
    40 55
     zipalign -vp 4 $apk $aligned_apk
    

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits