diff options
Diffstat (limited to 'pkgs/unofficial-homestuck-collection')
6 files changed, 243 insertions, 171 deletions
diff --git a/pkgs/unofficial-homestuck-collection/0001-disable-git-rev-check.patch b/pkgs/unofficial-homestuck-collection/0001-disable-git-rev-check.patch new file mode 100644 index 0000000..d08db5f --- /dev/null +++ b/pkgs/unofficial-homestuck-collection/0001-disable-git-rev-check.patch @@ -0,0 +1,47 @@ +From 6b75316ea085a654c53c59816caaac5b0b880f48 Mon Sep 17 00:00:00 2001 +From: Freya Murphy <freya@freyacat.org> +Date: Sun, 20 Jul 2025 11:53:51 -0400 +Subject: [PATCH 1/3] disable git rev check + +--- + vue.config.js | 21 +++------------------ + 1 file changed, 3 insertions(+), 18 deletions(-) + +diff --git a/vue.config.js b/vue.config.js +index 04b61d3..559b119 100644 +--- a/vue.config.js ++++ b/vue.config.js +@@ -1,27 +1,12 @@ + const webpack = require('webpack') + const { execSync } = require('child_process') + +-const git_branch = execSync('git rev-parse --abbrev-ref HEAD').toString() +- + var build_info = { +- 'process.env.BUILD_BRANCH': JSON.stringify( +- git_branch.trim() +- ), ++ 'process.env.BUILD_BRANCH': "@git_branch@", + 'process.env.BUILD_DATE': JSON.stringify(new Date().toISOString()), + 'process.env.BUILD_PLATFORM': JSON.stringify(process.platform), +- 'process.env.BUILD_GIT_REVISION': JSON.stringify( +- execSync('git rev-parse HEAD').toString().trim() +- ) +-} +- +-try { +- const git_remote = execSync(`git config --get branch.${git_branch.trim()}.remote`).toString() +- const git_remote_url = execSync(`git config --get remote.${git_remote.trim()}.url`).toString() +- +- build_info['process.env.BUILD_GIT_REMOTE'] = JSON.stringify(git_remote_url.trim()) +-} catch (e) { +- build_info['process.env.BUILD_GIT_REMOTE'] = JSON.stringify("(no remote)") +- console.warn("No git remote") ++ 'process.env.BUILD_GIT_REVISION': "@git_revision@", ++ 'process.env.BUILD_GIT_REMOTE': "@git_remote@", + } + + module.exports = { +-- +2.50.0 + diff --git a/pkgs/unofficial-homestuck-collection/0001-fix-source.patch b/pkgs/unofficial-homestuck-collection/0001-fix-source.patch deleted file mode 100644 index df1144a..0000000 --- a/pkgs/unofficial-homestuck-collection/0001-fix-source.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0d63f04b5224bda4b5e9a37767da912c7ba1ef1c Mon Sep 17 00:00:00 2001 -From: Freya Murphy <freya@freyacat.org> -Date: Thu, 17 Jul 2025 12:58:56 -0400 -Subject: [PATCH] fix source - ---- - src/background.js | 3 ++- - src/store/localData.js | 2 +- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/src/background.js b/src/background.js -index 426a84a..3b587ab 100644 ---- a/src/background.js -+++ b/src/background.js -@@ -747,7 +747,8 @@ async function createWindow () { - titleBarStyle: 'hidden', - autoHideMenuBar: true, - webPreferences: { -- nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION, -+ nodeIntegration: true, -+ contextIsolation: false, - enableRemoteModule: true, - plugins: true, - webviewTag: true -diff --git a/src/store/localData.js b/src/store/localData.js -index 2be2235..69833ff 100644 ---- a/src/store/localData.js -+++ b/src/store/localData.js -@@ -33,7 +33,7 @@ const migrations = { - '2.6.9': store => { - const settings_prev = store.get('settings', {}) - if (settings_prev && !isWebApp && settings_prev.ruffleFallback) { -- store.set('settings.ruffleFallback', false) -+ store.set('settings.ruffleFallback', true) - } - } - } --- -2.50.0 - diff --git a/pkgs/unofficial-homestuck-collection/0002-disable-update-check.patch b/pkgs/unofficial-homestuck-collection/0002-disable-update-check.patch new file mode 100644 index 0000000..c1b9dde --- /dev/null +++ b/pkgs/unofficial-homestuck-collection/0002-disable-update-check.patch @@ -0,0 +1,63 @@ +From 2962679d4a3d8320681fcd6804712a71a9ea661b Mon Sep 17 00:00:00 2001 +From: Freya Murphy <freya@freyacat.org> +Date: Sun, 20 Jul 2025 12:06:21 -0400 +Subject: [PATCH 2/3] disable update check + +--- + src/components/SystemPages/Settings.vue | 15 +++++++++------ + src/components/UIElements/Updater.vue | 13 +------------ + 2 files changed, 10 insertions(+), 18 deletions(-) + +diff --git a/src/components/SystemPages/Settings.vue b/src/components/SystemPages/Settings.vue +index 3371358..47c5ea6 100644 +--- a/src/components/SystemPages/Settings.vue ++++ b/src/components/SystemPages/Settings.vue +@@ -598,12 +598,15 @@ export default { + label: "Use system window decorations", + desc: "Use OS-native window decorations instead of the electron title bar. <strong>Will restart the application.</strong>", + platform_whitelist: ['electron'] +- }, { +- model: "allowSysUpdateNotifs", +- label: "Update notifications", +- desc: "Unless this setting is disabled, the collection will check to see if there's a new version of the app available when it starts up and alert you if there is.", +- platform_whitelist: ['electron'] +- }, { ++ }, ++ // MOD: patch out update notifs ++ // { ++ // model: "allowSysUpdateNotifs", ++ // label: "Update notifications", ++ // desc: "Unless this setting is disabled, the collection will check to see if there's a new version of the app available when it starts up and alert you if there is.", ++ // platform_whitelist: ['electron'] ++ // }, ++ { + model: "useTabbedBrowsing", + label: "Tabbed Browsing", + desc: "By default, the web app only shows one page at a time, like a standard website. This setting re-enables the in-app tab bar, and the app will store your tabs in settings.", +diff --git a/src/components/UIElements/Updater.vue b/src/components/UIElements/Updater.vue +index 6b3f677..d9bae45 100644 +--- a/src/components/UIElements/Updater.vue ++++ b/src/components/UIElements/Updater.vue +@@ -73,18 +73,7 @@ export default { + watch: { + }, + mounted(){ +- const is_flatpak = !!(process.env.container) +- if (this.$localData.settings.allowSysUpdateNotifs && !is_flatpak) { +- const now = new Date() +- const last_checked = new Date(this.$localData.settings.lastCheckedUpdate) +- const one_day = (12 * 60 * 60 * 1000) +- if (last_checked == "Invalid Date" || now - last_checked > one_day) { +- this.doUpdateCheck() +- this.$localData.settings.lastCheckedUpdate = now.toISOString() +- } else { +- this.$logger.info("Skipping update check, already checked", last_checked) +- } +- } ++ // MOD: patch out update check + } + } + </script> +-- +2.50.0 + diff --git a/pkgs/unofficial-homestuck-collection/0003-make-compatible-with-native-electron.patch b/pkgs/unofficial-homestuck-collection/0003-make-compatible-with-native-electron.patch new file mode 100644 index 0000000..49de8df --- /dev/null +++ b/pkgs/unofficial-homestuck-collection/0003-make-compatible-with-native-electron.patch @@ -0,0 +1,103 @@ +From 0f84aa973f9e2f7fae8980429b59acccfcc09458 Mon Sep 17 00:00:00 2001 +From: Freya Murphy <freya@freyacat.org> +Date: Sun, 20 Jul 2025 12:01:12 -0400 +Subject: [PATCH 3/3] make compatible with native electron + +--- + src/background.js | 17 ++++++----------- + src/components/SystemPages/Settings.vue | 12 +++++++----- + src/components/UIElements/MediaEmbed.vue | 20 ++------------------ + 3 files changed, 15 insertions(+), 34 deletions(-) + +diff --git a/src/background.js b/src/background.js +index 426a84a..997971a 100644 +--- a/src/background.js ++++ b/src/background.js +@@ -314,16 +314,8 @@ if (assetDir === undefined) { + is_first_run = true + } else { + try { +- if (store.has('settings.ruffleFallback') && store.get('settings.ruffleFallback') === true) { +- logger.info("Ruffle fallback enabled, disabling ppapi-level flash player") +- } else { +- // Pick the appropriate flash plugin for the user's platform +- const flashPath = getFlashPath() +- +- if (fs.existsSync(flashPath)) { +- app.commandLine.appendSwitch('ppapi-flash-path', flashPath) +- } else throw Error(`Flash plugin not located at ${flashPath}`) +- } ++ // MOD: always use ruffle ++ logger.info("Ruffle fallback enabled, disabling ppapi-level flash player") + + if (store.has('settings.smoothScrolling') && store.get('settings.smoothScrolling') === false) + app.commandLine.appendSwitch('disable-smooth-scrolling') +@@ -747,7 +739,10 @@ async function createWindow () { + titleBarStyle: 'hidden', + autoHideMenuBar: true, + webPreferences: { +- nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION, ++ // MOD: disable isolation to get ++ // collection to work with electron 35 ++ nodeIntegration: true, ++ contextIsolation: false, + enableRemoteModule: true, + plugins: true, + webviewTag: true +diff --git a/src/components/SystemPages/Settings.vue b/src/components/SystemPages/Settings.vue +index 47c5ea6..5630625 100644 +--- a/src/components/SystemPages/Settings.vue ++++ b/src/components/SystemPages/Settings.vue +@@ -619,11 +619,13 @@ export default { + label: "Reduce Motion", + desc: "Attempts to reduce the amount of automatic motion in the comic by replacing animated gifs with a manual scrubber, and requiring an explicit click before playing Flash animations.", + platform_whitelist: ['electron'] +- }, { +- model: "ruffleFallback", +- label: "Ruffle flash emulation fallback", +- desc: "If the built-in flash player is non-functional, use the <a href='https://ruffle.rs/'>Ruffle</a> Flash emulator in place of Flash." +- } ++ }, ++ // MOD: always use ruffle ++ // { ++ // model: "ruffleFallback", ++ // label: "Ruffle flash emulation fallback", ++ // desc: "If the built-in flash player is non-functional, use the <a href='https://ruffle.rs/'>Ruffle</a> Flash emulator in place of Flash." ++ // } + ], + retconList: [ + { +diff --git a/src/components/UIElements/MediaEmbed.vue b/src/components/UIElements/MediaEmbed.vue +index 760fec4..53f34ff 100644 +--- a/src/components/UIElements/MediaEmbed.vue ++++ b/src/components/UIElements/MediaEmbed.vue +@@ -156,24 +156,8 @@ export default { + return ret + }, + ruffleEmbed() { +- // At some point between 2025.3.14 and 2025.4.13 ruffle stopped supporting our old runtime. Damn. --> +- if (this.$localData.settings.ruffleFallback) { +- if (this.$isWebApp) { +- return '<script src="https://unpkg.com/@ruffle-rs/ruffle"><\/script>' +- } else { +- // 0.1.0-nightly.2024.04.13 OK +- // ... +- // 0.1.0-nightly.2024.07.19 OK +- // 0.1.0-nightly.2024.07.20 scale issue +- // ... +- // 0.1.0-nightly.2025.04.07 scale issue +- // 0.1.0-nightly.2025.04.13 syntax issue +- // return '<script src="https://unpkg.com/@ruffle-rs/ruffle@0.1.0-nightly.2024.7.19"><\/script>' +- return `<script src="${this.$getResourceURL("assets://js/ruffle/ruffle.js")}"><\/script>` +- } +- } else { +- return '<!-- Using real flash -->' +- } ++ // MOD: always use ruffle ++ return `<script src="${this.$getResourceURL("assets://js/ruffle/ruffle.js")}"><\/script>` + }, + flashSrc() { + return ` +-- +2.50.0 + diff --git a/pkgs/unofficial-homestuck-collection/default.nix b/pkgs/unofficial-homestuck-collection/default.nix index 3096d4d..ec09b2b 100644 --- a/pkgs/unofficial-homestuck-collection/default.nix +++ b/pkgs/unofficial-homestuck-collection/default.nix @@ -6,33 +6,12 @@ fetchurl, fetchYarnDeps, fixup-yarn-lock, - autoPatchelfHook, + replaceVars, writableTmpDirAsHomeHook, - git, - copyDesktopItems, - makeDesktopItem, makeWrapper, nodejs, yarn, - alsa-lib, - at-spi2-atk, - cairo, - cups, - ffmpeg, - flac, - gcc-unwrapped, - glibc, - gtk3, - libgbm, libglvnd, - libpng, - libpulseaudio, - libjpeg, - libxkbcommon, - libxslt, - nspr, - nss, - pango, }: stdenv.mkDerivation (finalAttrs: { pname = "unofficial-homestuck-collection"; @@ -42,12 +21,17 @@ stdenv.mkDerivation (finalAttrs: { owner = "GiovanH"; repo = "unofficial-homestuck-collection"; rev = "v${finalAttrs.version}"; - hash = "sha256-rCeWayu32+Y3JRgqTLe36AcxZT+mXZnEaEAkJbL3iI0="; - leaveDotGit = true; + hash = "sha256-hmGvOsx5OUesXD3Nat00IVDra36IpeFLFklwcMu1UTU="; }; patches = [ - ./0001-fix-source.patch + (replaceVars ./0001-disable-git-rev-check.patch { + git_branch = "'main'"; + git_revision = "'${finalAttrs.src.rev}'"; + git_remote = "'${finalAttrs.src.url}'"; + }) + ./0002-disable-update-check.patch + ./0003-make-compatible-with-native-electron.patch ]; offlineCache = fetchYarnDeps { @@ -55,42 +39,14 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-mo5Ir/pLoqc6K/0AOJqKC0yup7vx9UrNfQ+casIgBCo="; }; - phantomJS = fetchurl { - url = "https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2"; - hash = "sha256-ht2aS/Su5F8ahMn2HPGUfB1tzpuejSqQcQXaeFJGDS8="; - }; - nativeBuildInputs = [ - autoPatchelfHook - copyDesktopItems fixup-yarn-lock - git makeWrapper nodejs writableTmpDirAsHomeHook yarn ]; - buildInputs = [ - alsa-lib - at-spi2-atk - cairo - cups - flac - gtk3 - libgbm - libpng - libpulseaudio - libjpeg - libxkbcommon - libxslt - nspr - nss - pango - ]; - - env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; - configurePhase = '' runHook preConfigure @@ -102,9 +58,8 @@ stdenv.mkDerivation (finalAttrs: { patchShebangs node_modules # fixup node_modules - cp $phantomJS node_modules/phantomjs-prebuilt/phantomjs.tar.bz2 - patch node_modules/phantomjs-prebuilt/install.js ${./phantomjs.patch} - touch node_modules/electron/path.txt + echo > node_modules/phantomjs-prebuilt/install.js + echo > node_modules/electron/index.js runHook postConfigure ''; @@ -112,15 +67,11 @@ stdenv.mkDerivation (finalAttrs: { buildPhase = '' runHook preBuild - pushd node_modules/phantomjs-prebuilt - node install.js - popd - make src/imods.tar.gz make src/js/crc_imods.json env NODE_OPTIONS=--max_old_space_size=8192 \ yarn run vue-cli-service electron:build \ - --linux --dir \ + --dir \ -c.electronDist=${electron.dist} \ -c.electronVersion=${electron.version} \ --config ${./electron-builder.yml} @@ -131,53 +82,37 @@ stdenv.mkDerivation (finalAttrs: { installPhase = '' runHook preInstall - install -Dm644 build/icons/16x16.png $out/share/icons/hicolor/16x16/apps/unofficial-homestuck-collection.png - install -Dm644 build/icons/24x24.png $out/share/icons/hicolor/24x24/apps/unofficial-homestuck-collection.png - install -Dm644 build/icons/32x32.png $out/share/icons/hicolor/32x32/apps/unofficial-homestuck-collection.png - install -Dm644 build/icons/48x48.png $out/share/icons/hicolor/48x48/apps/unofficial-homestuck-collection.png - install -Dm644 build/icons/64x64.png $out/share/icons/hicolor/64x64/apps/unofficial-homestuck-collection.png - install -Dm644 build/icons/128x128.png $out/share/icons/hicolor/128x128/apps/unofficial-homestuck-collection.png - install -Dm644 build/icons/256x256.png $out/share/icons/hicolor/256x256/apps/unofficial-homestuck-collection.png - install -Dm644 build/icons/512x512.png $out/share/icons/hicolor/512x512/apps/unofficial-homestuck-collection.png - install -Dm644 build/icons/1024x1024.png $out/share/icons/hicolor/1024x1024/apps/unofficial-homestuck-collection.png - - mkdir -p $out/share/unofficial-homestuck-collection $out/bin - cp -r dist_electron/linux-unpacked/* $out/share/unofficial-homestuck-collection - makeWrapper $out/share/unofficial-homestuck-collection/unofficial-homestuck-collection $out/bin/unofficial-homestuck-collection \ + for i in 16x16 24x24 48x48 64x64 128x128 256x256 512x512; do + install -Dm644 build/icons/$i.png $out/share/icons/hicolor/$i/apps/dev.bambosh.UnofficialHomestuckCollection.png + done + install -Dm644 build/dev.bambosh.UnofficialHomestuckCollection.metainfo.xml $out/share/metainfo/dev.bambosh.UnofficialHomestuckCollection.metainfo.xml + install -Dm644 build/dev.bambosh.UnofficialHomestuckCollection.desktop $out/share/applications/dev.bambosh.UnofficialHomestuckCollection.desktop + install -d $out/bin $out/share/unofficial-homestuck-collection + cp -r dist_electron/*-unpacked/{locales,resources{,.pak}} $out/share/unofficial-homestuck-collection + makeWrapper ${lib.getExe electron} $out/bin/unofficial-homestuck-collection \ + --add-flags $out/share/unofficial-homestuck-collection/resources/app.asar \ + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \ + --add-flags --no-sandbox \ --set LD_LIBRARY_PATH "${ - lib.makeLibraryPath [ - glibc - gcc-unwrapped.lib - libglvnd - ] - }" \ - --add-flags --no-sandbox + lib.makeLibraryPath [ + libglvnd + ] + }" \ + --inherit-argv0 runHook postInstall ''; - desktopItems = [ - (makeDesktopItem { - name = "unofficial-homestuck-collection"; - exec = "unofficial-homestuck-collection"; - icon = "unofficial-homestuck-collection"; - desktopName = "unofficial-homestuck-collection"; - categories = ["Game"]; - mimeTypes = ["x-scheme-handler/mspa"]; - }) - ]; - meta = { description = "Offline collection of Homestuck and its related works"; homepage = "https://homestuck.giovanh.com/unofficial-homestuck-collection/"; changelog = "https://github.com/GiovanH/unofficial-homestuck-collection/releases/tag/v${finalAttrs.version}"; - license = lib.licenses.gpl3; + license = lib.licenses.gpl3Plus; maintainers = with lib.maintainers; [ kenshineto ]; mainProgram = "unofficial-homestuck-collection"; - # phantomjs does not support aarch64 :( # TODO: kenshineto: macos support, i dont own a mac - platforms = ["x86_64-linux"]; + platforms = lib.platforms.linux; }; }) diff --git a/pkgs/unofficial-homestuck-collection/phantomjs.patch b/pkgs/unofficial-homestuck-collection/phantomjs.patch deleted file mode 100644 index e59a89a..0000000 --- a/pkgs/unofficial-homestuck-collection/phantomjs.patch +++ /dev/null @@ -1,36 +0,0 @@ -406,416c406 -< if (!downloadSpec) { -< console.error( -< 'Unexpected platform or architecture: ' + getTargetPlatform() + '/' + getTargetArch() + '\n' + -< 'It seems there is no binary available for your platform/architecture\n' + -< 'Try to install PhantomJS globally') -< exit(1) -< } -< -< var downloadUrl = downloadSpec.url -< var downloadedFile -< ---- -> var downloadedFile = "phantomjs.tar.bz2" -418,436c408 -< // Can't use a global version so start a download. -< var tmpPath = findSuitableTempDirectory() -< var fileName = downloadUrl.split('/').pop() -< downloadedFile = path.join(tmpPath, fileName) -< -< if (fs.existsSync(downloadedFile)) { -< console.log('Download already available at', downloadedFile) -< return verifyChecksum(downloadedFile, downloadSpec.checksum) -< } -< return false -< }).then(function (verified) { -< if (verified) { -< return downloadedFile -< } -< -< // Start the install. -< console.log('Downloading', downloadUrl) -< console.log('Saving to', downloadedFile) -< return requestBinary(getRequestOptions(), downloadedFile) ---- -> return downloadedFile |