diff --git a/.gitmodules b/.gitmodules index f48d85d..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "submodules/settings"] - path = submodules/settings - url = https://gitlab.com/librewolf-community/settings.git diff --git a/.woodpecker.release/package.json b/.woodpecker.release/package.json new file mode 100644 index 0000000..269e73f --- /dev/null +++ b/.woodpecker.release/package.json @@ -0,0 +1,17 @@ +{ + "name": "codeberg-release-tool", + "version": "0.1.0", + "license": "Apache-2.0", + "scripts": { + "build": "tsc", + "start": "node dist/release.js" + }, + "dependencies": { + "axios": "^0.21.1", + "form-data": "^4.0.0" + }, + "devDependencies": { + "@types/node": "^20.5.0", + "typescript": "^4.2.4" + } +} diff --git a/.woodpecker.release/release.ts b/.woodpecker.release/release.ts new file mode 100644 index 0000000..2d6e2f3 --- /dev/null +++ b/.woodpecker.release/release.ts @@ -0,0 +1,113 @@ +import axios from 'axios'; +import fs from 'fs'; +import path from 'path'; +import FormData from 'form-data'; + + +// Environment Variables: +// CB_API_KEY: The API key for accessing Codeberg. + +// TODO: change this to match +const repoUrl = 'https://codeberg.org/api/v1/repos/threadpanic/cb-src-woodpecker'; + + + + +// Extract the command-line argument and assign to 'version' +const version = process.argv[2]; +if (!version) { + console.error('Please provide the version as a command-line argument.'); + process.exit(1); +} + +const tarball_artifact = `librewolf-${version}.source.tar.gz`; +const sha256sum_artifact = `${tarball_artifact}.sha256sum`; +const tarballExists = fs.existsSync(path.join('..', tarball_artifact)); +const sha256sumExists = fs.existsSync(path.join('..', sha256sum_artifact)); + +if (!tarballExists || !sha256sumExists) { + console.error(`Missing artifacts. Ensure both ${tarball_artifact} and ${sha256sum_artifact} are present in the parent directory.`); + process.exit(1); +} + +const apiKey = process.env.CB_API_KEY; + +if (!apiKey) { + console.error('API key not found in environment variable CB_API_KEY.'); + process.exit(1); +} + +const headers = { + 'Authorization': `Bearer ${apiKey}` +}; + +async function addReleaseArtifact(fileName: string, releaseId: number) { + const apiUrl = `${repoUrl}/releases/${releaseId}/assets?name=${fileName}`; + const formData = new FormData(); + formData.append('attachment', fs.createReadStream(path.join('..', fileName))); + + try { + const response = await axios.post(apiUrl, formData, { + headers: { + ...headers, + ...formData.getHeaders() + } + }); + + if (response.status !== 201) { + throw new Error(`Failed to attach artifact ${fileName}. Unexpected response status: ${response.status}`); + } + } catch (error: any) { + console.error(`Error while attaching artifact ${fileName}:`, error.response ? error.response.data : error.message); + throw error; + } +} + +async function createNewRelease() { + const releaseUrl = `${repoUrl}/releases`; + const requestBody = { + body: `Release v${version} of the LibreWolf source tarball. Please see the README.md file for compilation instructions and dependency details.`, + draft: false, + name: `Release ${version}`, + prerelease: false, + tag_name: `v${version}` + }; + + try { + const response = await axios.post(releaseUrl, requestBody, { headers: headers }); + + if (response.status === 201) { + await addReleaseArtifact(tarball_artifact, response.data.id); + await addReleaseArtifact(sha256sum_artifact, response.data.id); + } else { + throw new Error(`Failed to create release. Unexpected response status: ${response.status}`); + } + } catch (error: any) { + console.error("Error while creating release:", error.response ? error.response.data : error.message); + throw error; + } +} + +async function main() { + try { + const releaseListResponse = await axios.get(`${repoUrl}/releases`); + + if (releaseListResponse.data.length === 0) { + await createNewRelease(); + } else { + const latestReleaseResponse = await axios.get(`${repoUrl}/releases/latest`); + if (latestReleaseResponse.data.tag_name === `v${version}`) { + console.log(`Version v${version} already exists as a release. Exiting without creating a new release.`); + process.exit(0); + } + await createNewRelease(); + } + process.exit(0); + } catch (error: any) { + console.error('Error while processing releases:', error); + process.exit(1); + } +} + +main(); + diff --git a/.woodpecker.release/tsconfig.json b/.woodpecker.release/tsconfig.json new file mode 100644 index 0000000..330f53f --- /dev/null +++ b/.woodpecker.release/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "outDir": "./dist" + }, + "include": [ + "release.ts" + ], + "exclude": [ + "node_modules" + ] +} diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..0842501 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,77 @@ +steps: + + fetch: + image: alpine + commands: + - apk update -U + - apk add make gnupg + + - make fetch-upstream-woodpecker + + test: + image: alpine + commands: + - apk update -U + - apk add make patch + + - make check-patchfail-woodpecker + + build: + image: alpine + commands: + - apk update -U + - apk add make gnupg patch python3 bash xz + + - make all + + + +# my ts+axios api stuff +###### +# +# release: +# image: alpine +# when: +# - branch: main +# commands: +# - apk update -U +# - apk add nodejs npm +# +# - ( cd .woodpecker.release && npm install && npm run build ) +# - ( cd .woodpecker.release && npm run start $(cat ../version)-$(cat ../release) ) +# +# secrets: [ cb_api_key ] +# + + + + + +# uploading to stortage.ci.librewolf.net +#### +# +# upload: +# image: woodpeckerci/plugin-s3 +# when: +# - branch: main +# settings: +# bucket: artifacts +# source: "*.{tar.gz,sha256sum}" +# target: /${CI_BUILD_NUMBER} +# path_style: true +# endpoint: https://storage.ci.librewolf.net +# +# secrets: [aws_access_key_id, aws_secret_access_key] +# +# display-links: +# image: alpine +# when: +# - branch: main +# commands: +# - echo "https://storage.ci.librewolf.net/artifacts/${CI_BUILD_NUMBER}/librewolf-$(cat version)-$(cat release).source.tar.gz" +# - echo "https://storage.ci.librewolf.net/artifacts/${CI_BUILD_NUMBER}/librewolf-$(cat version)-$(cat release).source.tar.gz.sha256sum" +# +# +# + + diff --git a/Makefile b/Makefile index 1dfb5e3..2d9e4d5 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ docker_targets=docker-build-image docker-run-build-job docker-remove-image - -.PHONY : help check all clean veryclean dir bootstrap fetch build package run update setup-wasi check-patchfail check-fuzz fixfuzz $(docker_targets) +woodpecker_targets=fetch-upstream-woodpecker check-patchfail-woodpecker +.PHONY : help check all clean veryclean dir bootstrap fetch build package run update setup-wasi check-patchfail check-fuzz fixfuzz $(docker_targets) $(woodpecker_targets) version:=$(shell cat ./version) release:=$(shell cat ./release) @@ -93,12 +93,15 @@ $(lw_source_dir) : $(ff_source_tarball) ./version ./release scripts/librewolf-pa $(lw_source_tarball) : $(lw_source_dir) rm -f $(lw_source_tarball) - $(archive_create) $(lw_source_tarball) $(lw_source_dir) + tar cf librewolf-$(version)-$(release).source.tar $(lw_source_dir) + gzip --fast librewolf-$(version)-$(release).source.tar touch $(lw_source_dir) sha256sum $(lw_source_tarball) > $(lw_source_tarball).sha256sum cat $(lw_source_tarball).sha256sum + sha256sum -c $(lw_source_tarball).sha256sum [ "$(SIGNING_KEY)" != "" ] && cp -v $(SIGNING_KEY) pk.asc ; true if [ -f pk.asc ]; then gpg --import pk.asc; gpg --detach-sign $(lw_source_tarball) && ls -lh $(lw_source_tarball).sig; fi + ls -lh $(lw_source_tarball)* debs=python3 python3-dev python3-pip @@ -124,8 +127,12 @@ package : run : (cd $(lw_source_dir) && ./mach run) + check-patchfail: sh -c "./scripts/check-patchfail.sh" > patchfail.out + + + check-fuzz: -sh -c "./scripts/check-patchfail.sh --fuzz=0" > patchfail-fuzz.out fixfuzz : @@ -158,3 +165,18 @@ setup-debian : setup-fedora : dnf -y install python3 curl wget zstd python3-devel python3-pip mercurial openssl-devel libxml2-devel + + + + + +# +# for .woodpecker.yml +# + +check-patchfail-woodpecker : + + ( sh -c "./scripts/check-patchfail.sh" > patchfail.out ; exit_code=$$? ; \ + cat patchfail.out ; rm -f patchfail.out ; exit $$exit_code ) + +fetch-upstream-woodpecker : fetch diff --git a/assets/uBOAssets.json b/assets/uBOAssets.json index 2ea6a39..cd1c0b3 100644 --- a/assets/uBOAssets.json +++ b/assets/uBOAssets.json @@ -212,7 +212,7 @@ "group": "malware", "title": "Online Malicious URL Blocklist", "contentURL": [ - "https://malware-filter.gitlab.io/malware-filter/urlhaus-filter-online.txt", + "https://malware-filter.gitlab.io/urlhaus-filter/urlhaus-filter-online.txt", "assets/thirdparties/urlhaus-filter/urlhaus-filter-online.txt" ], "cdnURLs": [ @@ -226,7 +226,7 @@ "content": "filters", "group": "malware", "title": "Phishing URL Blocklist", - "contentURL": "https://malware-filter.gitlab.io/malware-filter/phishing-filter.txt", + "contentURL": "https://malware-filter.gitlab.io/phishing-filter/phishing-filter.txt", "cdnURLs": [ "https://curbengh.github.io/phishing-filter/phishing-filter.txt", "https://malware-filter.gitlab.io/phishing-filter/phishing-filter.txt", @@ -239,7 +239,7 @@ "group": "malware", "off": true, "title": "PUP Domains Blocklist", - "contentURL": "https://malware-filter.gitlab.io/malware-filter/pup-filter.txt", + "contentURL": "https://malware-filter.gitlab.io/pup-filter/pup-filter.txt", "cdnURLs": [ "https://curbengh.github.io/pup-filter/pup-filter.txt", "https://malware-filter.gitlab.io/pup-filter/pup-filter.txt", @@ -261,7 +261,7 @@ "adguard-cookies": { "content": "filters", "group": "annoyances", - "parent": "AdGuard – Annoyances", + "parent": "AdGuard – Annoyances|AdGuard/uBO – Cookie Notices", "off": true, "title": "AdGuard – Cookie Notices", "tags": "annoyances cookies", @@ -269,6 +269,22 @@ "supportURL": "https://github.com/AdguardTeam/AdguardFilters#adguard-filters", "instructionURL": "https://kb.adguard.com/en/general/adguard-ad-filters" }, + "ublock-cookies-adguard": { + "content": "filters", + "group": "annoyances", + "parent": "AdGuard – Annoyances|AdGuard/uBO – Cookie Notices", + "off": true, + "title": "uBlock filters – Cookie Notices", + "tags": "annoyances cookies", + "contentURL": "https://ublockorigin.github.io/uAssets/filters/annoyances-cookies.txt", + "cdnURLs": [ + "https://ublockorigin.github.io/uAssetsCDN/filters/annoyances-cookies.txt", + "https://ublockorigin.pages.dev/filters/annoyances-cookies.txt", + "https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/annoyances-cookies.txt", + "https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/annoyances-cookies.txt" + ], + "supportURL": "https://github.com/uBlockOrigin/uAssets" + }, "adguard-popup-overlays": { "content": "filters", "group": "annoyances", @@ -357,7 +373,7 @@ "fanboy-cookiemonster": { "content": "filters", "group": "annoyances", - "parent": "EasyList – Annoyances", + "parent": "EasyList – Annoyances|EasyList/uBO – Cookie Notices", "off": true, "title": "EasyList – Cookie Notices", "tags": "annoyances cookies", @@ -374,6 +390,22 @@ ], "supportURL": "https://github.com/easylist/easylist#fanboy-lists" }, + "ublock-cookies-easylist": { + "content": "filters", + "group": "annoyances", + "parent": "EasyList – Annoyances|EasyList/uBO – Cookie Notices", + "off": true, + "title": "uBlock filters – Cookie Notices", + "tags": "annoyances cookies", + "contentURL": "https://ublockorigin.github.io/uAssets/filters/annoyances-cookies.txt", + "cdnURLs": [ + "https://ublockorigin.github.io/uAssetsCDN/filters/annoyances-cookies.txt", + "https://ublockorigin.pages.dev/filters/annoyances-cookies.txt", + "https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssetsCDN@main/filters/annoyances-cookies.txt", + "https://cdn.statically.io/gh/uBlockOrigin/uAssetsCDN/main/filters/annoyances-cookies.txt" + ], + "supportURL": "https://github.com/uBlockOrigin/uAssets" + }, "easylist-newsletters": { "content": "filters", "group": "annoyances", diff --git a/patches/msix.patch b/patches/msix.patch index 42e73ac..7a2e093 100644 --- a/patches/msix.patch +++ b/patches/msix.patch @@ -9,7 +9,7 @@ @@ -29,13 +29,14 @@ - + + diff --git a/patches/sed-patches/stop-undesired-requests.patch b/patches/sed-patches/stop-undesired-requests.patch index b67971a..9373516 100644 --- a/patches/sed-patches/stop-undesired-requests.patch +++ b/patches/sed-patches/stop-undesired-requests.patch @@ -15,13 +15,13 @@ diff --git a/services/settings/Utils.jsm b/services/settings/Utils.jsm index 23d6bf1..4affc89 100644 --- a/services/settings/Utils.sys.mjs +++ b/services/settings/Utils.sys.mjs -@@ -62,6 +62,9 @@ XPCOMUtils.defineLazyGetter(lazy, "isRunningTests", () => { +@@ -51,6 +51,9 @@ ChromeUtils.defineLazyGetter(lazy, "isRunningTests", () => { // Overriding the server URL is normally disabled on Beta and Release channels, // except under some conditions. - XPCOMUtils.defineLazyGetter(lazy, "allowServerURLOverride", () => { + ChromeUtils.defineLazyGetter(lazy, "allowServerURLOverride", () => { ++ ++ return true; // always override in LW + -+ return true; // always allow this override for LW -+ if (!AppConstants.RELEASE_OR_BETA) { // Always allow to override the server URL on Nightly/DevEdition. return true; diff --git a/patches/ui-patches/handlers.patch b/patches/ui-patches/handlers.patch index 553a6c8..a7d5260 100644 --- a/patches/ui-patches/handlers.patch +++ b/patches/ui-patches/handlers.patch @@ -1,6 +1,8 @@ +diff --git a/uriloader/exthandler/HandlerList.sys.mjs b/uriloader/exthandler/HandlerList.sys.mjs +index e95d627..cd0096e 100644 --- a/uriloader/exthandler/HandlerList.sys.mjs +++ b/uriloader/exthandler/HandlerList.sys.mjs -@@ -13,228 +13,7 @@ this.kHandlerList = { +@@ -9,196 +9,7 @@ export const kHandlerList = { schemes: { mailto: { handlers: [ @@ -28,22 +30,6 @@ - }, - }, - }, -- csb: { -- schemes: { -- mailto: { -- handlers: [ -- { -- name: "Poczta Interia.pl", -- uriTemplate: "http://poczta.interia.pl/mh/?mailto=%s", -- }, -- { -- name: "OnetPoczta", -- uriTemplate: "http://poczta.onet.pl/napisz.html?uri=%s", -- }, -- ], -- }, -- }, -- }, - "es-CL": { - schemes: { - mailto: { @@ -181,22 +167,6 @@ - }, - }, - }, -- sah: { -- schemes: { -- mailto: { -- handlers: [ -- { -- name: "Яндекс.Почта", -- uriTemplate: "https://mail.yandex.ru/compose?mailto=%s", -- }, -- { -- name: "Mail.Ru", -- uriTemplate: "https://e.mail.ru/cgi-bin/sentmsg?mailto=%s", -- }, -- ], -- }, -- }, -- }, - uk: { - schemes: { - mailto: { diff --git a/release b/release index 0cfbf08..d00491f 100644 --- a/release +++ b/release @@ -1 +1 @@ -2 +1 diff --git a/scripts/librewolf-patches.py b/scripts/librewolf-patches.py index da15a81..79d0706 100755 --- a/scripts/librewolf-patches.py +++ b/scripts/librewolf-patches.py @@ -106,18 +106,20 @@ def librewolf_patches(): # we don't want to disturbe those workflows. patch('../patches/xmas.patch') - # - # Create the 'lw' folder, it contains the librewolf.cfg and policies.json files. - # - - #exec('mkdir -p lw') - - # getting the librewolf settings repository - exec("cp -v ../submodules/settings/defaults/pref/local-settings.js lw/") - exec("cp -v ../submodules/settings/distribution/policies.json lw/") - exec("cp -v ../submodules/settings/librewolf.cfg lw/") - + # + # Apply most recent `settings` repository files. + # + + exec('mkdir -p lw') + enter_srcdir('lw') + exec('wget -q https://codeberg.org/librewolf/settings/raw/branch/master/librewolf.cfg') + exec('wget -q https://codeberg.org/librewolf/settings/raw/branch/master/distribution/policies.json') + exec('wget -q https://codeberg.org/librewolf/settings/raw/branch/master/defaults/pref/local-settings.js') + leave_srcdir(); + + + # provide a script that fetches and bootstraps Nightly and some mozconfigs exec('cp -v ../scripts/mozfetch.sh lw/') exec('cp -v ../assets/mozconfig.new ../assets/mozconfig.new.without-bootstrap ../scripts/setup-wasi-linux.sh lw/') diff --git a/submodules/settings b/submodules/settings deleted file mode 160000 index ba238a9..0000000 --- a/submodules/settings +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ba238a9ca6bfd509f31e6eb4a45c14c11b7ef7fe diff --git a/version b/version index 6dcd8cf..3b50d56 100644 --- a/version +++ b/version @@ -1 +1 @@ -115.0.2 +117.0