diff options
| author | Jules Laplace <jules@okfoc.us> | 2016-09-06 11:51:27 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2016-09-06 11:51:27 -0400 |
| commit | 636866c735a1b480625ad38029e54ec932e28fb1 (patch) | |
| tree | 47d46845224bcb78332bc9134c4f4f2fac9dd866 | |
| parent | 09542dc95dd51699dd91bee8cd364a45d7e64eaf (diff) | |
use /admin/_lib for libraries for custom cms
| -rw-r--r-- | app/index.js | 6 | ||||
| -rw-r--r-- | app/node_modules/okserver/index.js | 8 | ||||
| -rw-r--r-- | themes/okadmin/public/js/upload.js | 6 |
3 files changed, 19 insertions, 1 deletions
diff --git a/app/index.js b/app/index.js index c0d2ff3..57d571c 100644 --- a/app/index.js +++ b/app/index.js @@ -45,6 +45,10 @@ function OKCMS(options) { var adminPath = this._adminPath = adminConfig.path || '/admin'; var adminRoot = this._adminRoot = adminConfig.root || path.join(__dirname, '../themes/okadmin/public'); + var adminLibPath = this._adminLibPath = adminConfig.libPath || + path.join(adminPath, "_lib"); + var adminLibRoot = this._adminLibRoot = adminConfig.libRoot || + path.join(__dirname, '../themes/okadmin/public'); var adminTemplateRoot = adminConfig.templateRoot || path.join(__dirname, '../themes/okadmin/templates'); @@ -137,6 +141,8 @@ function OKCMS(options) { root: root, adminRoot: adminRoot, adminPath: adminPath, + adminLibRoot: adminLibRoot, + adminLibPath: adminLibPath, services: services, errorHandler: errorHandler }); diff --git a/app/node_modules/okserver/index.js b/app/node_modules/okserver/index.js index a89676f..c8877f9 100644 --- a/app/node_modules/okserver/index.js +++ b/app/node_modules/okserver/index.js @@ -16,11 +16,17 @@ function OKServer(options) { throw new Error('No admin root directory provided to OKServer'); if (!options.adminPath) throw new Error('No admin path provided to OKServer'); + if (!options.adminLibRoot) + throw new Error('No admin library root directory provided to OKServer'); + if (!options.adminLibPath) + throw new Error('No admin library path provided to OKServer'); if (!options.errorHandler) throw new Error('No error handler provided to OKServer'); var root = options.root; var adminRoot = options.adminRoot; var adminPath = options.adminPath; + var adminLibRoot = options.adminLibRoot; + var adminLibPath = options.adminLibPath; var views = options.views; var express = options.express; var app = this._app = options.app; @@ -58,6 +64,8 @@ function OKServer(options) { app.use(express.static(root)); // Serve admin interface static files app.use(adminPath, express.static(adminRoot)); + // Serve admin interface library files for use with custom backend + app.use(adminLibPath, express.static(adminLibRoot)); // Application router app.use(router); // Add services diff --git a/themes/okadmin/public/js/upload.js b/themes/okadmin/public/js/upload.js index 6ff7ac9..18fad26 100644 --- a/themes/okadmin/public/js/upload.js +++ b/themes/okadmin/public/js/upload.js @@ -1,6 +1,10 @@ var OKUpload = function(){ - this.config = $("#uploadConfig").data() + this.config = $("#uploadConfig").data() || { + imageMaxbytes: 10 * 1024 * 1024, + audioMaxbytes: 10 * 1024 * 1024, + videoMaxbytes: 10 * 1024 * 1024, + } this.imageAction = "/_services/s3/image" this.videoAction = "/_services/s3/video" this.audioAction = "/_services/s3/audio" |
