From f6c6c5b75c70aeff74b34574a789c881b9452adc Mon Sep 17 00:00:00 2001 From: Bryan Richter Date: Tue, 26 Nov 2024 13:42:14 +0200 Subject: [PATCH] Restore old URLs to uploaded files Fixes #48 --- flake.nix | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 1584205..a4f0ba6 100644 --- a/flake.nix +++ b/flake.nix @@ -54,7 +54,11 @@ }; }; - config = { config, pkgs, lib, ... }: { + config = { config, pkgs, lib, ... }: + let + # Shared between wikimedia config and nginx config + uploadPath = "/wikiupload"; + in { system.stateVersion = "24.05"; networking.useDHCP = false; @@ -115,6 +119,12 @@ # The createaccount group, for users who can always create accounts $wgAvailableRights[] = 'createaccount'; $wgGroupPermissions['createaccount']['createaccount'] = true; + + + ## Uploads + + # This is used to render URLs to uploaded files. + $wgUploadPath = '${uploadPath}'; ''; extensions = { @@ -185,9 +195,9 @@ fastcgi_index index.php; fastcgi_pass unix:${config.services.phpfpm.pools.mediawiki.socket}; ''; - "/images/".alias = withTrailingSlash config.services.mediawiki.uploadsDir; + "${uploadPath}/".alias = withTrailingSlash config.services.mediawiki.uploadsDir; # Deny access to deleted images folder - "/images/deleted".extraConfig = '' + "${uploadPath}/deleted".extraConfig = '' deny all; ''; # MediaWiki assets (usually images)