tamland / airsonic-refix

Modern web UI for Subsonic compatible servers
GNU Affero General Public License v3.0
304 stars 48 forks source link

Use relative URLs #51

Open gjedeer opened 3 years ago

gjedeer commented 3 years ago

The scripts aren't loaded if I install it in a subdirectory. Please either remove the "/" from JS/CSS paths in index.html or add <base href>

gjedeer commented 3 years ago

I just executed the following in the docker container and visiting index2.html works okay and plays music - even though the code is in a subdirectory.

/var/www/html # sed -e 's#"/#"#g' <index.html >index2.html

The resulting index2.html file is:

<!DOCTYPE html><html lang="en"><head data-build="80a2f4b186594fb156a3e69906554ddc54e03930"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; connect-src *; img-src *; media-src *; manifest-src 'self'; style-src 'self' 'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=' 'sha256-624gmqlO23N0g1Ru4tkjuaPEoL/hXP4w7tUqel4WM98=' 'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=' 'sha256-5uOIRR03mYcVoiexgzGGALQ0p1Babe2XxbeIl9t1UpA=' 'sha256-lM8P08IzH0mbT5Tvlm1F5BY3h0gPsb0qNpnZW9YHc7A='; script-src 'self'; base-uri 'self';"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000"><link rel="icon" href="icon.svg"><link rel="manifest" href="manifest.webmanifest"><script src="env.js"></script><title>Airsonic (refix)</title><link href="css/app.193c0949.css" rel="preload" as="style"><link href="css/chunk-vendors.66cdc8be.css" rel="preload" as="style"><link href="js/app.ac9269bb.js" rel="preload" as="script"><link href="js/chunk-vendors.7e50d4ad.js" rel="preload" as="script"><link href="css/chunk-vendors.66cdc8be.css" rel="stylesheet"><link href="css/app.193c0949.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but this application doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.7e50d4ad.js"></script><script src="js/app.ac9269bb.js"></script></body></html>
gjedeer commented 3 years ago

It looks like the pseudo-URLs generated with the History API would need some adjustment too, as they're generated in a root directory of the server.

tamland commented 3 years ago

You will need to build the application with the base path to make this fully work. See https://github.com/tamland/airsonic-refix/discussions/30