Commit Graph

61 Commits

Author SHA1 Message Date
Earlopain
fc7d84affd
[RuboCop] Enable Style/FrozenStringLiteralComment
This reduces allocations on the posts page by about 5%, from basic testing
2024-02-25 18:15:55 +01:00
Earlopain
f5fcd8a53b
[Rails] Set load_defaults to 7.1 2024-01-30 16:18:26 +01:00
Earlopain
86d44b5b67
[Rails] Enable the remaining 7.1 framework defaults 2024-01-30 16:16:10 +01:00
Earlopain
b00f7145c0
[Rails] Enable some new framework defaults
Others require a deploy first (like caching stuff) or need more thought (like serialization changes)
2024-01-27 13:49:57 +01:00
Earlopain
a7228612a2
[Rails] Update to 7.1
Run `app:update`, fix the one deprecation warning
2024-01-25 22:05:29 +01:00
Earlopain
17b9797657
[Misc] Remove elasticsearch-rails gem
There is no counterpart for OpenSearch.
`elasticsearch-model` needs to go too but that is more involved than
just removing something that only facilitates logging in dev.

This was responsible for
* displaying the time elasticsearch queries took per request
* logging the search parameters being sent to elasticsearch per query

The implementation isn't that complex and I could roll something myself but
considering that I haven't sought that information out by now I'll just don't.
Logging queries is trivial since we craft these manually ourselves.
2023-09-12 20:23:35 +02:00
Earlopain
54247d26ba
[ExceptionLog] Move git code into module 2023-03-10 22:15:10 +01:00
Earlopain
34bcb27482
[Rails] load_defaults 7.0
Also see #439

I was confused about wrap_parameters_by_default. It's actually not relevant
for us since every controller params are wrapped in params.require(:model),
which means that wrapping is forced through that.
wrap_parameters.rb was setting the new default through other  means already
though, so even if it's required somewhere there are no functional differences.
2022-12-09 19:07:08 +01:00
Earlopain
fbc06182cc
[Rails] Update to 7 and run app:update 2022-10-10 13:22:35 +02:00
Earlopain
c40fe2fae9
[Misc] Fix ruby 3 deprecation warnings 2022-04-09 13:40:30 +02:00
Kira
76d1999ade [Rails] Upgrade to rails 6.1 + fix tests 2021-02-25 12:08:09 -08:00
Kira
caf5ba7d13 Don't nuke my darn settings! 2020-02-04 15:23:09 -08:00
Kira
8e80df77ff Update gems
This also removes the sprockets based asset pipeline because it
isn't being used, and it was causing startup exceptions.
2019-10-22 21:26:35 -07:00
Kira
9c7b7a23d6 Use rails 6.0 defaults 2019-09-13 10:20:07 -07:00
evazion
c8c0e31474 rails: update defaults from 5.1 to 5.2.
protect_from_forgery removed from because it's now on by default.

ref: https://edgeguides.rubyonrails.org/configuring.html
2019-08-28 20:51:39 -07:00
Kira
e62099af44 A whole boatload of elasticsearch changes
Makes index job unique to account for changes to update triggering.
Fixes instances of mixed SQL and ES searches with tag_matches.
Adds utility methods for exists? and count_only ES searches.
Adds comment_bumped_at for comments page usage.
Adds random seeding capability.
Fixes random searches not working correctly.
Fixes status:active.
2019-03-28 14:04:01 -07:00
byte
d1aa2e69f5 add post index 2019-03-24 08:45:44 -04:00
Kira
22a077a2dd Convert delayed_jobs to activejob
Add sidekiq and create jobs for the majority of delayed actions.

Temporary hookup of sidekiq UI in routes for testing purposes.
2019-02-17 19:28:40 -08:00
Kira
dbf46d3522 Initial setup script changes as required by danbooru. 2019-01-31 12:27:40 -08:00
Albert Yi
72f319ccf3 rename lambda references to use shorthand syntax 2018-05-10 11:18:02 -07:00
Albert Yi
664a3f02e2 fixes for failed cron maintenance tasks
* update rails scripts for 5.2
* system dmails should be scoped to system
* fix broken url generator in forum notices
2018-04-27 15:01:40 -07:00
evazion
09462aefeb Fix #3522: Enable HSTS. 2018-04-19 01:39:46 -05:00
evazion
2fd91bfa20 Load danbooru_default_config.rb earlier.
Load danbooru_default_config.rb inside application.rb instead of in an
initializer so that it's available as soon as possible.
2018-04-19 00:49:50 -05:00
r888888888
abce4d2551 Raise error on unpermitted params.
Fail loudly if we forget to whitelist a param instead of silently
ignoring it.

misc models: convert to strong params.

artist commentaries: convert to strong params.

* Disallow changing or setting post_id to a nonexistent post.

artists: convert to strong params.

* Disallow setting `is_banned` in create/update actions. Changing it
  this way instead of with the ban/unban actions would leave the artist in
  a partially banned state.

bans: convert to strong params.

* Disallow changing the user_id after the ban has been created.

comments: convert to strong params.

favorite groups: convert to strong params.

news updates: convert to strong params.

post appeals: convert to strong params.

post flags: convert to strong params.

* Disallow users from setting the `is_deleted` / `is_resolved` flags.

ip bans: convert to strong params.

user feedbacks: convert to strong params.

* Disallow users from setting `disable_dmail_notification` when creating feedbacks.
* Disallow changing the user_id after the feedback has been created.

notes: convert to strong params.

wiki pages: convert to strong params.

* Also fix non-Builders being able to delete wiki pages.

saved searches: convert to strong params.

pools: convert to strong params.

* Disallow setting `post_count` or `is_deleted` in create/update actions.

janitor trials: convert to strong params.

post disapprovals: convert to strong params.

* Factor out quick-mod bar to shared partial.
* Fix quick-mod bar to use `Post#is_approvable?` to determine visibility
  of Approve button.

dmail filters: convert to strong params.

password resets: convert to strong params.

user name change requests: convert to strong params.

posts: convert to strong params.

users: convert to strong params.

* Disallow setting password_hash, last_logged_in_at, last_forum_read_at,
  has_mail, and dmail_filter_attributes[user_id].

* Remove initialize_default_image_size (dead code).

uploads: convert to strong params.

* Remove `initialize_status` because status already defaults to pending
  in the database.

tag aliases/implications: convert to strong params.

tags: convert to strong params.

forum posts: convert to strong params.

* Disallow changing the topic_id after creating the post.
* Disallow setting is_deleted (destroy/undelete actions should be used instead).
* Remove is_sticky / is_locked (nonexistent attributes).

forum topics: convert to strong params.

* merges https://github.com/evazion/danbooru/tree/wip-rails-5.1
* lock pg gem to 0.21 (1.0.0 is incompatible with rails 5.1.4)
* switch to factorybot and change all references

Co-authored-by: r888888888 <r888888888@gmail.com>
Co-authored-by: evazion <noizave@gmail.com>

add diffs
2018-04-06 18:09:57 -07:00
evazion
127e4e385b Fix dmail failures when akismet isn't configured. 2017-11-25 21:46:32 -06:00
r888888888
b944b642b8 akismet integration 2017-09-14 13:37:36 -07:00
evazion
ebff8d04f7 config/application.rb: set hostname so root_url works. 2017-02-18 03:10:42 -06:00
evazion
f8d5add0cc Silence git messages to stdout during app boot.
Caused this to be printed every time tests were run:

    git is /usr/bin/git
    /home/user/src/danbooru
2016-12-03 20:09:58 -06:00
evazion
58ef469a76 Link current commit if running inside a git repo.
Useful when running `rails server` straight from a dev repo.
2016-10-24 19:07:08 -05:00
r888888888
06ddb16843 better mechanism for determining release revision 2016-09-07 18:54:24 -07:00
r888888888
af60ed7763 include git hash in footer 2016-09-07 18:45:21 -07:00
r888888888
c8f38350c3 update rails default files 2015-08-18 17:50:27 -07:00
r888888888
341b29ce41 fix tests 2015-08-18 17:40:53 -07:00
r888888888
53844af8dc Merge branch 'ruby-2.1'
This reverts commit 616aef4394.
2014-12-10 16:23:58 -08:00
r888888888
616aef4394 Revert "Merge branch 'ruby-2.1'"
This reverts commit 18dd5acca7, reversing
changes made to 55fef2f7c6.
2014-04-24 16:12:30 -07:00
r888888888
18dd5acca7 Merge branch 'ruby-2.1'
Conflicts:
	app/assets/javascripts/comments.js
	app/helpers/delayed_jobs_helper.rb
2014-04-23 18:05:31 -07:00
r888888888
fad0ab7c93 fixes #2133 2014-04-16 17:43:34 -07:00
r888888888
ec0280bcde upgrade to ruby 2.0.0 2014-02-26 13:16:34 -08:00
小太
cba839ba76 Kill trailing whitespace in ruby files 2013-03-19 23:10:10 +11:00
albert
f52181db94 Major revamp of security. Passwords are first SHA1 hashed and then
that hash is bcrypted.  Bcrypted hashes are stored in a new column on
users.  This separate column is only to allow for rollbacks,
eventually the old SHA1 hash column will be removed.  Sensitive cookie
details are now encrypted to prevent user tampering and more stringent
checks on secret_token and session_secret_key are enforced.
2013-03-04 22:55:41 -05:00
albert
a3658f6811 tweak logger 2013-02-17 18:14:12 -05:00
albert
963bb18de2 fix 2013-02-17 17:55:21 -05:00
albert
48d4673935 add memorylogic 2013-02-17 17:50:00 -05:00
albert
fdff706336 add tagged logging 2013-02-17 17:33:09 -05:00
albert
4cc04d395a fix 2012-02-10 17:51:34 -05:00
albert
1eae813f6d revert precompile behavior 2012-01-27 18:38:24 -05:00
albert
c8bcf5ad7c updated to rails 3.2, fixed tests 2012-01-27 14:22:47 -05:00
albert
1e9efe65f4 updated mailer urls 2011-09-18 17:12:48 -04:00
albert
d42e82eb2f updated mailer urls 2011-09-18 17:08:17 -04:00
albert
713ee07b55 removed img dir initializer 2011-09-16 19:04:33 -04:00