Commit Graph

63 Commits

Author SHA1 Message Date
Matt Florence
d1b265be4a Shims for deleted (refactored away) files
closes #1873.
During file system merge upgrades of new releases, old files are not removed and node's require loads the old file instead of all the new ones in the new directory. The files in this commit act as a delegate for all other dependent scripts. These shim files explicitly require the new index.js.
2014-01-09 09:21:09 -06:00
Harry Wolff
89154ad997 Restore support for using ghost as a npm module fixes #1326 2013-11-27 17:39:14 +00:00
Hannah Wolfe
84ce7cc77e Removing error handling using process.stderr
- process.stdin/out/error is problematic, see https://github.com/joyent/node/issues/3584
2013-11-27 16:06:56 +00:00
Tim Griesser
726014f59a bumping to knex 0.5 and bookshelf 0.6.1 2013-11-26 23:10:31 +00:00
Harry Wolff
b920662790 Create the config module, initially used
to standardise getting paths and absolute URLs.  Easy
to extend for other configurations we may need.
2013-11-25 16:35:16 -05:00
Fabian Becker
e210e75e97 Install in sub-directory support.
refs #527
2013-11-24 21:11:34 +00:00
Hannah Wolfe
ab2eb18b86 Temporary fix for config loader
issue #1521

- Reverting some of the refactor towards including Ghost as a module as it prevented Ghost from loading when no config was available.
2013-11-23 17:54:47 +00:00
Harry Wolff
e76d23cb19 Make it possible to require ghost as a module. fixes #1326 2013-11-22 22:59:14 -05:00
Harry Wolff
985a23f446 Move server middleware configuration to related file 2013-11-19 21:05:57 -05:00
Harry Wolff
ea8d12a607 Reduce size of ghost.js by moving related Routing code to their own files 2013-11-19 21:05:09 -05:00
Hannah Wolfe
1c5a811760 Merge pull request #1449 from sebgie/issue#1398
Add schema.js
2013-11-19 11:45:53 -08:00
Sebastian Gierlinger
639c0d0627 Add schema.js
closes #1398
closes #1399
closes #1400
- added schema.js with database version '000'
- refactored migration to use schema.js
- if new table is added to schema.js and databaseVersion is increased, table will be added
- if new table is deleted to schema.js and databaseVersion is increased, table will be deleted
- alter table from issue #1400 is delayed until knex supports column modification
- changed import pre checks to work again (will be refactored separately)
- added basic PostgreSQL support (Attention: not supported/tested)
- changed error handling in server.js
2013-11-18 15:21:15 +01:00
Harry Wolff
688dd363cd Move plugin init code into plugin.js and have it called from server.js 2013-11-12 22:52:31 -05:00
Hannah Wolfe
15da975c06 image upload controller refactor
issue #635

- upload controller shouldn't assume fs
- filesystem module proxies all the fs work
- proxies and exposes middleware for serving images
- creating a date based path and unique filename is a base object util
- unit tests updated
2013-11-11 16:10:57 +00:00
Harry Wolff
901d189bf0 Move middleware functions into middleware module and create associated tests
Note: this only moves middleware functions that have associated tests.
2013-11-07 23:05:51 -05:00
Fabian Becker
0908ecf6b7 Run tests on MySQL and use travis-$DB environments.
refs #921
fixes #1385
2013-11-05 15:01:10 +00:00
Ben Gladwell
69d3a1460d Remove unparam:true from jslint config in Gruntfile.js
issue #1365
- added /*jslint unparam:true*/ to functions where absolutely necessary
- added /*jslint unparam:true*/ to functions in which keeping parameter
  list added clarity to the underlying api, even when those parameters
  are not currently used
- removed unused parameters in a few places
2013-10-31 14:02:34 -04:00
Hannah Wolfe
6a0a453a96 Read activePlugins from settings & improve error handling
issue #769

- activePlugins were being read from settings in two different ways, this has been simplified
- error handling has been improved so that plugins do not crash Ghost
- used full error messaging capabilities to make it easier to recover from errors
2013-10-29 11:27:52 +00:00
Jacob Gable
507174a00b Plugin API Refactor: Filter and Theme Helpers
issue #769

- Refactor doFilter to allow returning a promise from a filter handler
  and to also return a promise itself
- Move the logic out of the registerThemeHelper calls and into their own methods so
  we could test them in isolation.
- Assign the server to the ghost instance so the initPlugins method can
  get access to it.
2013-10-29 11:27:52 +00:00
Sebastian Gierlinger
6505986f6b Move /api to /ghost/api
closes #1249
- changed routes
- changed apiRoots
2013-10-24 14:50:17 +02:00
Fabian Becker
f5d65d7ac4 Only show notifications when logged in.
fixes #943
2013-10-24 08:47:27 +00:00
Sebastian Gierlinger
c558cb7648 Add validation for importer
closes #952
- moved api.js to api/index.js
- added api/db.js for import and export functions
- moved /ghost/debug/db/export to GET /api/v0.1/db
- moved /ghost/debug/db/import to POST /api/v0.1/db
- removed /ghost/debug/db/reset
- added validation for import
- added constraints object to migration
2013-10-23 19:42:55 +01:00
Hannah Wolfe
40ba763f0f Merge pull request #1218 from halfdan/1212-themable-error-pages
Allow themes to provide custom error template.
2013-10-23 08:00:56 -07:00
Fabian Becker
7099091c28 Fix CSRF deprecated warning 2013-10-22 07:33:30 +00:00
Fabian Becker
57bd929d2c Allow themes to provide custom error template.
fixes #1212, #1213
2013-10-21 19:12:22 +00:00
Hannah Wolfe
65dcb17117 Merge branch '0.3.3-wip'
Conflicts:
	core/client/views/blog.js
	core/server/api.js
	core/server/views/default.hbs
	package.json
2013-10-20 10:09:39 +01:00
Sebastian Gierlinger
2ee8f96829 Revert sessions to cookieSessions
no issue
- modified sessions to use cookieSession
- set max-age to 12 hrs
- modified logout to delete cookie completely
2013-10-18 13:24:01 +02:00
Hannah Wolfe
158d237122 Improved error handling
fixes #845

- only returns an error page for get requests, otherwise returns a response
- no more admin menu when not logged in
- no more error message about theme error template
- logWarn is available
2013-10-17 22:49:14 +01:00
Hannah Wolfe
4f8ac2a4fd Current user data update 2013-10-17 21:38:49 +01:00
Sebastian Gierlinger
90176e1f40 Security improvements
no issue
- added CSRF protection
- changed session handling to express.session
- changed session handling to change session id
- added config property useCookieSession
- added file extension check for /ghost/upload
- removed /ghost/debug/db/reset
2013-10-17 15:28:28 +02:00
nason
6a5e399997 Add error handling to redirectToSignup promise
Fixes #1078
- Add an otherwise error callback to the redirectToSignup promise
2013-10-16 08:39:58 -07:00
Hannah Wolfe
119b0ea430 Merge branch '0.3.2-wip'
Conflicts:
	core/client/assets/lib/uploader.js
2013-10-11 20:56:15 +01:00
jamesbloomer
9d114c7fa6 Lock down theme static directory to not serve templates, markdown and text files.
closes #942
- insert custom middleware to check for blacklisted files
- redirect to express.static if file accepted
- if not valid return next() to do nothing
- currently black listing .hbs, .txt, .md and .json
- debatable which is best, black list or white list, either one will probably need tweaks but erred on side of letting
a theme serve unknown types
2013-10-11 18:05:31 +01:00
Hannah Wolfe
9466a9753b Merge branch '0.3.2-wip'
Conflicts:
	core/test/unit/api_posts_spec.js
2013-10-10 16:37:35 +01:00
Patrick Garman
97f592aa41 Allow Ghost to run using sockets
Closes #887
- Adds getSocket function > Returns the socket location if sockets are enabled or false
- Adds startGhost function > Callback for server.listen
2013-10-10 16:12:28 +01:00
Tim Griesser
ccd7b211f2 adding when/monitor/console 2013-10-07 09:28:53 -04:00
Sebastian Gierlinger
59b57b84e0 Fix partials in themes
closes #884
- changed init sequence of ghost and helpers
2013-09-26 22:30:45 +02:00
John O'Nolan
d1957958e3 Cleanup indentation and quotes
Aligns all requirements vertically for easier reading + adds single quote standard consistently throughout Ghost, except in long strings.
2013-09-26 15:06:31 +01:00
Hannah Wolfe
0b87c42e84 Merge pull request #891 from ErisDS/0.3.1-importerfix
0.3.1 Import & Export fixes
2013-09-26 04:14:56 -07:00
John O'Nolan
78775f1976 Added email to username if no name is given
Gets rid of generic "Ghost" - we know a user will always have an email address as it is a required field.
2013-09-26 12:02:48 +01:00
John O'Nolan
bf5ab32fe9 Renamed user image data helper to make more sense 2013-09-26 12:02:44 +01:00
jamesbloomer
6941b73168 Fix admin redirect issue
closes #850
- the aliases for the ghost admin link were causing redirects of the
form /ghost//admin etc.
- simplest solution is to split the route into two with the first one
just redirecting and the second doing the auth
2013-09-26 10:46:45 +01:00
Hannah Wolfe
4b5cfbde2e Adding missing multipart to importer route
closes #869
2013-09-25 09:36:45 +01:00
Hannah Wolfe
477c4c59fa Merge pull request #843 from cgiffard/500-errors
500 Series Error Handling & Stack Traces
2013-09-18 22:52:52 -07:00
Christopher Giffard
9c8b02949a 500 Series Error Handling & Stack Traces
Fixes #825

- Changes the way the error middleware is delivered in server.js, moving
  all the logic back into errorHandling.js
- Alters error logging to use console.error (probably more appropriate) instead
  of console.log
- Changes error tests to accomodate for these alterations
- Alters user-error and error hbs templates to incorporate stack traces
- Adds additional styling for error pages to accomodate stack traces
- Added logic to parse and deliver formatted stack traces

Notes:
======

- Jslint gets in the way of the regex I've got to use to parse the stack.
  (It cites 'security reasons' which are not relevant in this case.)
  I needed to add a condition to relax it at the top of errorHandling.js
- The stack trace should probably be added as a partial, but I figured it
  was out of scope for this PR.
2013-09-19 13:01:20 +10:00
William Dibbern
2417de8141 Removed global registration of express.bodyParser
Fixes #824

- Removed global registration of `express.bodyParser` middleware.
- Replaced with `express.bodyParser`'s constituents: `express.json` and
`express.urlencoded`, then registered `express.multipart` against *only*
the upload route.
2013-09-18 18:30:31 -05:00
Hannah Wolfe
65e00f8418 Move favicon further up the middleware stack 2013-09-18 04:35:08 +01:00
cobbspur
6a5f88ed18 Added meta title and description theme helpers
closes #795

- firstly fixes res.locals to include path again
- adds {{media_title}} and {{media_description}} theme helpers
2013-09-17 22:11:02 +01:00
Christopher Giffard
48b75fa396 Initial 404 Error Handling Support
Fixes #356

- Adds new generic methods for handling errors to errorHandling.js
- Initialises generic methods as middleware
- Created error.hbs view in admin
- Error handler searches for error.hbs view file in user theme folder
  and renders it if available, otherwise lets the error fall through
  to express.

- We *could* change the final behaviour to render a default ghost
  template should the user template be missing
- Because it currently isn't possible to require(ghost) in errorHandling.js,
  it was necessary to duplicate some aspects of the ghost path init code
  inside errorhandling.js. This should be cleaned up and moved back
  into ghost.js when possible.
2013-09-17 20:56:05 +10:00
Hannah Wolfe
ce57b46358 More trailing slashes 2013-09-17 02:52:29 +01:00