diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 76f8ff2..e8ce40e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -32,34 +32,6 @@ jobs: uses: docker/setup-qemu-action@v2 with: platforms: arm64 - - name: Install missing depends to get QQ version - run: dnf -y install jq - - name: Get QQ version in manifest - id: qq-version - shell: bash - run: | - _arch=$(flatpak --default-arch) - _manifest=$(flatpak-builder --show-manifest com.qq.QQ.yaml) - _extra_datas=$(echo "$_manifest" | jq -r ".modules[].sources | map(select(.type == \"extra-data\")) | select(length > 0)") - _qq=$(echo "$_extra_datas" | jq -r "map(select(.\"only-arches\" | contains([\"$_arch\"])))") - _url=$(echo "$_qq" | jq -r ".[0].url") - _version=$(echo "${_url##*/}" | cut -d _ -f 2,3) - echo "version=$_version" >> $GITHUB_OUTPUT - - name: Cache preloads-${{ steps.qq-version.outputs.version }}.tar.gz - uses: actions/cache@v4 - id: cache - with: - path: preloads-${{ steps.qq-version.outputs.version }}.tar.gz - key: ${{ matrix.arch }}-${{ steps.qq-version.outputs.version }} - - name: Install missing depends to run QQ - if: steps.cache.outputs.cache-hit != 'true' - run: dnf -y install bsdtar nss at-spi2-atk cups-libs gtk3 mesa-libgbm - - name: Generate preloads - if: steps.cache.outputs.cache-hit != 'true' - run: bash extract-preloads.sh - - name: Link preloads - if: steps.cache.outputs.cache-hit == 'true' - run: ln -srfv preloads-${{ steps.qq-version.outputs.version }}.tar.gz preloads.tar.gz - uses: flatpak/flatpak-github-actions/flatpak-builder@v6 with: bundle: com.qq.QQ.flatpak diff --git a/README.md b/README.md index 7eeeed1..bae3575 100644 --- a/README.md +++ b/README.md @@ -16,31 +16,6 @@ This package enables the flags to run on Wayland and it should work out-of-the-b This package also can fallback to X11 when Wayland is not available. -## For NixOS Users - -As NixOS not obey FHS(Filesystem Hierarchy Standard), and this project require a FHS enviroment to finish some process. - -A simple way is install a Steam (*unfree software*). - -```nix -# configuration.nix - -{ - pkgs, - config, - ... -}: { - programs.steam = { - enable = true; - package = pkgs.steam; - }; -} -``` - -After rebuild, Steam provide `steam-run` that run a program in FHS enviroment. -Therefore, you could use `steam-run bash` to use this project. -Also, you could use another way to achieve this if you don't like unfree. - ## Legality The QQ app itself is **proprietary** (closed source). diff --git a/com.qq.QQ.yaml b/com.qq.QQ.yaml index de4f9dd..a9f4b57 100644 --- a/com.qq.QQ.yaml +++ b/com.qq.QQ.yaml @@ -174,13 +174,11 @@ modules: - install -Dm644 README.md $FLATPAK_DEST/lib/LiteLoaderQQNT/README.md - cp -r src $FLATPAK_DEST/lib/LiteLoaderQQNT/src - install -Dm755 patch_qq $FLATPAK_DEST/bin/patch_qq - - bsdtar -xf preloads.tar.gz - - cp -rv --no-preserve=ownership preloads $FLATPAK_DEST/lib/LiteLoaderQQNT/preloads-origin sources: - type: git url: https://github.com/LiteLoaderQQNT/LiteLoaderQQNT.git - commit: bd5a9fb16ecfd25adc9d2b760f943582dbb7f531 - tag: 1.2.1 + commit: 3e8bcb3aa3af4532c52eb5a77626d8573980e7b1 + tag: 1.2.2 x-checker-data: type: git tag-pattern: "^([\\d.]+)$" @@ -189,15 +187,6 @@ modules: - type: script commands: - echo Applying modifications to QQ... - - sed -i '1 i require("/app/lib/LiteLoaderQQNT");' QQ/resources/app/app_launcher/index.js - - for file in /app/lib/LiteLoaderQQNT/preloads-origin/*preload*.js - - do - - preload=/app/lib/LiteLoaderQQNT/src/preload.js - - target="./QQ/resources/app/application/$(basename $file)" - - echo "Injecting $preload into $target..." - - printf "%s\n{%s}" "$(< $preload)" "$( <$file)" > "$target" - - done + - echo 'require("/app/lib/LiteLoaderQQNT");' > QQ/resources/app/app_launcher/loader.js + - sed -i 's|./application/app_launcher/index.js|./app_launcher/loader.js|' QQ/resources/app/package.json dest-filename: patch_qq - - - type: file - path: preloads.tar.gz diff --git a/extract-preloads.sh b/extract-preloads.sh deleted file mode 100644 index f9a8d53..0000000 --- a/extract-preloads.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/bash - -JQ=${JQ:-jq -r} -CURL=${CURL:-curl} -FLATPAK=${FLATPAK:-flatpak} -FLATPAK_BUILDER=${FLATPAK_BUILDER:-flatpak-builder} -BSDTAR=${BSDTAR:-bsdtar} -AWK=${AWK:-awk} -SHA256SUM=${SHA256SUM:-sha256sum} -ECHO=${ECHO:-echo} -RM=${RM:-rm -rf} -SED=${SED:-sed -i} -EXIT=${EXIT:-exit} -WC=${WC:-wc -l} -FIND=${FIND:-find} -CUT=${CUT:-cut} -REALPATH=${REALPATH:-realpath} -DIRNAME=${DIRNAME:-dirname} -LN=${LN:-ln -srfv} -MKTEMP=${MKTEMP:-mktemp -d} -# FLATPAK_BUILDER_ARGS -BUILD_DIR=${BUILD_DIR:-build} -MANIFEST=${MANIFEST:-com.qq.QQ.yaml} - -declare _ARCH -_ARCH=$($FLATPAK --default-arch) - -declare _JQ_EXTRA_SELECTOR=".modules[].sources | map(select(.type == \"extra-data\")) | select(length > 0)" -declare _JQ_ARCH_SELECTOR="map(select(.\"only-arches\" | contains([\"$_ARCH\"])))" -declare _JQ_ITEM_SELECTOR="$_JQ_EXTRA_SELECTOR | $_JQ_ARCH_SELECTOR | .[0]" -declare _JQ_URL_SELECTOR=" $_JQ_ITEM_SELECTOR | .url" -declare _JQ_SHA256_SELECTOR="$_JQ_ITEM_SELECTOR | .sha256" - -declare _MANIFEST_JSON _URL _TMP_QQ_VERSION _SHA256_VALUE -_MANIFEST_JSON=$($FLATPAK_BUILDER --show-manifest "$MANIFEST") -_URL=$($ECHO "$_MANIFEST_JSON" | $JQ "$_JQ_URL_SELECTOR") -_SHA256_VALUE=$($ECHO "$_MANIFEST_JSON" | $JQ "$_JQ_SHA256_SELECTOR") -_TMP_QQ_VERSION=$($ECHO "${_URL##*/}" | $CUT -d _ -f 2,3) -declare _TMP_QQ_DEB="qq-$_TMP_QQ_VERSION.deb" - -if [[ -f "$_TMP_QQ_DEB" ]] -then - declare _SHA256_VALUE_ACTUAL - _SHA256_VALUE_ACTUAL=$($SHA256SUM "$_TMP_QQ_DEB" | $AWK "{print \$1}") - if [[ "$_SHA256_VALUE_ACTUAL" != "$_SHA256_VALUE" ]] - then - $ECHO "SHA256 Checksum mismatch:" - $ECHO "Wants $_SHA256_VALUE" - $ECHO "Actual $_SHA256_VALUE_ACTUAL" - $ECHO - $ECHO "Removing $_TMP_QQ_DEB..." - $RM "$_TMP_QQ_DEB" - fi -fi - -if [[ ! -f "$_TMP_QQ_DEB" ]] -then - $ECHO "Downloading $_TMP_QQ_DEB with URL $_URL..." - $CURL -L "$_URL" -o "$_TMP_QQ_DEB" -fi - -$ECHO "Extracting $_TMP_QQ_DEB..." -$BSDTAR --to-stdout -xf "$_TMP_QQ_DEB" "data.*" | $BSDTAR -xf - - -declare _TMP_QQ_DIR="opt/QQ" -declare _TMP_QQ_RESOURCES="$_TMP_QQ_DIR/resources/app" -declare _TMP_QQ_INDEX_JS="$_TMP_QQ_RESOURCES/app_launcher/index.js" -declare _TMP_REPO -_TMP_REPO=$($REALPATH "$($DIRNAME "$0")") -declare _TMP_REPO_EXTRACTOR_JS="$_TMP_REPO/patch/extractor.js" -$ECHO "Modifying $_TMP_QQ_INDEX_JS..." -$SED "1 i require(\"$_TMP_REPO_EXTRACTOR_JS\");" "$_TMP_QQ_INDEX_JS" - -declare _TMP_REPO_PRELOADS_DIR="$_TMP_REPO/preloads" -$ECHO "Removing $_TMP_REPO_PRELOADS_DIR folder..." -$RM "$_TMP_REPO_PRELOADS_DIR" - -$ECHO "Launching modified QQ..." -declare _TMP_QQ_HOME -_TMP_QQ_HOME=$($MKTEMP) -HOME="$_TMP_QQ_HOME" "$_TMP_QQ_DIR/qq" --no-sandbox "$_TMP_QQ_RESOURCES" - -if [[ ! -d "$_TMP_REPO_PRELOADS_DIR" ]] -then - $ECHO "Failed to extract preloads." - $EXIT 1 -fi - -declare _TMP_PRELOADS_COUNT -_TMP_PRELOADS_COUNT=$($FIND "$_TMP_REPO_PRELOADS_DIR" -type f -name "*preload*.js" | $WC) -if [[ "$_TMP_PRELOADS_COUNT" -gt 0 ]] -then - declare _TMP_PRELOADS_ARCHIVE="$_TMP_REPO/preloads-$_TMP_QQ_VERSION.tar.gz" - declare _TMP_PRELOADS_ARCHIVE_NO_VERSION="$_TMP_REPO/preloads.tar.gz" - $ECHO "Extract preloads successfully." - $ECHO "Creating archive..." - $BSDTAR -C "$_TMP_REPO" -cf "$_TMP_PRELOADS_ARCHIVE" "$($REALPATH --relative-to="$_TMP_REPO" "$_TMP_REPO_PRELOADS_DIR")" - $LN "$_TMP_PRELOADS_ARCHIVE" "$_TMP_PRELOADS_ARCHIVE_NO_VERSION" - $ECHO "Cleaning up temp files..." - $RM "$_TMP_QQ_DEB" "opt" "usr" "$_TMP_REPO_PRELOADS_DIR" - $RM "$_TMP_QQ_HOME" - $EXIT 0 -fi - -$ECHO "No preload js found." -$EXIT 1 diff --git a/patch/extractor.js b/patch/extractor.js deleted file mode 100644 index 8e3a66b..0000000 --- a/patch/extractor.js +++ /dev/null @@ -1,29 +0,0 @@ -// https://aur.archlinux.org/cgit/aur.git/tree/gen_preload.js?h=liteloader-qqnt-git -// https://github.com/LiteLoaderQQNT/LiteLoaderQQNT/blob/main/src/init.js - -const fs = require("fs"); -const path = require("path"); - -const outputPath = path.join(process.cwd(), "preloads"); -const applicationPath = path.join(process.resourcesPath, "app", "application"); - -if (!fs.existsSync(outputPath)) { - console.log("Creating %s...", outputPath); - fs.mkdirSync(outputPath); -} - -const applicationAsar = fs.readdirSync(applicationPath + ".asar", "utf-8"); -for (const fileName of applicationAsar) { - if (fileName.includes("preload")) { - const filePath = path.join(applicationPath, fileName); - const outputFilePath = path.join(outputPath, fileName); - console.log("Extracting %s to %s", filePath, outputFilePath); - const content = fs.readFileSync(filePath, "utf-8"); - fs.writeFileSync( - outputFilePath, content, - {encoding: "utf-8"} - ); - } -} - -process.exit(0);