diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml new file mode 100644 index 0000000..cc2d0a2 --- /dev/null +++ b/.github/workflows/cicd.yml @@ -0,0 +1,207 @@ +name: CI/CD with Lazarus IDE on multiple operating systems. + +permissions: + contents: write + +on: + push: + pull_request: + workflow_dispatch: + # Automatic cron build every 6 months to check if everything still works. + schedule: + - cron: "0 0 1 1/6 *" + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. + fail-fast: false + + # Set up an array to perform the following three build configurations. + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + include: + - os: windows-latest + LAZBUILD_WITH_PATH: c:/lazarus/lazbuild + RELEASE_ZIP_FILE: trackereditor_windows_amd64.zip + LAZ_OPT: + - os: ubuntu-latest + LAZBUILD_WITH_PATH: lazbuild + RELEASE_ZIP_FILE: trackereditor_linux_amd64.zip + LAZ_OPT: + - os: macos-latest + LAZBUILD_WITH_PATH: /Applications/Lazarus/lazbuild + RELEASE_ZIP_FILE: trackereditor_macOS_amd64.zip + LAZ_OPT: --widgetset=cocoa + + steps: + - uses: actions/checkout@v4 + + - name: Install Lazarus IDE + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + sudo apt install -y lazarus zip xvfb + elif [ "$RUNNER_OS" == "Windows" ]; then + choco install lazarus zip + # https://wiki.overbyte.eu/wiki/index.php/ICS_Download#Download_OpenSSL_Binaries + curl -L -O --output-dir enduser https://github.com/GerryFerdinandus/bittorrent-tracker-editor/releases/download/V1.32.0/libssl-3-x64.dll + curl -L -O --output-dir enduser https://github.com/GerryFerdinandus/bittorrent-tracker-editor/releases/download/V1.32.0/libcrypto-3-x64.dll + elif [ "$RUNNER_OS" == "macOS" ]; then + brew install --cask lazarus + else + echo "$RUNNER_OS not supported" + exit 1 + fi + shell: bash + + - name: Build Release version + # Build trackereditor project (Release mode) + run: ${{ matrix.LAZBUILD_WITH_PATH }} --build-mode=Release ${{ matrix.LAZ_OPT }} source/project/tracker_editor/trackereditor.lpi + shell: bash + + - name: Build Unit Test on Windows + if: matrix.os == 'windows-latest' + # Build unit test project (Debug mode) + run: ${{ matrix.LAZBUILD_WITH_PATH }} --build-mode=Debug ${{ matrix.LAZ_OPT }} source/project/unit_test/tracker_editor_test.lpi + shell: bash + + - name: Run Unit Test on Windows + if: matrix.os == 'windows-latest' + # Also remove all the extra file created by test. + # We do not what it in the ZIP release files. + # Undo all changes made by testing. + run: | + set -e + enduser/test_trackereditor -a --format=plain + set +e + + # remove file created by unit test + rm -f enduser/console_log.txt + rm -f enduser/export_trackers.txt + git reset --hard + shell: bash + + - name: Test OpenSSL works on Linux CI + if: matrix.os == 'ubuntu-latest' + run: xvfb-run --auto-servernum enduser/trackereditor -TEST_SSL + + - name: Create a zip file for Linux release. + if: matrix.os == 'ubuntu-latest' + run: zip -j ${{ matrix.RELEASE_ZIP_FILE }} enduser/*.txt enduser/trackereditor + shell: bash + + - name: Create a zip file for Windows release. + if: matrix.os == 'windows-latest' + run: | + zip -j ${{ matrix.RELEASE_ZIP_FILE }} enduser/*.txt enduser/trackereditor.exe enduser/*.dll + shell: bash + + - name: Move file into macOS .app + if: matrix.os == 'macos-latest' + run: | + # copy everything into enduser/macos/app folder + # + # Move the executable to the application bundle + mv enduser/trackereditor enduser/macos/app/trackereditor.app/Contents/MacOS + + # Move the trackers list to application bundle + mv enduser/add_trackers.txt enduser/macos/app/trackereditor.app/Contents/MacOS + mv enduser/remove_trackers.txt enduser/macos/app/trackereditor.app/Contents/MacOS + + # move all the *.txt file + mv enduser/*.txt enduser/macos/app + + # zip only the app folder with extra text file. + # /usr/bin/ditto -c -k "enduser/macos/app" "${{ matrix.RELEASE_ZIP_FILE }}" + shell: bash + + - name: Codesign macOS app bundle + # This macOS Codesign step is copied from: + # https://federicoterzi.com/blog/automatic-code-signing-and-notarization-for-macos-apps-using-github-actions/ + # This is a bit different from the previous version for Travis-CI build system to build bittorrent tracker editor + if: matrix.os == 'macos-latest' + env: + MACOS_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE }} + MACOS_CERTIFICATE_PWD: ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }} + MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }} + MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }} + run: | + # Turn our base64-encoded certificate back to a regular .p12 file + echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12 + + # We need to create a new keychain, otherwise using the certificate will prompt + # with a UI dialog asking for the certificate password, which we can't + # use in a headless CI environment + + security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain + security default-keychain -s build.keychain + security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain + security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign + security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain + + # We finally codesign our app bundle, specifying the Hardened runtime option. + #/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime enduser/macos/app/trackereditor.app -v + + # sign the app. -sign is the developer cetificate ID + # entitlements does not work at this moment + #codesign --timestamp --entitlements enduser/macos/entitlements.plist --force --options runtime --deep --sign $CERTIFICATE_ID $FILE_APP + + # Please note: this is the same code version used in Travis-CI + /usr/bin/codesign --timestamp --force --options runtime --deep --sign "$MACOS_CERTIFICATE_NAME" enduser/macos/app/trackereditor.app + shell: bash + + - name: Notarize macOS app bundle + if: matrix.os == 'macos-latest' + env: + PROD_MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }} + PROD_MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }} + PROD_MACOS_NOTARIZATION_PWD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }} + run: | + # Store the notarization credentials so that we can prevent a UI password dialog + # from blocking the CI + + echo "Create keychain profile" + xcrun notarytool store-credentials "notarytool-profile" --apple-id "$PROD_MACOS_NOTARIZATION_APPLE_ID" --team-id "$PROD_MACOS_NOTARIZATION_TEAM_ID" --password "$PROD_MACOS_NOTARIZATION_PWD" + + # We can't notarize an app bundle directly, but we need to compress it as an archive. + # Therefore, we create a zip file containing our app bundle, so that we can send it to the + # notarization service + + echo "Creating temp notarization archive" + ditto -c -k --keepParent "enduser/macos/app/trackereditor.app" "notarization.zip" + + # Here we send the notarization request to the Apple's Notarization service, waiting for the result. + # This typically takes a few seconds inside a CI environment, but it might take more depending on the App + # characteristics. Visit the Notarization docs for more information and strategies on how to optimize it if + # you're curious + + echo "Notarize app" + xcrun notarytool submit "notarization.zip" --keychain-profile "notarytool-profile" --wait + + # Finally, we need to "attach the staple" to our executable, which will allow our app to be + # validated by macOS even when an internet connection is not available. + echo "Attach staple" + xcrun stapler staple "enduser/macos/app/trackereditor.app" + + # Remove notarization.zip, otherwise it will also be 'released' to the end user + rm -f "notarization.zip" + + # zip only the app folder with extra text file. + echo "Zip macOS app file" + /usr/bin/ditto -c -k "enduser/macos/app" "${{ matrix.RELEASE_ZIP_FILE }}" + shell: bash + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + path: ${{ matrix.RELEASE_ZIP_FILE }} + if-no-files-found: error + + - name: Zip file release to end user + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + *.zip diff --git a/.github/workflows/snap.yml b/.github/workflows/snap.yml new file mode 100644 index 0000000..f6edf1f --- /dev/null +++ b/.github/workflows/snap.yml @@ -0,0 +1,16 @@ +name: Test build Ubuntu snap on Linux amd64 + +on: + push: + pull_request: + workflow_dispatch: + # Automatic cron build every 6 months to check if everything still works. + schedule: + - cron: "0 0 1 1/6 *" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: snapcore/action-build@v1 diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 71353b1..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "travis-lazarus"] - path = travis-lazarus - url = https://github.com/GerryFerdinandus/travis-lazarus.git diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b06d67e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,87 +0,0 @@ -# Part of `travis-lazarus` (https://github.com/nielsAD/travis-lazarus) -# License: MIT - -language: shell - -# Linux compability issue. -# Need to build in xenial with lazarus 1.8.2. -# Do not use bionic or newer Lazarus version - -# For linux headless. -# See travis_unit_test.sh will install and use xvfb-run -#services: (- xvfb) does not work must use xvfb-run - -jobs: - include: - - name: Ubuntu 16.04 AMD64 (1.8.2) - os: linux - dist: xenial - env: LAZ_VER=1.8.2 RELEASE_ZIP_FILE="trackereditor_linux_amd64.zip" - - name: Ubuntu 16.04 AArch64 (1.6) - os: linux - dist: xenial - arch: arm64 - env: LAZ_PKG=true RELEASE_ZIP_FILE="trackereditor_linux_AArch64.zip" - - name: macOS 10.14 (PKG) - os: osx - osx_image: xcode11.3 - env: LAZ_PKG=true LAZ_OPT="--widgetset=cocoa" RELEASE_ZIP_FILE="trackereditor_macOS.zip" - - name: Windows (PKG) Build 32-bit software - os: windows - env: LAZ_PKG=true LAZ_REL=32 RELEASE_ZIP_FILE="trackereditor_win32.zip" - -before_install: -# Install python in windows OS -- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then choco install python3 --params "/InstallDir:C:\python3"; fi -- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then export PATH=/c/Python3:/c/Python3/Scripts:/c/lazarus:$PATH; fi - -install: -# Output something at regular time or Travis will kills the job -- while sleep 60; do echo "===== 1 minute mark ====="; done & -- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then python ./travis-lazarus/.travis.install.py; fi -- if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then ./travis-lazarus/.travis.install.py; fi -# Killing background sleep loop -- kill %1 - -script: -# Output something at regular time or Travis will kill the job - - echo "start script" - - while sleep 60; do echo "===== 1 minute mark ====="; done & - -# Build trackereditor project (Release mode) - - lazbuild --build-mode=Release $LAZ_OPT $PROJECT_LPI_EDITOR_PATH - -# Build unit test project (Debug mode) - - lazbuild --build-mode=Debug $LAZ_OPT $PROJECT_LPI_UNIT_TEST_PATH - -# Start the unit test - - source ./scripts/travis_unit_test.sh - -# Killing background sleep loop - - kill %1 - -before_deploy: -# Create the zip file for deployment - - source ./scripts/travis_deploy.sh - -deploy: - - provider: releases - prerelease: false - cleanup: false - edge: true # opt in to dpl v2 - token: - secure: hmjev+YIClSOec6wMclUv5W4lgyLpdX7DlUpF2LQ1W/EO/x/b8RzmSPjNZ5sa7IDUe1WoVXm89G6HtkGGHcRqJrZjNn18HvpvEOnIYgIEXBVtW9uaURsSJ2LYve9beHHvYzs0doEQp1I24qTENUOqMABStk7MKRTATZ7nBWIinZVkpojEYIizQtCnUWwJXpzgs9mx7BEAVqLJPJ35oXNVjEgE96gsWMaYuX82BsVpL9VjGIaYpbEc1iBFBr2RHTgHG03H+2wBewJ4gh3hFwq9vt6mEqdC6Y9UIqmAEUMzCpokqrIfV2cfnPe24miPqmCLboua7Ddu8OpLj/yQ9DvC8xVEVh8aiGszzPvnytaFuRfLxI5HdAtUkA/9P3dXwjJKLJs568kyCTz4Tk7Icrb7seS1i84BJs3Vp2/lkmqDRDR0OqVGTczZGsxfTK+iaZJaNXb999BmGBw+xnPuG1lgrjHUYyEH2ha9D/9eOXiQfxdKUktPs1cF0II7uv5Cg3LEcFyN/A7jblNpM5B9cnf5kJ13lbpqL+Eyig90b9Q9YsrwGGOqtXJG+jSqXOv0O9/warFJfadA0avJljOFv4Pxl4tYe73EA/gP1GVG5UVC/F9nWZhUzP1kPCjzTzHoYBDCmHf8/GErdpCtibqRHoMIelrbcpe0jr+j5aNPxnTKAc= - file: "${RELEASE_ZIP_FILE}" - on: - tags: true - repo: GerryFerdinandus/bittorrent-tracker-editor - - provider: s3 - access_key_id: $AWS_ACCESS_KEY - secret_access_key: $AWS_SECRET_KEY - bucket: "bittorrent-tracker-editor" - cleanup: false - region: eu-central-1 - local_dir: s3 - edge: true # opt in to dpl v2 - on: - branch: to_be_deleted_unit_test diff --git a/README.md b/README.md index 0970bd1..713853c 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,19 @@ **bittorrent-tracker-editor** will add/remove bittorrent tracker from the torrent file(s). -This software works on Windows XP SP3, Windows 7+, macOS and Linux. +This software works on Windows 7+, macOS and Linux. --- ## Software latest release: ## [![GitHub Latest release](https://img.shields.io/github/release/GerryFerdinandus/bittorrent-tracker-editor/all.svg)](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/releases) - +[![GitHub commits since latest release (by SemVer including pre-releases)](https://img.shields.io/github/commits-since/gerryferdinandus/bittorrent-tracker-editor/latest)](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/commits/main) --- -## Code Status: ## -Continuous integration|Status| Build operating system -------------|---------|--------- -Travis-CI |[![Build Status](https://travis-ci.com/GerryFerdinandus/bittorrent-tracker-editor.svg?branch=master)](https://travis-ci.com/GerryFerdinandus/bittorrent-tracker-editor) |Linux, macOS and Windows -Snapcraft-CI |[![Snap Status](https://build.snapcraft.io/badge/GerryFerdinandus/bittorrent-tracker-editor.svg)](https://build.snapcraft.io/user/GerryFerdinandus/bittorrent-tracker-editor)|Linux +## Build Status: ## +Continuous integration|Status| Generate an executable file for the operating system| Download link +------------|---------|---------|---------- +GitHub Actions |[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/gerryferdinandus/bittorrent-tracker-editor/cicd.yml)](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/actions/workflows/cicd.yml)|Linux(amd64), macOS(Intel processors) and Windows|[![GitHub Latest release](https://img.shields.io/github/release/GerryFerdinandus/bittorrent-tracker-editor/all.svg)](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/releases) +GitHub Actions (Ubuntu snap) |[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/gerryferdinandus/bittorrent-tracker-editor/snap.yml)](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/actions/workflows/snap.yml)|Linux (amd64 and arm64)|[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-white.svg)](https://snapcraft.io/bittorrent-tracker-editor) +Flathub build server||Linux (amd64 and arm64)|Download on Flathub --- ## Warning: ## @@ -48,28 +49,20 @@ There is no backup function in this software. Use it at your own risk. Bittorren ## Software history: ## -### 1.33.0.beta.6 ### +### 1.33.0 ### + * ADD: Support for OpenSSL 3 + * FIX: Handle dark theme on MacOS. ([Issue 49](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/issues/49)) * ADD: Direct download support for ngosang via menu. * ADD: Extra tabpage 'private torrent'. For issue 31 and 34 * ADD: Check box 'Skip Announce Check in the URL' ([Issue 31](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/issues/31)) * ADD: Command parameter '-SAC' -> 'Skip Announce Check' in the URL ([Issue 31](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/issues/31)) * ADD: Support 'Info Source' tag for private trackers ([Issue 34](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/issues/34)) * ADD: Command parameter '-SOURCE' -> info Source tag for private trackers. See readme.txt file ([Issue 34](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/issues/34)) - -### 1.33.0.beta.5 ### * FiX: support for '/announce.php'([Issue 27](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/issues/27)) - -### 1.33.0.beta.4 ### * FIX: There was an issue with uploading tracker list to newTrackon. - -### 1.33.0.beta.3 ### * FIX: WebTorrent do not have '/announce' ([Issue 24](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/issues/24)) - -### 1.33.0.beta.2 ### * ADD: Wrong tracker URL format from torrent files should be unselected by default ([Issue 22](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/issues/22)) * ADD: Upload trackers to newTrackon ([Issue 23](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/issues/23)) - -### 1.33.0.beta.1 ### * ADD: Verify the working status of public trackers. (Data from newTrackon) ([Issue 21](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/issues/21)) ### 1.32.0 ### @@ -113,13 +106,13 @@ There is no backup function in this software. Use it at your own risk. Bittorren --- -![](pictures/trackereditor.png?raw=true "Trackers List") +![](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/releases/download/V1.32.0/trackereditor_list_windows.png "Trackers List") This screen shot show the program, after a folder is selected with torrent files inside. The normal procedure is to deselect the trackers that are no longer working. Optionally add your own trackers. And select the 'Update torrent' menu. --- -![](pictures/filestrackersinfo.png?raw=true "Files/Trackers/Info") +![](https://github.com/GerryFerdinandus/bittorrent-tracker-editor/releases/download/V1.32.0/trackereditor_info_windows.png "Files/Trackers/Info") --- diff --git a/enduser/libeay32.dll b/enduser/libeay32.dll deleted file mode 100644 index b66c6bb..0000000 Binary files a/enduser/libeay32.dll and /dev/null differ diff --git a/enduser/ssleay32.dll b/enduser/ssleay32.dll deleted file mode 100644 index 2ebf965..0000000 Binary files a/enduser/ssleay32.dll and /dev/null differ diff --git a/enduser/version.txt b/enduser/version.txt index fd2f63b..512f784 100644 --- a/enduser/version.txt +++ b/enduser/version.txt @@ -10,7 +10,9 @@ ADD: Command parameter '-SAC' -> 'Skip Announce Check' in the URL (Issue 31) ADD: Support 'Info Source' tag for private trackers (issue 34) ADD: Command parameter '-SOURCE' -> info Source tag for private trackers. See readme.txt file (issue 34) ADD: Direct download support for ngosang via menu (Issue 35) -Compiler Lazarus: v2.04 +ADD: Support for OpenSSL 3 +FIX: Handle dark theme on MacOS. (Issue 49) +Compiler Lazarus: v2.26 ------ Version 1.32 ADD: Add more options for updating the torrent tracker list. (Issue 8) diff --git a/metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.desktop b/metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.desktop new file mode 100644 index 0000000..798d0ca --- /dev/null +++ b/metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=bittorrent-tracker-editor +Comment=Add or remove tracker from torrent files. +Categories=Utility;Qt; +Icon=io.github.gerryferdinandus.bittorrent-tracker-editor +Exec=trackereditor +Terminal=false diff --git a/metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.metainfo.xml b/metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.metainfo.xml new file mode 100644 index 0000000..3e61786 --- /dev/null +++ b/metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.metainfo.xml @@ -0,0 +1,70 @@ + + + io.github.gerryferdinandus.bittorrent-tracker-editor + bittorrent-tracker-editor + Add or remove tracker from torrent files. + Gerry Ferdinandus + io.github.gerryferdinandus.bittorrent-tracker-editor.desktop + + CC0-1.0 + MIT + + https://github.com/GerryFerdinandus/bittorrent-tracker-editor + https://github.com/GerryFerdinandus/bittorrent-tracker-editor/issues + + + + +

+ Warning: There is no backup function in this software. Use it at your own risk. +

+
    +
  • Select one torrent file or a folder with torrent files
  • +
  • Add one or more trackers at the same time
  • +
  • Remove one or more trackers at the same time
  • +
  • Remove all the trackers to create trackerless torrent. DHT torrent
  • +
  • Change public/private flag. Warning: This will change the torrent info HASH
  • +
  • Show torrent files content
  • +
  • Download stable trackers from newTrackon or ngosang
  • +
+

+ BitTorrent works fine without this program. You probably don't need this software. +

+
+ + + + The main window + + https://github.com/GerryFerdinandus/bittorrent-tracker-editor/releases/download/V1.32.0/trackereditor_list_linux.png + + + Torrent info + + https://github.com/GerryFerdinandus/bittorrent-tracker-editor/releases/download/V1.32.0/trackereditor_info_linux.png + + + + + + +

+ This release adds the following features: +

+
    +
  • Verify the working status of public trackers.
  • +
  • Direct download support for ngosang via menu.
  • +
  • Extra tabpage 'private torrent'.
  • +
  • Support 'Info Source' tag for private trackers
  • +
  • Wrong tracker URL format from torrent files should be unselected by default
  • +
  • Upload trackers to newTrackon
  • +
+

This release fixes the following bugs:

+
    +
  • support for '/announce.php'
  • +
  • WebTorrent do not have '/announce'
  • +
+
+
+
+
\ No newline at end of file diff --git a/snap/gui/bittorrent-tracker-editor.png b/metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.png similarity index 100% rename from snap/gui/bittorrent-tracker-editor.png rename to metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.png diff --git a/pictures/filestrackersinfo.png b/pictures/filestrackersinfo.png deleted file mode 100644 index e86897c..0000000 Binary files a/pictures/filestrackersinfo.png and /dev/null differ diff --git a/pictures/trackereditor.png b/pictures/trackereditor.png deleted file mode 100644 index b562ab9..0000000 Binary files a/pictures/trackereditor.png and /dev/null differ diff --git a/scripts/install_and_run_unit_test_in_desktop_ubuntu.sh b/scripts/install_and_run_unit_test_in_desktop_ubuntu.sh deleted file mode 100644 index 5b5202b..0000000 --- a/scripts/install_and_run_unit_test_in_desktop_ubuntu.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -# for local testing of the project in Ubuntu 14.04 (via VirtualBox) - -#create download folder 'download_FPC' -cd ~ -mkdir download_FPC -cd download_FPC - -#download the FPC + lazarus IDE (1.6.2) -wget http://mirrors.iwi.me/lazarus/releases/Lazarus%20Linux%20amd64%20DEB/Lazarus%201.6.2/fpc_3.0.0-151205_amd64.deb -wget http://mirrors.iwi.me/lazarus/releases/Lazarus%20Linux%20amd64%20DEB/Lazarus%201.6.2/fpc-src_3.0.0-151205_amd64.deb -wget http://mirrors.iwi.me/lazarus/releases/Lazarus%20Linux%20amd64%20DEB/Lazarus%201.6.2/lazarus-project_1.6.2-1_amd64.deb - -#Install the downloaded FPC + lazarus IDE -sudo dpkg -i ./*.deb -#install all the software dependency it needed -sudo apt install -f -y - -#install git -sudo apt-get install git -y - -#Download the source code in the home folder -cd ~ -git clone --recursive https://github.com/GerryFerdinandus/bittorrent-tracker-editor.git - -#build the source code trackereditor. (optional: --build-mode=Release) -lazbuild --build-mode=Debug bittorrent-tracker-editor/source/project/tracker_editor/trackereditor.lpi - -#build the source code tracker_editor_test -lazbuild --build-mode=Debug bittorrent-tracker-editor/source/project/unit_test/tracker_editor_test.lpi - -#Run the unit test -./bittorrent-tracker-editor/enduser/test_trackereditor -a --format=plain - - - - - - diff --git a/scripts/travis_add_macos_cert.sh b/scripts/travis_add_macos_cert.sh deleted file mode 100755 index 9ad919c..0000000 --- a/scripts/travis_add_macos_cert.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env sh - -#must run on griet server only -if [ -z "${TRAVIS}" ] -then - echo "This is not TRAVIS CI build server " - exit 1 -fi - -# secure/hidden variable from travis -# CERTIFICATE_OSX_P12 -# CERTIFICATE_PASSWORD - - -# constant variable -KEY_CHAIN=build.keychain -CERTIFICATE_P12=certificate.p12 - -# Recreate the certificate from the secure environment variable -echo $CERTIFICATE_OSX_P12 | base64 --decode > $CERTIFICATE_P12 - -# create a keychain -security create-keychain -p travis $KEY_CHAIN - -# Make the keychain the default so identities are found -security default-keychain -s $KEY_CHAIN - -# Unlock the keychain -security unlock-keychain -p travis $KEY_CHAIN - -security import $CERTIFICATE_P12 -k $KEY_CHAIN -P $CERTIFICATE_PASSWORD -T /usr/bin/codesign; - -security set-key-partition-list -S apple-tool:,apple: -s -k travis $KEY_CHAIN - -# remove certs -rm -fr *.p12 diff --git a/scripts/travis_deploy.sh b/scripts/travis_deploy.sh deleted file mode 100644 index dcaf45c..0000000 --- a/scripts/travis_deploy.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -# Create a zip file for Windows, Linux and macOS. - -#----------- check for Windows, Linux and macOS build -if [ "$TRAVIS_OS_NAME" = "linux" ] -then - # Linux - sudo apt-get install zip -y - echo "Building zip file for Linux amd64" - zip -j $RELEASE_ZIP_FILE enduser/*.txt enduser/trackereditor - -elif [ "$TRAVIS_OS_NAME" = "osx" ] -then - # Apple macOS - echo "Building zip file for macOS" - - # Add certificate into the macOS system - source ./scripts/travis_add_macos_cert.sh - - # sign + zip the app - source ./scripts/travis_sign_macos_app.sh - -elif [ "$TRAVIS_OS_NAME" = "windows" ] -then - # Windows - echo "Building zip file for windows" - choco install zip - zip -j $RELEASE_ZIP_FILE enduser/*.txt enduser/trackereditor.exe enduser/*.dll -fi - -echo "Create Amazon s3 folder" -mkdir -p s3 -cp $RELEASE_ZIP_FILE s3/$(date +%F_%R)_$RELEASE_ZIP_FILE - -echo "Created $RELEASE_ZIP_FILE for GitHub" diff --git a/scripts/travis_sign_macos_app.sh b/scripts/travis_sign_macos_app.sh deleted file mode 100755 index b38796a..0000000 --- a/scripts/travis_sign_macos_app.sh +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env sh - -# secure/hidden variable from travis -#CERTIFICATE_ID="..." -#USERNAME="..." -#APP_SPECIFIC_PASSWORD="..." -#RELEASE_ZIP_FILE="..." - -# path to app -FILE_APP='enduser/macos/app/trackereditor.app' -PLISTBUDDY_APP='/usr/libexec/PlistBuddy' - -if [ ! -x "${PLISTBUDDY_APP}" ] -then - echo "Couldn't find PlistBuddy" - exit 1 -fi - -# copy everything into enduser/macos/app folder -# -# Move the executable to the application bundle -mv enduser/trackereditor enduser/macos/app/trackereditor.app/Contents/MacOS - -# Move the trackers list to application bundle -mv enduser/add_trackers.txt enduser/macos/app/trackereditor.app/Contents/MacOS -mv enduser/remove_trackers.txt enduser/macos/app/trackereditor.app/Contents/MacOS - -# move all the *.txt file -mv enduser/*.txt enduser/macos/app - -# sign the app. -sign is the developer cetificate ID -# entitlements does not work at this moment -#codesign --timestamp --entitlements enduser/macos/entitlements.plist --force --options runtime --deep --sign $CERTIFICATE_ID $FILE_APP -codesign --timestamp --force --options runtime --deep --sign $CERTIFICATE_ID $FILE_APP - -# Check exit code -exit_code=$? -if [ "${exit_code}" != "0" ] -then - echo "codesign failed: ${exit_code}" - exit 1 -fi - -#must use ditto to compress the file application folder only for notarize. Zip program will not work! -/usr/bin/ditto -c -k --keepParent "$FILE_APP" "$RELEASE_ZIP_FILE" - -# upload zip to notarize service. for RequestUUID -# -- username is the normal apple ID. example myname@mail.com -# -- password is 'app specific password' generated via apple web site. Security -> app-specific password -echo "Uploading to notarize server" -xcrun altool --notarize-app --output-format xml --primary-bundle-id "trackereditor" --username $USERNAME --password $APP_SPECIFIC_PASSWORD --file $RELEASE_ZIP_FILE > "result.plist" - -# remove the uploaded zip file. need to be created again later. -rm $RELEASE_ZIP_FILE - - -# Check exit code -exit_code=$? -if [ "${exit_code}" != "0" ] -then - echo "notarize-app failed: ${exit_code}" - cat "result.plist" - exit 1 -fi - -# Get the RequestUUID -RequestUUID="$("${PLISTBUDDY_APP}" -c "Print notarization-upload:RequestUUID" "result.plist")" -echo "RequestUUID: ${RequestUUID}" - -# wait till notarize apple server is finish with the processing the zip upload. -for (( ; ; )) -do - - # get status from apple notarize server - xcrun altool --output-format xml --notarization-info "${RequestUUID}" -u $USERNAME -p $APP_SPECIFIC_PASSWORD > "result.plist" - # Check exit code - exit_code=$? - if [ "${exit_code}" != "0" ] - then - echo "notarization-info failed: ${exit_code}" - cat "result.plist" - # print the error in the URL - LogFileURL="$("${PLISTBUDDY_APP}" -c "Print notarization-info:LogFileURL" "result.plist")" - if [ ! -z "${LogFileURL}" ] - then - curl "${LogFileURL}" - fi - exit 1 - fi - - # get the status. - StatusCode="$("${PLISTBUDDY_APP}" -c "Print notarization-info:Status" "result.plist")" - echo "Status: ${StatusCode}" - - # if no status code present in result then it is still busy - if [ "${StatusCode}" == "in progress" ] - then - sleep 15 - else - echo "Finish waiting." - #cat "result.plist" - # Check if everything is correct - StatusCode="$("${PLISTBUDDY_APP}" -c "Print notarization-info:'Status Code'" "result.plist")" - echo "Status code: ${StatusCode}" - if [ "${StatusCode}" == "0" ] - then - # there are no error. - break - else - # print the error in the URL - LogFileURL="$("${PLISTBUDDY_APP}" -c "Print notarization-info:LogFileURL" "result.plist")" - if [ ! -z "${LogFileURL}" ] - then - curl "${LogFileURL}" - fi - exit 1 - fi - fi -done - -# verify sign *.app is succes full -spctl --assess --type execute --verbose $FILE_APP -# Check exit code -exit_code=$? -if [ "${exit_code}" != "0" ] -then - echo "spctl failed: ${exit_code}" - exit 1 -fi - -# staple the *.app -xcrun stapler staple $FILE_APP -# Check exit code -exit_code=$? -if [ "${exit_code}" != "0" ] -then - echo "spctl stapler: ${exit_code}" - exit 1 -fi - -# zip only the app folder with extra text file. -/usr/bin/ditto -c -k "enduser/macos/app" "$RELEASE_ZIP_FILE" diff --git a/scripts/travis_unit_test.sh b/scripts/travis_unit_test.sh deleted file mode 100644 index 33772eb..0000000 --- a/scripts/travis_unit_test.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -# Run unit test in Windows, Linux and macOS - -#----------- check for Windows, Linux and macOS build -if [ "$TRAVIS_OS_NAME" = "linux" ] -then - # show Linux OS version - uname -a - - # show openSSL version - openssl version - - # Exit immediately if a command exits with a non-zero status. - set -e - xvfb-run enduser/test_trackereditor -a --format=plain - set +e - -elif [ "$TRAVIS_OS_NAME" = "osx" ] -then - # show macOS version - sw_vers - - # show openSSL version - openssl version - - # Exit immediately if a command exits with a non-zero status. - set -e - enduser/test_trackereditor -a --format=plain - set +e - -elif [ "$TRAVIS_OS_NAME" = "windows" ] -then - # Exit immediately if a command exits with a non-zero status. - set -e - enduser/test_trackereditor.exe -a --format=plain - set +e -fi - - -# Remove all the extra file created by test -# We do not what it in the ZIP release files. -rm -f enduser/console_log.txt -rm -f enduser/export_trackers.txt - -# Undo all changes made by testing. -git reset --hard diff --git a/snap/gui/bittorrent-tracker-editor.desktop b/snap/gui/bittorrent-tracker-editor.desktop deleted file mode 100644 index a6cc131..0000000 --- a/snap/gui/bittorrent-tracker-editor.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Version=1.0 -Name=Bittorrent tracker editor -Comment=Software for add or remove tracker from torrent files. -Exec=bittorrent-tracker-editor -Icon=${SNAP}/meta/gui/bittorrent-tracker-editor.png -Terminal=false -Type=Application -Categories=Utility; -Keywords=bittorrent;tracker;editor; diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 001b96f..3aabc9a 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,114 +1,55 @@ name: bittorrent-tracker-editor -version: '1.33.0' -base: core18 -summary: Software for add or remove tracker from torrent files. -description: | - Features: - - Select one torrent file or a folder with torrent files. - - Add one or more trackers at the same time. - - Remove one or more trackers at the same time. - - Remove all the trackers to create trackerless torrent. DHT torrent - - Change public/private flag. Warning: This will change the torrent info HASH. - - Preset add/remove tracker via add_trackers.txt and remove_trackers.txt files. - - Optional start as console program. - - Show torrent files content. - - Download stable trackers from newTrackon or ngosang +adopt-info: mainprogram +icon: metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.png + +base: core22 grade: stable confinement: strict architectures: - build-on: amd64 - - build-on: i386 - build-on: arm64 - - build-on: armhf apps: bittorrent-tracker-editor: - command: desktop-launch $SNAP/app/trackereditor + desktop: mainprogram/io.github.gerryferdinandus.bittorrent-tracker-editor.desktop + extensions: + - kde-neon + command: mainprogram/trackereditor environment: # Fallback to XWayland if running in a Wayland session. DISABLE_WAYLAND: 1 plugs: - - desktop - - desktop-legacy - - x11 - - unity7 - home - network - - wayland - removable-media - -build-packages: - - fpc - - fpc-source - - lcl-nogui - - lazarus + - pulseaudio parts: - bittorrent-tracker-editor: + mainprogram: # Build and add to snap the main program: mainprogram/trackereditor source: https://github.com/GerryFerdinandus/bittorrent-tracker-editor.git + parse-info: [metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.metainfo.xml] plugin: nil override-build: | - snapcraftctl build - lazbuild --build-mode=Release --widgetset=gtk2 source/project/tracker_editor/trackereditor.lpi - mkdir $SNAPCRAFT_PART_INSTALL/app - mv enduser/trackereditor $SNAPCRAFT_PART_INSTALL/app - stage-packages: - - libcanberra-gtk-module - - openssl - - libgail-common - - libatk-adaptor - - overlay-scrollbar-gtk2 - after: - - desktop-gtk2 - - # This part installs the `desktop-launch` script which initialises desktop - # features such as fonts, themes and the XDG environment. It also installs - # the GTK2 runtime libraries. - # - # It is copied straight from the snapcraft desktop helpers project. Please - # periodically check the source for updates and copy the changes. - # https://github.com/ubuntu/snapcraft-desktop-helpers/blob/master/snapcraft.yaml - # - desktop-gtk2: - source: https://github.com/ubuntu/snapcraft-desktop-helpers.git - source-subdir: gtk - plugin: make - make-parameters: ["FLAVOR=gtk2"] + craftctl default + lazbuild --build-mode=Release --widgetset=qt5 source/project/tracker_editor/trackereditor.lpi + mkdir $CRAFT_PART_INSTALL/mainprogram + cp enduser/trackereditor $CRAFT_PART_INSTALL/mainprogram + cp metainfo/io.github.gerryferdinandus.bittorrent-tracker-editor.desktop $CRAFT_PART_INSTALL/mainprogram build-packages: - - libgtk2.0-dev + - fpc + - lazarus + - libqt5pas-dev + + libQt5Pas: # Add to snap the libQt5Pas support library : usr/lib/*/libQt5Pas.* + plugin: nil stage-packages: - - libxkbcommon0 # XKB_CONFIG_ROOT - - ttf-ubuntu-font-family - - dmz-cursor-theme - - light-themes - - adwaita-icon-theme - - gnome-themes-standard - - shared-mime-info - - libgtk2.0-0 - - libgdk-pixbuf2.0-0 - - libglib2.0-bin - - libgtk2.0-bin - - unity-gtk2-module - - libappindicator1 - - locales-all - - ibus-gtk - - libibus-1.0-5 + - libqt5pas1 + prime: + - usr/lib/*/libQt5Pas.* -plugs: - gtk-2-engines: - interface: content - target: $SNAP/lib/gtk-2.0 - default-provider: gtk2-common-themes - gtk-2-themes: - interface: content - target: $SNAP/data-dir/themes - default-provider: gtk-common-themes - icon-themes: - interface: content - target: $SNAP/data-dir/icons - default-provider: gtk-common-themes - sound-themes: - interface: content - target: $SNAP/data-dir/sounds - default-provider: gtk-common-themes +# Only 3 files are explicitly added in this snap: +# trackereditor + .desktop file via copy command +# libQt5Pas.so via prime +# +# Use: 'unsquashfs *.snap' to look what is inside the snap file. diff --git a/source/code/bencode.pas b/source/code/bencode.pas index 715a16a..27fcddc 100644 --- a/source/code/bencode.pas +++ b/source/code/bencode.pas @@ -106,6 +106,7 @@ constructor TBEncoded.Create(Stream: TStream); var X: char; begin + Result := ''; // loop until we come across it X := ' '; repeat diff --git a/source/code/controler_trackerlist_online.pas b/source/code/controler_trackerlist_online.pas index 431fb4e..fb4705b 100644 --- a/source/code/controler_trackerlist_online.pas +++ b/source/code/controler_trackerlist_online.pas @@ -13,7 +13,7 @@ interface type - TDefaultChecked = function(const TrackerURL: UTF8String): boolean of object; + TDefaultChecked = function(const TrackerURL: utf8string): boolean of object; { TControlerTrackerListOnline } @@ -35,7 +35,7 @@ TControlerTrackerListOnline = class procedure SetChecked(index: integer; AValue: boolean); procedure ShowTrackerStatus(Visible: boolean); procedure AppendRow(Checked: boolean; Status: TTrackerListOnlineStatus; - const TrackerURL: UTF8String); + const TrackerURL: utf8string); public property Checked[index: integer]: boolean read GetChecked write SetChecked; function TrackerURL(index: integer): string; @@ -65,6 +65,17 @@ implementation { TControlerTrackerListOnline } +function IsDarkTheme: boolean; + // by "Hansaplast" & "Alextp" from Lazarus forum + function _Level(C: TColor): double; + begin + Result := Red(C) * 0.3 + Green(C) * 0.59 + Blue(C) * 0.11; + end; + +begin + Result := _Level(ColorToRGB(clWindow)) < _Level(ColorToRGB(clWindowText)); +end; + function TControlerTrackerListOnline.DownloadTrackers_All_Live_Stable: boolean; begin Result := FNewTrackon.Download_All_Live_Stable; @@ -88,7 +99,11 @@ constructor TControlerTrackerListOnline.Create(StringGridTorrentURL: TStringGrid FStringGridTorrentURL := StringGridTorrentURL; FStringGridTorrentURL.RowCount := 1; FStringGridTorrentURL.FixedRows := 1; - FStringGridTorrentURL.AlternateColor := clCream; + + if not IsDarkTheme then + begin // The dark theme for Linux and macOS cannot use AlternateColor. Text will be invisible. + FStringGridTorrentURL.AlternateColor := clCream; + end; FSelect := FStringGridTorrentURL.Columns.Add; FSelect.Title.Caption := 'Keep'; @@ -144,7 +159,7 @@ procedure TControlerTrackerListOnline.SetChecked(index: integer; AValue: boolean procedure TControlerTrackerListOnline.AppendRow(Checked: boolean; - Status: TTrackerListOnlineStatus; const TrackerURL: UTF8String); + Status: TTrackerListOnlineStatus; const TrackerURL: utf8string); var CheckedStr, StatusStr: string; begin diff --git a/source/code/main.lfm b/source/code/main.lfm index 5fa3346..a7a2be5 100644 --- a/source/code/main.lfm +++ b/source/code/main.lfm @@ -16,7 +16,7 @@ object FormTrackerModify: TFormTrackerModify OnDropFiles = FormDropFiles OnShow = FormShow Position = poScreenCenter - LCLVersion = '2.0.4.0' + LCLVersion = '2.2.6.0' object PageControl: TPageControl Left = 0 Height = 587 @@ -78,7 +78,6 @@ object FormTrackerModify: TFormTrackerModify Top = 0 Width = 1165 Align = alClient - AlternateColor = clWhite ColCount = 0 FixedCols = 0 FixedRows = 0 @@ -244,10 +243,11 @@ object FormTrackerModify: TFormTrackerModify ClientWidth = 284 TabOrder = 0 object CheckBoxSkipAnnounceCheck: TCheckBox - Left = 16 + Left = 0 Height = 19 Top = 0 - Width = 221 + Width = 284 + Align = alTop Caption = 'Skip Announce Check in the URL (-SAC)' OnChange = CheckBoxSkipAnnounceCheckChange ParentShowHint = False @@ -255,13 +255,14 @@ object FormTrackerModify: TFormTrackerModify TabOrder = 0 end object GroupBoxInfoSource: TGroupBox - Left = 16 + Left = 0 Height = 120 - Top = 32 - Width = 264 + Top = 38 + Width = 284 + Align = alBottom Caption = 'Warning: This will change the torrent info HASH' ClientHeight = 102 - ClientWidth = 260 + ClientWidth = 280 TabOrder = 1 object CheckBoxRemoveAllSourceTag: TCheckBox Left = 8 @@ -277,9 +278,9 @@ object FormTrackerModify: TFormTrackerModify Height = 21 Hint = 'Keep empty if you do not want to add or change anything.' Top = 56 - Width = 221 + Width = 240 EditLabel.Height = 13 - EditLabel.Width = 221 + EditLabel.Width = 240 EditLabel.Caption = 'Add/Change source tag value: (-SOURCE)' EditLabel.ParentColor = False ParentShowHint = False @@ -294,17 +295,17 @@ object FormTrackerModify: TFormTrackerModify end object SelectDirectoryDialog1: TSelectDirectoryDialog Title = 'Select a directory with torrent files inside.' - left = 560 - top = 24 + Left = 560 + Top = 24 end object OpenDialog: TOpenDialog Filter = 'torrent|*.torrent' - left = 560 - top = 88 + Left = 560 + Top = 88 end object MainMenu: TMainMenu - left = 472 - top = 152 + Left = 472 + Top = 152 object MenuFile: TMenuItem Caption = '&File' object MenuOpenTorrentFile: TMenuItem diff --git a/source/code/main.pas b/source/code/main.pas index 1cb416a..5869dcf 100644 --- a/source/code/main.pas +++ b/source/code/main.pas @@ -100,7 +100,7 @@ TFormTrackerModify = class(TForm) procedure FormDestroy(Sender: TObject); //Drag and drop '*.torrent' files/directory or 'tracker.txt' - procedure FormDropFiles(Sender: TObject; const FileNames: array of UTF8String); + procedure FormDropFiles(Sender: TObject; const FileNames: array of utf8string); //At start of the program the form will be show/hide procedure FormShow(Sender: TObject); @@ -166,10 +166,10 @@ TFormTrackerModify = class(TForm) FLogFile, FTrackerFile: TextFile; FProcessTimeStart, FProcessTimeTotal: TDateTime; FControlerGridTorrentData: TControlerGridTorrentData; - function CheckForAnnounce(const TrackerURL: UTF8String): boolean; + function CheckForAnnounce(const TrackerURL: utf8string): boolean; procedure AppendTrackersToMemoNewTrackers(TrackerList: TStringList); procedure ShowUserErrorMessage(const ErrorText: string; const FormText: string = ''); - function TrackerWithURLAndAnnounce(const TrackerURL: UTF8String): boolean; + function TrackerWithURLAndAnnounce(const TrackerURL: utf8string): boolean; procedure UpdateTorrent; procedure ShowHourGlassCursor(HourGlass: boolean); procedure ViewUpdateBegin; @@ -182,13 +182,13 @@ TFormTrackerModify = class(TForm) procedure UpdateViewRemoveTracker; function ReloadAllTorrentAndRefreshView: boolean; function AddTorrentFileList(TorrentFileNameStringList: TStringList): boolean; - function ReadAddTrackerFileFromUser(const FileName: UTF8String): boolean; - function LoadTorrentViaDir(const Dir: UTF8String): boolean; - function DecodeTorrentFile(const FileName: UTF8String): boolean; + function ReadAddTrackerFileFromUser(const FileName: utf8string): boolean; + function LoadTorrentViaDir(const Dir: utf8string): boolean; + function DecodeTorrentFile(const FileName: utf8string): boolean; procedure UpdateTrackerInsideFileList; procedure UpdateTorrentTrackerList; procedure ShowTrackerInsideFileList; - function TestConnectionSSL: Boolean; + function TestConnectionSSL: boolean; procedure CheckedOnOffAllTrackers(Value: boolean); function CopyUserInputNewTrackersToList(Temporary_SkipAnnounceCheck: boolean = @@ -204,10 +204,10 @@ TFormTrackerModify = class(TForm) implementation -uses fphttpclient, LCLIntf, lazutf8, LazFileUtils, trackerlist_online; +uses fphttpclient, LCLIntf, lazutf8, LazFileUtils, trackerlist_online, LCLVersion; const - RECOMENDED_TRACKERS: array[0..2] of UTF8String = + RECOMENDED_TRACKERS: array[0..2] of utf8string = ( 'udp://tracker.coppersurfer.tk:6969/announce', 'udp://tracker.opentrackr.org:1337/announce', @@ -215,7 +215,8 @@ implementation ); //program name and version (http://semver.org/) - FORM_CAPTION = 'Bittorrent tracker editor (1.33.0.beta.6)'; + FORM_CAPTION = 'Bittorrent tracker editor (1.33.0/LCL ' + + lcl_version + '/FPC ' + {$I %FPCVERSION%} + ')'; GROUPBOX_PRESENT_TRACKERS_CAPTION = 'Present trackers in all torrent files. Select the one that you want to keep. And added to all torrent files.'; @@ -235,16 +236,21 @@ procedure TFormTrackerModify.FormCreate(Sender: TObject); end; {$IFDEF LINUX} - // if a ubuntu snap program then save it to other place + // If it is a Ubuntu snap program, save it a special folder FFolderForTrackerListLoadAndSave := GetEnvironmentVariable('SNAP_USER_COMMON'); + // If it is a flatpak program, save it in a special folder + if GetEnvironmentVariable('container') = 'flatpak' then + begin + FFolderForTrackerListLoadAndSave := GetEnvironmentVariable('XDG_DATA_HOME'); + end; if FFolderForTrackerListLoadAndSave = '' then begin - // NOT a snap program + // No container detected. Save in the same place as the application file FFolderForTrackerListLoadAndSave := ExtractFilePath(Application.ExeName); end else begin - // A snap program + // Program run in a container. Must load file from a dedicated folder. FFolderForTrackerListLoadAndSave := AppendPathDelim(FFolderForTrackerListLoadAndSave); end; {$ELSE} @@ -471,7 +477,7 @@ procedure TFormTrackerModify.MenuItemOnlineCheckSubmitNewTrackonClick(Sender: TO procedure TFormTrackerModify.AppendTrackersToMemoNewTrackers(TrackerList: TStringList); var - tracker: UTF8String; + tracker: utf8string; begin //Append all the trackers to MemoNewTrackers MemoNewTrackers.Lines.BeginUpdate; @@ -521,7 +527,7 @@ procedure TFormTrackerModify.MenuItemOnlineCheckDownloadNewTrackonClick( end; end; -function TFormTrackerModify.CheckForAnnounce(const TrackerURL: UTF8String): boolean; +function TFormTrackerModify.CheckForAnnounce(const TrackerURL: utf8string): boolean; begin Result := (not FTrackerList.SkipAnnounceCheck) and (not WebTorrentTrackerURL(TrackerURL)) and (not FDragAndDropStartUp); @@ -547,7 +553,7 @@ procedure TFormTrackerModify.ShowUserErrorMessage(const ErrorText: string; end; function TFormTrackerModify.TrackerWithURLAndAnnounce( - const TrackerURL: UTF8String): boolean; + const TrackerURL: utf8string): boolean; begin //Validate the begin of the URL Result := ValidTrackerURL(TrackerURL); @@ -874,7 +880,7 @@ procedure TFormTrackerModify.UpdateTorrent; procedure TFormTrackerModify.SaveTrackerFinalListToFile; var - TrackerStr: UTF8String; + TrackerStr: utf8string; begin //Create the tracker text file. The old one will be overwritten AssignFile(FTrackerFile, FFolderForTrackerListLoadAndSave + FILE_NAME_EXPORT_TRACKERS); @@ -894,7 +900,7 @@ procedure TFormTrackerModify.SaveTrackerFinalListToFile; procedure TFormTrackerModify.ConsoleModeOrDragAndDropStartupMode; var - FileNameOrDirStr: UTF8String; + FileNameOrDirStr: utf8string; StringList: TStringList; MustExitWithErrorCode: boolean; begin @@ -1030,7 +1036,7 @@ procedure TFormTrackerModify.ConsoleModeOrDragAndDropStartupMode; procedure TFormTrackerModify.UpdateViewRemoveTracker; var - TrackerStr: UTF8String; + TrackerStr: utf8string; i: integer; begin { @@ -1083,7 +1089,7 @@ procedure TFormTrackerModify.UpdateViewRemoveTracker; -function TFormTrackerModify.DecodeTorrentFile(const FileName: UTF8String): boolean; +function TFormTrackerModify.DecodeTorrentFile(const FileName: utf8string): boolean; begin //Called when user add torrent files //False if something is wrong with decoding torrent. @@ -1097,7 +1103,7 @@ function TFormTrackerModify.DecodeTorrentFile(const FileName: UTF8String): boole procedure TFormTrackerModify.UpdateTorrentTrackerList; var - TrackerStr: UTF8String; + TrackerStr: utf8string; begin //Copy the trackers found in one torrent file to FTrackerList.TrackerFromInsideTorrentFilesList for TrackerStr in FDecodePresentTorrent.TrackerList do @@ -1131,7 +1137,7 @@ procedure TFormTrackerModify.CheckedOnOffAllTrackers(Value: boolean); function TFormTrackerModify.CopyUserInputNewTrackersToList( Temporary_SkipAnnounceCheck: boolean): boolean; var - TrackerStrLoop, TrackerStr, ErrorStr: UTF8String; + TrackerStrLoop, TrackerStr, ErrorStr: utf8string; begin { Called after 'update torrent' is selected. @@ -1256,7 +1262,7 @@ procedure TFormTrackerModify.LoadTrackersTextFileAddTrackers( procedure TFormTrackerModify.LoadTrackersTextFileRemoveTrackers; var - filename: UTF8String; + filename: utf8string; begin filename := FFolderForTrackerListLoadAndSave + FILE_NAME_REMOVE_TRACKERS; try @@ -1350,7 +1356,7 @@ procedure TFormTrackerModify.MenuHelpVisitNewTrackonClick(Sender: TObject); function TFormTrackerModify.ReadAddTrackerFileFromUser( - const FileName: UTF8String): boolean; + const FileName: utf8string): boolean; var TrackerFileList: TStringList; begin @@ -1436,7 +1442,7 @@ procedure TFormTrackerModify.MenuUpdateTorrentSortClick(Sender: TObject); -function TFormTrackerModify.LoadTorrentViaDir(const Dir: UTF8String): boolean; +function TFormTrackerModify.LoadTorrentViaDir(const Dir: utf8string): boolean; var TorrentFilesNameStringList: TStringList; begin @@ -1454,7 +1460,7 @@ function TFormTrackerModify.LoadTorrentViaDir(const Dir: UTF8String): boolean; procedure TFormTrackerModify.FormDropFiles(Sender: TObject; - const FileNames: array of UTF8String); + const FileNames: array of utf8string); var Count: integer; TorrentFileNameStringList, //for the torrent files @@ -1466,7 +1472,7 @@ procedure TFormTrackerModify.FormDropFiles(Sender: TObject; //ViewUpdateBegin must be called one time. Keep track of it. ViewUpdateBeginActiveOneTimeOnly: boolean; - FileNameOrDirStr: UTF8String; + FileNameOrDirStr: utf8string; begin //Drag and drop a folder or files? @@ -1598,7 +1604,7 @@ function TFormTrackerModify.AddTorrentFileList(TorrentFileNameStringList: //This called from 'add folder' or 'drag and drop' var Count: integer; - TorrentFileNameStr: UTF8String; + TorrentFileNameStr: utf8string; begin { Every torrent file must be decoded for the tracker list inside. This torrent tracker list is add to FTrackerList.TrackerFromInsideTorrentFilesList. @@ -1639,7 +1645,7 @@ function TFormTrackerModify.AddTorrentFileList(TorrentFileNameStringList: function TFormTrackerModify.ReloadAllTorrentAndRefreshView: boolean; var - TorrentFileStr: UTF8String; + TorrentFileStr: utf8string; begin { This is called after updating the torrent. @@ -1703,7 +1709,7 @@ procedure TFormTrackerModify.ViewUpdateBegin; procedure TFormTrackerModify.ViewUpdateOneTorrentFileDecoded; var RowIndex: integer; - TorrentFileNameStr, PrivateStr: UTF8String; + TorrentFileNameStr, PrivateStr: utf8string; DateTimeStr: string; begin //Called after loading torrent file. @@ -1821,7 +1827,7 @@ procedure TFormTrackerModify.ShowHourGlassCursor(HourGlass: boolean); end; -function TFormTrackerModify.TestConnectionSSL: Boolean; +function TFormTrackerModify.TestConnectionSSL: boolean; begin Result := ParamCount = 1; if Result then @@ -1832,7 +1838,8 @@ function TFormTrackerModify.TestConnectionSSL: Boolean; begin // Check if there is SLL connection try - TFPCustomHTTPClient.SimpleGet('https://raw.githubusercontent.com/gerryferdinandus/bittorrent-tracker-editor/master/.travis.yml'); + TFPCustomHTTPClient.SimpleGet( + 'https://raw.githubusercontent.com/gerryferdinandus/bittorrent-tracker-editor/master/README.md'); except //No SLL or no internet connection. System.ExitCode := 1; @@ -1840,4 +1847,5 @@ function TFormTrackerModify.TestConnectionSSL: Boolean; end; end; end; + end. diff --git a/source/code/ngosang_trackerslist.pas b/source/code/ngosang_trackerslist.pas index 21168b5..e900ba3 100644 --- a/source/code/ngosang_trackerslist.pas +++ b/source/code/ngosang_trackerslist.pas @@ -66,7 +66,7 @@ TngosangTrackerList = class implementation -uses fphttpclient, LazUTF8, torrent_miscellaneous; +uses opensslsockets, OpenSSL, fphttpclient, LazUTF8, torrent_miscellaneous; const URL: array [Tngosang_List] of string = @@ -104,6 +104,7 @@ constructor TngosangTrackerList.Create; var i: Tngosang_List; begin + //Create all the TStringList for i in Tngosang_List do begin @@ -125,4 +126,47 @@ destructor TngosangTrackerList.Destroy; inherited Destroy; end; +initialization + // FPC 3.2.2 is missing support for the latest openSSL 3, will be fix in the future release. + // Latest openssl.pas https://gitlab.com/freepascal.org/fpc/source/-/blob/main/packages/openssl/src/openssl.pas?ref_type=heads + // Copy this newer SSL detection into the older openssl code used by the present FPC 3.2.2 +{$IFDEF VER3_2} +{$IFDEF WINDOWS} + DLLSSLName3 := {$IFDEF WIN64}'libssl-3-x64.dll'{$ELSE}'libssl-3.dll'{$ENDIF}; + DLLUtilName2 := {$IFDEF WIN64}'libcrypto-3-x64.dll'{$ELSE}'libcrypto-3.dll'{$ENDIF}; +{$ELSE WINDOWS} +{$IFDEF DARWIN} + if High(OpenSSL.DLLVersions) >= 19 then + begin + // macOS version + // LibreSSL + OpenSSL.DLLVersions[1] := '.48'; + OpenSSL.DLLVersions[2] := '.47'; + OpenSSL.DLLVersions[3] := '.46'; + OpenSSL.DLLVersions[4] := '.45'; + OpenSSL.DLLVersions[5] := '.44'; + OpenSSL.DLLVersions[6] := '.43'; + OpenSSL.DLLVersions[7] := '.35'; + + // OpenSSL + OpenSSL.DLLVersions[8] := '.3'; + OpenSSL.DLLVersions[9] := '.1.1'; + OpenSSL.DLLVersions[10] := '.11'; + OpenSSL.DLLVersions[11] := '.10'; + OpenSSL.DLLVersions[12] := '.1.0.6'; + OpenSSL.DLLVersions[13] := '.1.0.5'; + OpenSSL.DLLVersions[14] := '.1.0.4'; + OpenSSL.DLLVersions[15] := '.1.0.3'; + OpenSSL.DLLVersions[16] := '.1.0.2'; + OpenSSL.DLLVersions[17] := '.1.0.1'; + OpenSSL.DLLVersions[18] := '.1.0.0'; + OpenSSL.DLLVersions[19] := '.0.9.8'; + end; +{$ElSE DARWIN} + // Unix/Linux version of FPC need openSSL 3 in the detection list + OpenSSL.DLLVersions[Length(OpenSSL.DLLVersions) - 1] := '.3'; +{$ENDIF DARWIN} +{$ENDIF WINDOWS} +{$ENDIF VER3_2} + end. diff --git a/source/project/tracker_editor/trackereditor.lpi b/source/project/tracker_editor/trackereditor.lpi index 11ee463..bc0e2ec 100644 --- a/source/project/tracker_editor/trackereditor.lpi +++ b/source/project/tracker_editor/trackereditor.lpi @@ -1,14 +1,14 @@ - + + - <ResourceType Value="res"/> <UseXPManifest Value="True"/> diff --git a/source/project/tracker_editor/trackereditor.res b/source/project/tracker_editor/trackereditor.res index f6e8499..5565379 100644 Binary files a/source/project/tracker_editor/trackereditor.res and b/source/project/tracker_editor/trackereditor.res differ diff --git a/source/project/unit_test/tracker_editor_test.lpi b/source/project/unit_test/tracker_editor_test.lpi index e0d0afb..ed4628d 100644 --- a/source/project/unit_test/tracker_editor_test.lpi +++ b/source/project/unit_test/tracker_editor_test.lpi @@ -1,11 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <CONFIG> <ProjectOptions> - <Version Value="11"/> + <Version Value="12"/> <PathDelim Value="\"/> <General> + <Flags> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + <CompatibilityMode Value="True"/> + </Flags> <SessionStorage Value="None"/> - <MainUnit Value="0"/> <Title Value="tracker_editor_test"/> <UseAppBundle Value="False"/> <ResourceType Value="res"/> @@ -44,7 +49,6 @@ <Linking> <Debugging> <DebugInfoType Value="dsDwarf2Set"/> - <UseHeaptrc Value="True"/> <TrashVariables Value="True"/> <UseValgrind Value="True"/> <UseExternalDbgSyms Value="True"/> @@ -83,6 +87,9 @@ <Version Value="2"/> </PublishOptions> <RunParams> + <local> + <CommandLineParams Value="-a --format=plain"/> + </local> <FormatVersion Value="2"/> <Modes Count="1"> <Mode0 Name="default"> @@ -149,7 +156,7 @@ <Linking> <Debugging> <DebugInfoType Value="dsDwarf3"/> - <UseHeaptrc Value="True"/> + <UseLineInfoUnit Value="False"/> </Debugging> </Linking> </CompilerOptions> diff --git a/travis-lazarus b/travis-lazarus deleted file mode 160000 index e5caece..0000000 --- a/travis-lazarus +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e5caece318f06832ff767e3824ee450bcb7b7512