Loading pkgs/by-name/rs/rsshub/0001-fix-git-hash.patch +5 −5 Original line number Diff line number Diff line Loading @@ -8,11 +8,11 @@ Subject: [PATCH] fix git hash 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/utils/git-hash.ts b/lib/utils/git-hash.ts index 9a8131696..f1f568fb4 100644 index 458651a..795bb88 100644 --- a/lib/utils/git-hash.ts +++ b/lib/utils/git-hash.ts @@ -1,14 +1,6 @@ import { execSync } from 'child_process'; import { execSync } from 'node:child_process'; -let gitHash = process.env.HEROKU_SLUG_COMMIT?.slice(0, 8) || process.env.VERCEL_GIT_COMMIT_SHA?.slice(0, 8); -let gitDate: Date | undefined; Loading @@ -27,4 +27,4 @@ index 9a8131696..f1f568fb4 100644 +let gitHash = '@GIT_HASH@'.slice(0, 8); +let gitDate = new Date('Thu Jan 1 00:00:00 1970 +0000'); export { gitHash, gitDate }; export { gitDate, gitHash }; pkgs/by-name/rs/rsshub/0002-fix-network-call.patch +29 −43 Original line number Diff line number Diff line diff --git a/scripts/workflow/build-routes.ts b/scripts/workflow/build-routes.ts index 1bbb64cc5..941d86149 100644 --- a/scripts/workflow/build-routes.ts +++ b/scripts/workflow/build-routes.ts @@ -1,5 +1,6 @@ import fs from 'node:fs'; import path from 'node:path'; +import { exit } from 'node:process'; From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: RSSHub Nix packagers Date: Mon, 10 Mar 2026 00:00:00 +0000 Subject: [PATCH] support BUILD_ROUTES_MODE for offline builds import { parse } from 'tldts'; import toSource from 'tosource'; @@ -11,17 +12,7 @@ import { getCurrentPath } from '../../lib/utils/helpers'; Add BUILD_ROUTES_MODE environment variable support to lib/registry.ts so that route metadata can be built using directoryImport without executing module-level code that would trigger network requests. This is required for building in the Nix sandbox (no network access). const __dirname = getCurrentPath(import.meta.url); --- lib/registry.ts | 5 +++++ 1 file changed, 5 insertions(+) -const foloAnalysis = await ( - await fetch('https://raw.githubusercontent.com/RSSNext/rsshub-docs/refs/heads/main/rsshub-analytics.json', { - headers: { - 'user-agent': config.trueUA, - }, - }) -).json(); -const foloAnalysisResult = foloAnalysis.data as Record<string, { subscriptionCount: number; topFeeds: any[] }>; -const foloAnalysisTop100 = Object.entries(foloAnalysisResult) - .sort((a, b) => b[1].subscriptionCount - a[1].subscriptionCount) - .slice(0, 150); +const foloAnalysisTop100: any[] = []; diff --git a/lib/registry.ts b/lib/registry.ts --- a/lib/registry.ts +++ b/lib/registry.ts @@ -56,7 +56,12 @@ const maintainers: Record<string, string[]> = {}; const radar: { @@ -100,7 +91,7 @@ const uniquePaths = [...allRoutePaths].toSorted(); const routePathsType = `// This file is auto-generated by scripts/workflow/build-routes.ts // Do not edit manually let namespaces: NamespacesType = {}; -export type RoutePath = +export type RoutePath = ${uniquePaths.map((path) => ` | \`${path}\``).join('\n')}; `; @@ -110,3 +101,5 @@ fs.writeFileSync(path.join(__dirname, '../../assets/build/maintainers.json'), JS fs.writeFileSync(path.join(__dirname, '../../assets/build/routes.json'), JSON.stringify(namespaces, null, 2)); fs.writeFileSync(path.join(__dirname, '../../assets/build/routes.js'), `export default ${JSON.stringify(namespaces, null, 2)}`.replaceAll(/"module": "(.*)"\n/g, `"module": $1\n`)); fs.writeFileSync(path.join(__dirname, '../../assets/build/route-paths.ts'), routePathsType); + +exit(0); -if (config.isPackage) { +if (process.env.BUILD_ROUTES_MODE) { + modules = directoryImport({ + targetDirectoryPath: path.join(__dirname, './routes'), + importPattern: /\.tsx?$/, + }) as typeof modules; +} else if (config.isPackage) { namespaces = (await import('../assets/build/routes.js')).default; } else { switch (process.env.NODE_ENV || process.env.VERCEL_ENV) { pkgs/by-name/rs/rsshub/package.nix +16 −14 Original line number Diff line number Diff line Loading @@ -2,49 +2,53 @@ lib, fetchFromGitHub, makeBinaryWrapper, nix-update-script, nodejs, pnpm_9, pnpm_10, fetchPnpmDeps, pnpmConfigHook, replaceVars, stdenv, nix-update-script, }: stdenv.mkDerivation (finalAttrs: { pname = "rsshub"; version = "0-unstable-2025-11-28"; version = "0-unstable-2026-03-08"; src = fetchFromGitHub { owner = "DIYgod"; repo = "RSSHub"; rev = "b6dbafe33e0c3e3a4ba5a1edd2da29b70412389f"; hash = "sha256-FsevO2nb6leuuRmzCLIy093FCafl3Y/CsSp1ydJOnKY="; rev = "1ad606f40f512f24ec76462299c46066e495603f"; hash = "sha256-hHCId59SazbR96fwAlY3De2hH5woklpALXGf9OzyY3A="; }; patches = [ (replaceVars ./0001-fix-git-hash.patch { "GIT_HASH" = finalAttrs.src.rev; GIT_HASH = finalAttrs.src.rev; }) ./0002-fix-network-call.patch ]; pnpmDeps = fetchPnpmDeps { inherit (finalAttrs) pname version src; pnpm = pnpm_9; fetcherVersion = 3; hash = "sha256-jV+MpdNeaVHut0eUP7F9SmJZuLDGQE8ULR8LsiOE7Ug="; hash = "sha256-aJNc6gY6/OZZp577ZhblRIPBCFXV0rE7w8SbwslQM0k="; pnpm = pnpm_10; }; nativeBuildInputs = [ makeBinaryWrapper nodejs pnpmConfigHook pnpm_9 pnpm_10 ]; buildPhase = '' runHook preBuild pnpm build # First build route metadata using directoryImport (avoids executing # module-level code that would trigger network requests) BUILD_ROUTES_MODE=1 pnpm run build:routes # Then build the application pnpm run build runHook postBuild ''; Loading @@ -58,11 +62,9 @@ stdenv.mkDerivation (finalAttrs: { preFixup = '' makeWrapper ${lib.getExe nodejs} $out/bin/rsshub \ --chdir "$out/lib/rsshub" \ --set "NODE_ENV" "production" \ --set "NO_LOGFILES" "true" \ --set "TSX_TSCONFIG_PATH" "$out/lib/rsshub/tsconfig.json" \ --append-flags "$out/lib/rsshub/dist/index.mjs" --add-flags "$out/lib/rsshub/dist/index.mjs" ''; passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch=master" ]; }; Loading @@ -78,7 +80,7 @@ stdenv.mkDerivation (finalAttrs: { new features and bug fixes. ''; homepage = "https://docs.rsshub.app"; license = lib.licenses.mit; license = lib.licenses.agpl3Only; maintainers = with lib.maintainers; [ xinyangli ]; mainProgram = "rsshub"; platforms = lib.platforms.all; Loading Loading
pkgs/by-name/rs/rsshub/0001-fix-git-hash.patch +5 −5 Original line number Diff line number Diff line Loading @@ -8,11 +8,11 @@ Subject: [PATCH] fix git hash 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/utils/git-hash.ts b/lib/utils/git-hash.ts index 9a8131696..f1f568fb4 100644 index 458651a..795bb88 100644 --- a/lib/utils/git-hash.ts +++ b/lib/utils/git-hash.ts @@ -1,14 +1,6 @@ import { execSync } from 'child_process'; import { execSync } from 'node:child_process'; -let gitHash = process.env.HEROKU_SLUG_COMMIT?.slice(0, 8) || process.env.VERCEL_GIT_COMMIT_SHA?.slice(0, 8); -let gitDate: Date | undefined; Loading @@ -27,4 +27,4 @@ index 9a8131696..f1f568fb4 100644 +let gitHash = '@GIT_HASH@'.slice(0, 8); +let gitDate = new Date('Thu Jan 1 00:00:00 1970 +0000'); export { gitHash, gitDate }; export { gitDate, gitHash };
pkgs/by-name/rs/rsshub/0002-fix-network-call.patch +29 −43 Original line number Diff line number Diff line diff --git a/scripts/workflow/build-routes.ts b/scripts/workflow/build-routes.ts index 1bbb64cc5..941d86149 100644 --- a/scripts/workflow/build-routes.ts +++ b/scripts/workflow/build-routes.ts @@ -1,5 +1,6 @@ import fs from 'node:fs'; import path from 'node:path'; +import { exit } from 'node:process'; From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: RSSHub Nix packagers Date: Mon, 10 Mar 2026 00:00:00 +0000 Subject: [PATCH] support BUILD_ROUTES_MODE for offline builds import { parse } from 'tldts'; import toSource from 'tosource'; @@ -11,17 +12,7 @@ import { getCurrentPath } from '../../lib/utils/helpers'; Add BUILD_ROUTES_MODE environment variable support to lib/registry.ts so that route metadata can be built using directoryImport without executing module-level code that would trigger network requests. This is required for building in the Nix sandbox (no network access). const __dirname = getCurrentPath(import.meta.url); --- lib/registry.ts | 5 +++++ 1 file changed, 5 insertions(+) -const foloAnalysis = await ( - await fetch('https://raw.githubusercontent.com/RSSNext/rsshub-docs/refs/heads/main/rsshub-analytics.json', { - headers: { - 'user-agent': config.trueUA, - }, - }) -).json(); -const foloAnalysisResult = foloAnalysis.data as Record<string, { subscriptionCount: number; topFeeds: any[] }>; -const foloAnalysisTop100 = Object.entries(foloAnalysisResult) - .sort((a, b) => b[1].subscriptionCount - a[1].subscriptionCount) - .slice(0, 150); +const foloAnalysisTop100: any[] = []; diff --git a/lib/registry.ts b/lib/registry.ts --- a/lib/registry.ts +++ b/lib/registry.ts @@ -56,7 +56,12 @@ const maintainers: Record<string, string[]> = {}; const radar: { @@ -100,7 +91,7 @@ const uniquePaths = [...allRoutePaths].toSorted(); const routePathsType = `// This file is auto-generated by scripts/workflow/build-routes.ts // Do not edit manually let namespaces: NamespacesType = {}; -export type RoutePath = +export type RoutePath = ${uniquePaths.map((path) => ` | \`${path}\``).join('\n')}; `; @@ -110,3 +101,5 @@ fs.writeFileSync(path.join(__dirname, '../../assets/build/maintainers.json'), JS fs.writeFileSync(path.join(__dirname, '../../assets/build/routes.json'), JSON.stringify(namespaces, null, 2)); fs.writeFileSync(path.join(__dirname, '../../assets/build/routes.js'), `export default ${JSON.stringify(namespaces, null, 2)}`.replaceAll(/"module": "(.*)"\n/g, `"module": $1\n`)); fs.writeFileSync(path.join(__dirname, '../../assets/build/route-paths.ts'), routePathsType); + +exit(0); -if (config.isPackage) { +if (process.env.BUILD_ROUTES_MODE) { + modules = directoryImport({ + targetDirectoryPath: path.join(__dirname, './routes'), + importPattern: /\.tsx?$/, + }) as typeof modules; +} else if (config.isPackage) { namespaces = (await import('../assets/build/routes.js')).default; } else { switch (process.env.NODE_ENV || process.env.VERCEL_ENV) {
pkgs/by-name/rs/rsshub/package.nix +16 −14 Original line number Diff line number Diff line Loading @@ -2,49 +2,53 @@ lib, fetchFromGitHub, makeBinaryWrapper, nix-update-script, nodejs, pnpm_9, pnpm_10, fetchPnpmDeps, pnpmConfigHook, replaceVars, stdenv, nix-update-script, }: stdenv.mkDerivation (finalAttrs: { pname = "rsshub"; version = "0-unstable-2025-11-28"; version = "0-unstable-2026-03-08"; src = fetchFromGitHub { owner = "DIYgod"; repo = "RSSHub"; rev = "b6dbafe33e0c3e3a4ba5a1edd2da29b70412389f"; hash = "sha256-FsevO2nb6leuuRmzCLIy093FCafl3Y/CsSp1ydJOnKY="; rev = "1ad606f40f512f24ec76462299c46066e495603f"; hash = "sha256-hHCId59SazbR96fwAlY3De2hH5woklpALXGf9OzyY3A="; }; patches = [ (replaceVars ./0001-fix-git-hash.patch { "GIT_HASH" = finalAttrs.src.rev; GIT_HASH = finalAttrs.src.rev; }) ./0002-fix-network-call.patch ]; pnpmDeps = fetchPnpmDeps { inherit (finalAttrs) pname version src; pnpm = pnpm_9; fetcherVersion = 3; hash = "sha256-jV+MpdNeaVHut0eUP7F9SmJZuLDGQE8ULR8LsiOE7Ug="; hash = "sha256-aJNc6gY6/OZZp577ZhblRIPBCFXV0rE7w8SbwslQM0k="; pnpm = pnpm_10; }; nativeBuildInputs = [ makeBinaryWrapper nodejs pnpmConfigHook pnpm_9 pnpm_10 ]; buildPhase = '' runHook preBuild pnpm build # First build route metadata using directoryImport (avoids executing # module-level code that would trigger network requests) BUILD_ROUTES_MODE=1 pnpm run build:routes # Then build the application pnpm run build runHook postBuild ''; Loading @@ -58,11 +62,9 @@ stdenv.mkDerivation (finalAttrs: { preFixup = '' makeWrapper ${lib.getExe nodejs} $out/bin/rsshub \ --chdir "$out/lib/rsshub" \ --set "NODE_ENV" "production" \ --set "NO_LOGFILES" "true" \ --set "TSX_TSCONFIG_PATH" "$out/lib/rsshub/tsconfig.json" \ --append-flags "$out/lib/rsshub/dist/index.mjs" --add-flags "$out/lib/rsshub/dist/index.mjs" ''; passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch=master" ]; }; Loading @@ -78,7 +80,7 @@ stdenv.mkDerivation (finalAttrs: { new features and bug fixes. ''; homepage = "https://docs.rsshub.app"; license = lib.licenses.mit; license = lib.licenses.agpl3Only; maintainers = with lib.maintainers; [ xinyangli ]; mainProgram = "rsshub"; platforms = lib.platforms.all; Loading