server: use "/usr/share/flood/assets" as a location of assets

This commit is contained in:
Jesse Chan
2021-01-19 10:34:12 +08:00
parent c279760160
commit f3ebdece95
+11 -5
View File
@@ -19,14 +19,20 @@ const ensureSlash = (questionablePath, needsSlash) => {
const getAppDist = () => { const getAppDist = () => {
// In production, assets are in assets/. // In production, assets are in assets/.
const appDist = path.resolve(path.join(__dirname, 'assets')); let appDist = path.resolve(path.join(__dirname, 'assets'));
if (!fs.existsSync(appDist)) { if (!fs.existsSync(appDist)) {
// In development, assets are in ${appDirectory}/dist/assets/. // In development, assets are in ${appDirectory}/dist/assets/.
const appBuild = resolveApp('dist/assets'); appDist = resolveApp('dist/assets');
if (fs.existsSync(appBuild)) {
return appBuild;
}
} }
if (!fs.existsSync(appDist)) {
// Assets are placed to /usr when Flood is managed by package
// managers other than npm. This allows users to serve static
// assets from web server directly if they want.
appDist = path.resolve('/usr/share/flood/assets');
}
return appDist; return appDist;
}; };