mirror of
https://github.com/zoriya/flood.git
synced 2026-06-03 19:21:48 +00:00
server: use "/usr/share/flood/assets" as a location of assets
This commit is contained in:
+11
-5
@@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user