forked from TryGhost/Ghost
-
Notifications
You must be signed in to change notification settings - Fork 1
Ghost.js audit
Hannah Wolfe edited this page Aug 30, 2013
·
16 revisions
- access to express through
app()
-
.doFilter()
for nav items in locals -
.notifications
passed to locals, used in auth middleware & cleanNti -
.settings()
- settings to be passed to the client or theme through locals .paths()
-
.initTheme()
- the only place this is called.. it really should never have been in ghost.js .init()
.config().env
- .dbHash - used as secret for sessions to invalidate on new db
-
ghost
is passed to loadCoreFilters, loadCoreHelpers and initTheme and I18n.load
Thoughts on index.js usage of ghost:
-
.app()
was a stupid idea and needs to go away - inits and loads probably belong together / can be simplified
-
initTheme
being in ghost.js is wrong -
.settings()
,.config()
,.paths()
,.dbHash
are all 'global' properties - we should have one clear way to read them - see #573 -
.notifications
hould probably be their own model, but stored in memory rather than bookshelf -
doFilter
is part of the plugin/theme API and should be a separate thing -
ghost
shouldn't be passed around
-
.dataProvider
to get access to models (should just include models?) .notifications
.settings()
.updateSettingsCache()
Thoughts on index.js usage of ghost:
-
dataProvider
shouldn't be needed at all anymore I don't think? -
notifications
should probably be their own model, but stored in memory rather than bookshelf - settings/settingsCache/cachedSettingsRequestHandler should all be moved back onto the model itself along with stuff to deal with the ideas here: #567
-
.dataProvider
to get access to models (should just include api) -
.notifications
- push, and length neither of which should be necessary
Thoughts on admin.js usage of ghost:
- both of these should be fairly simple to get rid of
-
.doFilter()
for filtering posts before they reach the frontend .settings()
Thoughts on frontend.js usage of ghost:
-
.doFilter()
should be part of a separate plugin/theme api thing -
.settings()
also needs to become it's own thing somewhere
.paths()
- passed to
plugin.activate()
andplugin.install()
which is purely for API access
Thoughts on plugins/loader.js usage of ghost:
- This is one of the more awkward bits of code around the ghost object, mainly because of the duplicity between obtaining useful state (paths) and the API (should be separated)
- It should be WAY easier to get hold of the set of paths
- The object passed to the plugin should be a theme/plugin API only
- This one's ok, need access to ghost to test it! Buuut the tests are pretty poor and only cover a fraction of certain bits of stuff that are in
ghost.js
- requires
ghost
to pass tohelpers.loadCoreHelpers
** Dependency Graphs **
Dependo: https://dl.dropboxusercontent.com/u/531857/dependo_report3.html