2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00
Commit graph

640 commits

Author SHA1 Message Date
Sebastian Gierlinger
b1c35a9b6c Fix importer adds the same tags to every post
fixes #2234
- updateTags used tags that were overwritten by an async operation
2014-02-21 22:54:56 +01:00
Kyle Nunery
89cd1a3640 Updated pageUrl helper to page_url
issue #2216
2014-02-20 15:29:14 -06:00
Hannah Wolfe
23bc9413e6 Merge pull request #2224 from mjbshaw/useless-regex
Remove useless regex for redirecting /ghost -> /ghost/
2014-02-20 18:51:28 +00:00
Hannah Wolfe
f2d2757a31 Merge pull request #2223 from mjbshaw/fix-subdir
Respect subdirectory in authenticate middleware
2014-02-20 18:51:11 +00:00
Michael Bradshaw
b410f5833b Respect subdirectory in authenticate middleware 2014-02-20 09:46:20 -07:00
Michael Bradshaw
cb6d0d8dfe Remove useless regex for redirecting /ghost -> /ghost/ 2014-02-19 18:19:42 -07:00
Hannah Wolfe
bee5bde491 Merge pull request #2071 from samccone/sjs/show-error-on-import-failure
Show parse error message during a failed import
2014-02-19 20:56:01 +00:00
Hannah Wolfe
6af7d8fa3f Merge pull request #2205 from ErisDS/theme-debug
A first step towards theme debugging
2014-02-19 18:49:50 +00:00
Sebastian Gierlinger
ac7f4f05c4 Add validation from schema.js
closes #1401
- added data/validation/index.js
- added generic validation for length
- added generic validation for nullable
- added validations object to schema.js for custom validation
- removed pyramid of doom from api/db.js
2014-02-19 18:32:23 +01:00
Sam Saccone
d9e7a05fbc Show parse error message during a failed import
adds support for outputting error message during a failed JSON.parse
This will help people identify the problem with their JSON source
and hopefully be able to aid them in resolving said issue.
2014-02-19 11:52:35 -05:00
Sebastian Gierlinger
ea6c601b01 Improvements for models
#closes #1655
- removed models as parameter for bookshelf-session
- changed to read permittedAttributes from schema.js
- changed updateTags to be executed at saved event
- added validate to execute after saving event
- added test for published_at = null (see #2015)
- fixed typo in general.hbs
2014-02-19 14:57:26 +01:00
Hannah Wolfe
e81924282c Merge pull request #2190 from sebgie/issue#2171
Make session expiry less arsey
2014-02-18 22:05:44 +00:00
Hannah Wolfe
1eac0bd25d Merge pull request #2189 from halfdan/2112-tag-helpers
Helper updates for Tag Pages
2014-02-18 21:14:51 +00:00
Hannah Wolfe
6992e990dc Merge pull request #2185 from hswolff/tag-pages
Adds tag pages
2014-02-18 20:59:10 +00:00
Harry Wolff
9ab4b7d4d5 Adds tag pages
fixes #2111

- modified Post model to support a tag query
  param that will filter the desired post collection
  to only include posts that contain the requested tag

- in the updated Post model it includes the Tag model
  under a nested object called 'aspects'

- added tests for updated Post model, updating
  test utils to add more posts_tags relations

- adds two new routes to frontend,
  one for initial tag page,
  another to page that tag page

- for tag pages the array of posts
  is exposed to the view similarly
  to the homepeage

- on the tag view page the information
  for the tag is also accessible
  for further theme usage

- the tag view page supports a hierarchy of
  views, it'll first attempt to use a tag.hbs
  file if it exists, otherwise fall back
  to the default index.hbs file

- modified pageUrl and pagination helper
  to have it be compatible with tag paging

- added unit tests for frontend controller

- added unit tests for handlebar helper modifications

- add functional tests for new tag routes
2014-02-18 15:10:02 -05:00
Fabian Becker
6083cfcd85 Remove unneeded extend implementation.
refs #2179, #2156
- Replace extend with _.extend
2014-02-17 16:34:24 +00:00
Hannah Wolfe
173e60caba Merge pull request #2173 from halfdan/2103-connect-logging
Add logging config option
2014-02-16 19:59:32 +00:00
Hannah Wolfe
8e78f79f9e A first step towards theme debugging
issue #2204
- allow handlebars log helper to output to console in dev mode
2014-02-15 20:46:44 +00:00
Sebastian Gierlinger
d3c641ea31 Make session expiry less arsey
closes #2171
- added authentication middleware
- removed authentication from routes
- moved authentication before CSRF validation
- moved caching rules before authentication
- changed/added test
2014-02-14 11:00:11 +01:00
Gabor Javorszky
212711d896 Added package.js support for themes (and plugins)
Closes #2081
* Amended require-tree to populate availableThemes and availablePlugins to use full file names (`basename.ext`) as keys instead of just basename. This way `image.jpg`, `image.png`, `image.gif` won't overwrite the `image` key.
* Amended require-tree to allow package.json file parsing to return the contents of the file as json on the `package.json` key.
* settings api populates theme data `package` if it exists. Otherwise it assigns `false` to it
* `general.hbs` (salute) was reworked to if there is the package key on the theme is not false, it will use the `name` and `version` keys of that. You can break it by not having a `name` or `version` in the package.json file.
* Added error and warning messages for package.json file parse errors and misses
2014-02-13 23:57:58 +00:00
Fabian Becker
1124d9e4c0 Helper updates for Tag Pages
fixes #2112
refs #1833

- modified config.urlFor to handle tag pages

- modified {{#tags}} handlebars helper to autolink to
  tag pages. Additional autolink="false" parameter can
  be used to deactivate autolinking

- modified url handlebars helper to handle tags

- added isTag function to schema

- added unit test for additional urlFor functionality

- added unit test for {{#tags}} helper modifications

- added unit test for url handlebards helper
2014-02-13 18:32:08 +01:00
Fabian Becker
691e9e773b Add logging config option
closes #2103
- Deactivate logging for testing environments
- Override logging with settings from config
2014-02-10 21:07:11 +00:00
Hannah Wolfe
d790a504a3 Ensure filters get default priority if priority is null
- null priority should be set to the default
- second part to 86619cb087
2014-02-10 18:14:47 +00:00
Hannah Wolfe
b04c0bb83c Merge pull request #2116 from hswolff/permalink-upgrade
Adds support for additional permalink structures
2014-02-10 18:05:43 +00:00
Harry Wolff
b066e732dd Adds support for additional permalink structures
fixes #2057

- uses express’ Route object to create RegExp’s
 that we use to check the incoming path
- refactored structure of fronted controller single
 tests to be easier to read
- amend regex to incorporate new allowed permalink
 structure
2014-02-10 12:07:43 -05:00
Fabian Becker
3993b676b6 Rename unregisterFilter to deregisterFilter
fixes #2167
- Rename functions
- Adjust tests
2014-02-10 12:44:07 +00:00
Fabian Becker
3950c8b30a Fix for broken filters where this context was lost.
fixes #2157
- Change tests to only check for existance
- Properly bind helpers/filters to their instance
2014-02-10 01:45:24 +01:00
Hannah Wolfe
3c5b931432 Merge pull request #2099 from jgable/appDependencies
Install App Dependencies
2014-02-09 12:47:46 +00:00
Jacob Gable
e3affff713 Install App Dependencies
- Spawns an npm install command from the App root
- Has some special OS checks for windows command spawning
2014-02-08 16:58:13 -06:00
Hannah Wolfe
d28d65bf5e Merge pull request #1818 from hswolff/config-file-option
Adds ability to pass in configFile path when loading ghost as a npm module
2014-02-08 22:37:09 +00:00
Fabian Becker
f468b464a6 Allow HTML inside tag prefix/suffix
closes #2123
- Return hbs.Safestring
- Manually escape joined tags
- Added test
2014-02-08 22:27:36 +01:00
Harry Wolff
9dd543231b Adds ability to pass in configFile path when loading
ghost as a npm module

- modifies main script file to allow it to
take in an options object that currently
supports an express instance or a config file path

- added tests
2014-02-08 10:41:15 -05:00
Hannah Wolfe
1783a895de Merge pull request #2137 from jgillich/patch-1
Don't require mail.options to be set
2014-02-08 15:22:50 +00:00
Hannah Wolfe
37b7907c09 Merge pull request #1858 from hswolff/improve-bootstrap-flow
Improve bootstrap flow of a Ghost application
2014-02-08 14:36:29 +00:00
Harry Wolff
f16dc290b7 Improve bootstrap flow of a Ghost application
addresses #1789, #1364

- Moves ./core/server/loader -> ./core/bootstrap.
The bootstrap file is only accessed once during startup,
and it’s sole job is to ensure a config.js file exists
(creating one if it doesn’t) and then validates
the contents of the config file.

Since this is directly related to the initializing 
the application is is appropriate to have 
it in the ./core folder, named bootstrap as that
is what it does.

This also improves the dependency graph, as now
the bootstrap file require’s the ./core/server/config
module and is responsible for passing in the validated
config file.

Whereas before we had ./core/server/config
require’ing ./core/server/loader and running its
init code and then passing that value back to itself,
the flow is now more straight forward of
./core/bootstrap handling initialization and then
instatiation of config module

- Merges ./core/server/config/paths into 
./core/server/config
This flow was always confusing me to that some config
options were on the config object, and some were on
the paths object.

This change now incorporates all of the variables
previously defined in config/paths directly
into the config module, and in extension,
the config.js file.

This means that you now have the option of deciding
at startup where the content directory for ghost
should reside.

- broke out loader tests in config_spec to bootstrap_spec

- updated all relevant files to now use config().paths

- moved urlFor and urlForPost function into 
 ./server/config/url.js
2014-02-07 17:34:21 -05:00
Hannah Wolfe
0dc0a9bb7c Merge pull request #2126 from aiampogi/issue-2114-rssFeeds
Removed author tag inside channel tag in RSS
2014-02-07 11:52:41 +00:00
Jakob Gillich
5e4db70fd0 Don't require mail.options to be set 2014-02-07 11:17:22 +01:00
John-David Dalton
6eab7b3f92 Replace underscore with lodash. 2014-02-06 14:08:34 +00:00
balduv
eadbf7dffb Removed author tag inside channel tag in RSS
closes #2114
- instead of putting author in feedOptions of node-rss, it was moved to itemOptions
- supplying author: user ? user.name : null in itemOptions will still result to creating a dc:creator tag inside item tags so the info needed to have the author is still there like before
- node-rss should however still fix this quirk to not have that nasty author tag in channel tag when you supply author in feedOptions
2014-02-05 13:59:07 +08:00
Jacob Gable
c7713c1d27 Load Apps Sandboxed
- Based on suggestions from hswolff loading with a Module class approach
- Loads relative modules in child sandboxes
2014-02-04 15:46:31 -06:00
Hannah Wolfe
5491f296ac Merge branch '0.4-maintenance' 2014-01-30 13:17:58 +00:00
Sebastian Gierlinger
d28bf3de4c Improve password reset token
no issue
- added check that a combination of email + expires is rejected after
10 attempts
- changed comparison to time independent method

Thanks to @chiiph for reporting this issue!
2014-01-30 13:00:30 +00:00
Hannah Wolfe
be9afc439c Merge branch '0.4-maintenance' 2014-01-28 09:25:38 +00:00
Hannah Wolfe
b4b7783ebd Merge pull request #2054 from ErisDS/issue-1995
Add body class if update is available
2014-01-28 00:53:45 -08:00
Lev Gimelfarb
6cf586aae6 Fix error page resources loading when forceAdminSSL is true
closes #1837
- moved admin theme static resource service above 'checkSSL', otherwise
  when forceAdminSSL is true it will try to redirect them to HTTPS, and
  error pages will be unstyled
2014-01-27 21:57:58 +00:00
Lev Gimelfarb
1df6ac3b94 Detect SSL connection whether or not behind a proxy
closes #1836
- adding server.enable('trust proxy') to let connect framework do the work
  of detecting X-Forwarded-Proto header
- replacing explicit checking for the X-Forwarded-Proto header with just
  'req.secure' boolean check
2014-01-27 21:55:32 +00:00
Paul Adam Davis
fa98a1ed18 Move styling from some elements from IDs to classes
Closes #1605

* Move styling for `#signup`, `#forgotten`, `#reset`, `#login`, `#usermenu` and `#notifications` to classes

No IDs have been added or removed, so any events shouldn't be affected and it passes all tests.
2014-01-27 21:50:19 +00:00
Hannah Wolfe
5e97bcb950 Merge pull request #2036 from xuduo35/0.4-maintenance
bug caused by unidecode's bug
2014-01-27 13:45:42 -08:00
Hannah Wolfe
b9e426478d Add body class if update is available
issue #1995
2014-01-27 21:24:53 +00:00
Hannah Wolfe
199a92d9cb Merge branch '0.4-maintenance'
Conflicts:
	core/server/config/paths.js
	core/test/unit/config_spec.js
2014-01-26 16:11:02 +00:00
Hannah Wolfe
7049d0f338 Improvement for published posts with no published_at
issue #2015

- this is another little workaround / improvement to try to reduce the number of people who end up with a published post with no published_at set
- I assume we need to complete #1655 to fix this properly
2014-01-26 12:05:27 +00:00
Xie JinBin
1d1caada6b bug caused by unidecode's bug
close #1986
- remove URL reserved chars after unidecode, because unidecode will produce some URL reserved chars.
2014-01-26 19:31:19 +08:00
Hannah Wolfe
b0345b6238 Merge pull request #2024 from jgillich/0.4-maintenance
Use absolute path when storing images
2014-01-26 02:45:24 -08:00
Hannah Wolfe
951385ec2d Merge pull request #2025 from ErisDS/issue-2000
Start up safely when the activeTheme is not present
2014-01-25 13:06:41 -08:00
Hannah Wolfe
631c0f1900 Merge pull request #2018 from ErisDS/issue-1991
Catch errors when rendering the error template
2014-01-25 13:06:33 -08:00
Hannah Wolfe
b2e5ef4154 Catch errors when rendering the error template
fixes #1991

- if there's an error when rendering the error template, default to sending a plain response detailing both errors.
2014-01-25 20:43:28 +00:00
Hannah Wolfe
6ec7c42947 Start up safely when the activeTheme is not present
fixes #2000

- resolves errors when attempting to start Ghost without the active theme present
- the frontend will render a 500 error page safely
- issues with themes that have an error template are resolved separately in #2018
2014-01-24 22:14:56 +00:00
Hannah Wolfe
0322676657 Merge pull request #1979 from sebgie/fix-session-1
Fix for session handling
2014-01-24 13:20:01 -08:00
Jakob Gillich
1ee70e3849 Use absolute path when storing images
closes #1983
2014-01-24 16:16:57 +01:00
Hannah Wolfe
3961b7173f Upgrade express-hbs, and switch to using registerPartial
fixes #1964, fixes #1975

 - Issues with partial handling which caused #1964  have been part fixed by handlebars, part worked around by express-hbs, we must use `registerPartials` to ensure partials are handled correctly.
 - Issue with error handling which caused #1975 has also been fixed in express-hbs, which now catches the error from handlebars and passes it to express so that we can handle the error with an error page.
2014-01-24 11:08:15 +00:00
Hannah Wolfe
cccc19842e Merge pull request #2004 from ErisDS/issue-1992
Adding guard to meta_title
2014-01-22 12:38:53 -08:00
Hannah Wolfe
91f59e74af Merge pull request #1949 from jolros/symlinked-themes-bugfix
Including theme partials in a way that supports symbolically linked directories
2014-01-22 11:05:33 -08:00
Hannah Wolfe
20f4af2eb4 Adding guard to meta_title
fixes #1992
2014-01-21 17:24:24 +00:00
John O'Nolan
7ebd104f3f Rename 'plugins' to 'apps'
Fixes #1988
2014-01-21 15:45:27 +07:00
Hannah Wolfe
2aa7288777 Merge pull request #1948 from sebgie/issue#1932-1
Fix display update notification
2014-01-20 07:24:02 -08:00
Hannah Wolfe
39b9c1cf6b Merge pull request #1927 from schneidmaster/fix-1907
Fixed issue with adding multiple new tags to a post
2014-01-20 06:04:59 -08:00
Hannah Wolfe
6c222df83d Merge pull request #1956 from jaswilli/issue-1782
Show message and don't start if javascript files have not been built
2014-01-20 05:59:01 -08:00
Hannah Wolfe
f185a5d616 General cleanup
- Cleanup some todos, comments, and unused variables
2014-01-19 21:08:39 +00:00
Sebastian Gierlinger
2d75497ecf Fix for session handling
closes #1978
- wait for async calls before callback()
2014-01-18 20:14:38 +01:00
Jason Williams
d7c3dbb17e Show message and don't start if javascript files have not been built
fixes #1782
- added builtFilesExist function to check for files during startup.
  If built files do not exist Ghost startup is stopped and a link
  to the documentation is displayed.
- exported a scriptFiles object from server/helpers.
- added a builtScriptPath to the paths module.
- removed "js-msg" about missing javascript from the UI.
2014-01-15 19:10:43 +00:00
Hannah Wolfe
c1290d77a6 Merge pull request #1954 from ErisDS/issue-1498
Adding case-insensitive User.getByEmail method
2014-01-15 05:57:58 -08:00
Sebastian Gierlinger
03cbc89a53 Fix posts.html and posts.markdown field type
closes #1947
- added fieldtype: medium for posts.html
- changed fieldtype: medium for posts.markdown
- added method to fix databases created with wrong field type
- added tests for database version 002
2014-01-15 14:29:23 +01:00
Hannah Wolfe
6098b83152 Adding case-insensitive User.getByEmail method
fixes #1498

- emails are no longer converted to lowercase, local mailbox can validly
  be mixed case
- getByEmail uses JS to compare emails to ensure we can support unicode
- tests that users can be retrieved by their email address with case
  insensitivity
2014-01-15 10:39:40 +00:00
Sebastian Gierlinger
fd4f3051e6 Fix display update notification
closes #1932

- added showUpdateNotification with version check
- added temp workaround for boolean values in database
- changed default value from false to null
- updated tests
2014-01-14 20:46:36 +01:00
Joel Rosenberg
6437f343c1 Including theme partials in a way that supports symbolically linked directories
closes #1937
 - using fs.stat() instead of hasOwnProperty() to test for directory existence
2014-01-14 11:43:23 -08:00
Zach Schneider
fa7bd62857 Fixed issue with adding multiple new tags to a post
Fixes #1907

Refactored `updateTags` to correct a loop issue where the `insert`
method was mistakingly being passed rather than `update`, triggering a
duplicate PK SQL error.
2014-01-13 09:29:40 -05:00
Hannah Wolfe
c8917cab4d Error message updates
no issue

- couple of tweaks to the messaging of non-fatal errors that can be output when running Ghost
2014-01-12 21:49:24 +00:00
Hannah Wolfe
9f0dea0559 Minor fixes to asset helper and tests
no issue

- asset helper ignores it if theme devs specify the asset dir
- asset helper strips leading slashes
- static asset tests were wrong
2014-01-12 21:48:34 +00:00
Hannah Wolfe
3dea6431df Ensure cookies are only ever set for admin
fixes #1901

- Adds a trailing slash to the cookie path
- Resolves random log-outs
- Adds a test which proves the case
2014-01-12 17:08:48 +00:00
Hannah Wolfe
d6f4312255 Improve errors on image upload 2014-01-11 13:40:21 +00:00
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
nicovalencia
e8746a2375 Add rss to the list of reserved post titles/slugs.
closes #1880
- added `rss` to core/server/models `generateSlug` reserved keywords
- added integration test for safe slug generation to core/test/integration/model/model_posts_spec.js
2014-01-07 17:30:53 -07:00
Jakob Gillich
f8299ed769 Fix TypeError due to missing mail config 2014-01-07 22:35:22 +01:00
Hannah Wolfe
7a5e5d7f1f Merge pull request #1877 from JohnONolan/old-todos
Get rid of old todos
2014-01-07 10:53:35 -08:00
Hannah Wolfe
bbcabcb849 Merge pull request #1876 from JohnONolan/comment-tweak
Amended comment
2014-01-07 10:53:03 -08:00
Hannah Wolfe
03a8200fa0 Merge pull request #1875 from wangsai/fix-date
fix missused Date obj
2014-01-07 10:52:41 -08:00
John O'Nolan
c8bc6fe7bf Get rid of old todos
Cause they’re already fucking done
2014-01-07 19:20:16 +01:00
John O'Nolan
983002cf79 Amended comment
Swearing in code is fine, but let’s be fucking inclusive about it.
2014-01-07 19:13:32 +01:00
WangSai
dbc1247508 fix missused Date obj 2014-01-08 01:19:14 +08:00
Sebastian Gierlinger
89da402710 Fix command line error
closes #1871
- added check for mailConfig
2014-01-07 22:30:23 +08:00
Hannah Wolfe
b64511acf3 Merge pull request #1839 from hswolff/1351-post-settings-ux
New Post UX behaviour.
2014-01-07 02:00:14 -08:00
Hannah Wolfe
dcf4b1e4e4 Add update notifications
closes #1464

- adds opt-out via updateCheck:false in config.js
- update check is done on admin index, but doesn't interfere with rendering
- adds update check module, which gets the usage data, makes the request and handles the response
- adds two new settings to default-settings, one for next check time, and one for whether to show the notification
- adds a new rejectError method to errorHandling
- adds a new helper for displaying the notification

Conflicts:
	core/server/helpers/index.js
	core/test/unit/server_helpers_index_spec.js
2014-01-07 08:20:08 +00:00
Harry Wolff
a1f64d2f1f Extending halfdan’s work for UX settings improvements
#1351

- prevent a new post (not saved on server) from
updating its slug/date to the server

- fix jshint

- add back creation of a posts slug upon a post creation

- update for rebasing

- hide ability to ‘delete this post’ from post settings
menu when a post hasn’t yet been saved to the server
2014-01-06 21:33:24 -05:00
Fabian Becker
11c8d234f7 New Post UX behaviour.
refs #1351
- Make generateSlug a static method on base model
- Change client behaviour (unfinished)
- Add new getSlug API method
2014-01-06 21:05:17 -05:00
Sebastian Gierlinger
6220bd19f5 Use ajax for import
closes #1854
- added blueimp file upload to debug.js
- changed POST /ghost/api/v0.1/db to be used with AJAX
- cache invalidation header should now work for import
- moved busboy middleware invocation to routes/api and routes/admin
- moved api.db.import to api.db.importContent (I hated the [] notation)
- moved api.db.export to api.db.exportContent (see above)
2014-01-06 22:55:43 +00:00
Hannah Wolfe
f17b320a7b ghost-busboy improvements
- use hex instead of base64 as this can cause errors when trying to reopen the file due to characters like '/' appearing
- added basic console log to errors.
2014-01-06 22:39:03 +00:00
Hannah Wolfe
63521e1ce8 Merge pull request #1861 from pogoapp/fix_pg_table_scan
fix table scan for pg migrations
2014-01-06 13:37:16 -08:00
Hannah Wolfe
3f9b0fa618 Disable xss santization
issue #1378
fixes #1328

- xss santization does some odd things. This isn't needed until we have multi-user support, and we are investigating better solutions.
2014-01-06 20:17:20 +00:00
Paul
b90752114e fix table scan for pg migrations 2014-01-06 16:32:20 -03:00
Sean Hellwig
1640d9bc35 Unique filenames for tmp files in ghost-busboy
fixes #1843

- uses a timestamp and an md5 hash of the filename for the tmp file
  instead of the user-provided filename
2014-01-06 16:03:29 +00:00