Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f027e876 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

Merge branch '000-master-move_filters' into 'master'

Move browser filters to same project

See merge request !79
parents 7f8e606f 415d232e
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -7,3 +7,5 @@ _gclient_src*/
.gclient*
depot_tools/
.gcs_entries
*.txt
*.dat
+43 −0
Original line number Diff line number Diff line
workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "schedule"

stages:
  - prepare
  - build
  - filters

variables:
  CONTAINER_IMAGE: registry.gitlab.e.foundation:5000/$CI_PROJECT_PATH
@@ -9,6 +14,8 @@ variables:
build-docker:
  image: docker:25.0.5-git
  stage: prepare
  rules:
    - if: $CI_PIPELINE_SOURCE != "schedule"
  tags:
    - generic_privileged
  variables:
@@ -24,6 +31,8 @@ build-docker:

.build-cromite:
  image: $CONTAINER_IMAGE
  rules:
    - if: $CI_PIPELINE_SOURCE != "schedule"
  tags:
    - build-browser
  artifacts:
@@ -56,3 +65,37 @@ build-cromite-x64:
  extends: .build-cromite
  script:
    - $CI_PROJECT_DIR/build.sh -c -s -a x64

.build-filters:
  image: debian:12-slim
  stage: filters

update-filters:
  stage: filters
  extends: .build-filters
  needs: []
  script: 
    - apt-get update && apt-get install -y curl
    - bash generate_filters.sh
  artifacts:
    paths:
      - filters.dat

deploy_rsync:
  stage: filters
  extends: .build-filters
  needs:
    - job: update-filters
  before_script:
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo "$SSH_PRIVATE_KEY_ED" > $HOME/.ssh/id_ed25519
    - echo "$SSH_PUBKEY_ED" > $HOME/.ssh/id_ed25519.pub
    - echo "$SSH_KNOWN_HOSTS" > $HOME/.ssh/known_hosts
    - chmod 600 ~/.ssh/id_ed25519
    - chmod 644 ~/.ssh/known_hosts ~/.ssh/id_ed25519.pub
    - apt-get update && apt-get install -y rsync openssh-client
  script:
    - rsync -avz --chown=$REMOTE_USER:www-data --chmod=F644 filters.dat $REMOTE_USER@$IMAGES_HOSTNAME:$BROWSER_PATH
  rules:
    - if: '$CI_COMMIT_BRANCH == "master"'
+8 −0
Original line number Diff line number Diff line
@@ -19,6 +19,14 @@ Following are the enhancements offered by Browser over cromite:
    - [Mojeek](https://www.mojeek.com/)
- Remove **Google** and **Chrome** mentions from various strings wherever applicable feature/services were not reliant on the same

## /e/OS Browser Filters

- The /e/OS Browser uses the filter.dat file created by generate_filters.sh to block advertisements.
- Easyprivacy.txt and Easylist.txt are converted to filters.dat file using ruleset_converter, a program built from the chrome source code.
- The most recent bin is available in the x64 arch artifacts at https://gitlab.e.foundation/e/os/browser/-/pipelines.
- The file filters.dat is updated on a weekly basis and hosted on the /e/OS ota server at https://images.ecloud.global/apps/browser/filters.dat.
- The following URL contains documentaion for the feature https://doc.e.foundation/browser-custom-filters.

## Artifacts
Browser is built using the [GitLab's CI/CD](https://docs.gitlab.com/ee/ci/). You can access the pipelines for this repository [here](https://gitlab.e.foundation/e/os/browser/-/pipelines). You can download the job artifacts from the pipelines by following instructions from this [page](https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html#download-job-artifacts).

generate_filters.sh

0 → 100755
+12 −0
Original line number Diff line number Diff line
#!/bin/bash

curl -o easylist.txt https://easylist.to/easylist/easylist.txt
curl -o easyprivacy.txt https://easylist.to/easylist/easyprivacy.txt

filter_inputs="easyprivacy.txt,easylist.txt"

echo "Generating filters.dat from $filter_inputs"
./ruleset_converter --input_format=filter-list \
    --output_format=unindexed-ruleset \
    --input_files=$filter_inputs \
    --output_file=filters.dat >/dev/null 2>&1

ruleset_converter

0 → 100755
+2.49 MiB

File added.

No diff preview for this file type.