Commit Graph

937 Commits

Author SHA1 Message Date
evazion
c325bfa199 css: factor out colors from main css (#4158). 2019-09-17 00:28:41 -05:00
evazion
059e061b15 tests: fixup comment vote, post controller tests.
Use git clean to delete stale files from an earlier checkout. These
files interfered with various things (specifically, a comment vote test
failed because there was an old comment_votes/create.json.erb template
hanging around that changed the behavior of the POST /comment_votes endpoint).
2019-09-09 15:06:24 -05:00
evazion
efca48ee96 Set SameSite=Lax on session cookies.
https://web.dev/samesite-cookies-explained
2019-09-09 11:51:01 -05:00
evazion
312606bf98 Fix #4137: Share cookies across subdomains 2019-09-09 11:51:01 -05:00
evazion
763ac1a7e0 pools: stop maintaining pool category pseudotags in pool strings (#4160)
Stop maintaining pool category pseudo tags (pool:series, pool:collection)
in pool strings. They're no longer used and the changes to the
`Post#pools` method in dc4d2e54b caused issues with this.

Also allow Members to change the category of large pools again. This was
only restricted because maintaining these pseudotags forced us to update
every post in the pool whenever a pool's category was changed.
2019-09-08 23:28:02 -05:00
evazion
d0f060d8eb api: refactor api attribute declarations.
Replace the `method_attributes` and `hidden_attributes` methods with
`api_attributes`. `api_attributes` can be used as a class macro:

    # include only the given attributes.
    api_attributes :id, :created_at, :creator_name, ...

    # include all default attributes plus the `creator_name` method.
    api_attributes including: [:creator_name]

or as an instance method:

    def api_attributes
       [:id, :created_at, :creator_name, ...]
    end

By default, all attributes are included except for IP addresses and
tsvector columns.
2019-09-08 23:28:02 -05:00
evazion
3f7e05316d api: refactor default options for xml responses.
In xml responses, if the result is an empty array we want the response
to look like this:

   <posts type="array"/>

not like this (the default):

   <nil-classes type="array"/>

This refactors controllers so that this is done automatically instead of
having to manually call `@things.to_xml(root: "things")` everywhere. We
do this by overriding the behavior of `respond_with` in `ApplicationResponder`
to set the `root` option by default in xml responses.
2019-09-08 15:32:31 -05:00
evazion
f673552743 users: add /settings page.
Add /settings page and link to it instead of /users/:id/edit.
2019-09-01 15:00:27 -05:00
evazion
ff92b32f02 users: add /profile page (fix #4151).
* Add /profile, /profile.json endpoints.
* Make "My Account" link to /profile.
* Add 'User ID' field to profile page.
2019-09-01 15:00:23 -05:00
evazion
1bb1b147ea Fix autoloading deprecation warning in delayed job initializer.
DEPRECATION WARNING: Initialization autoloaded the constants
    Danbooru::Paginator and Danbooru::Paginator::ActiveRecordExtension.

    Being able to do this is deprecated. Autoloading during
    initialization is going to be an error condition in future versions
    of Rails.

    Reloading does not reboot the application, and therefore code
    executed during initialization does not run again. So, if you reload
    Danbooru::Paginator, for example, the expected changes won't be
    reflected in that stale Module object.

    `config.autoloader` is set to `classic`. These autoloaded constants
    would have been unloaded if `config.autoloader` had been set to
    `:zeitwerk`.

    Please, check the "Autoloading and Reloading Constants" guide for
    solutions.
2019-09-01 13:10:37 -05:00
evazion
65e53b86b3 Drop support for /cache/tag.json.
Drop support for https://danbooru.donmai.us/cache/tags.json. This was a
nightly dump of the tags table that was originally added in #1012. It
was never documented and never really used except for by the DanbooruUp
extension.
2019-08-29 00:52:23 -05:00
evazion
eba6440b8b Fix #4144: Deviantart Eclipse update broke strategy. 2019-08-28 23:40:29 -05:00
evazion
0cf9f845d0 newrelic: fix tracking of api auth failure errors.
Fixes user params not being recorded on SessionLoader::AuthenticationFailed errors.
2019-08-27 21:19:56 -05:00
evazion
2c3ecf7ea4 Kill utf8=✓ param. 2019-08-27 18:13:30 -05:00
evazion
3f86a60457 Upgrade to Rails 6.0.0. 2019-08-27 18:13:30 -05:00
evazion
62875eabb2 /posts.atom: fix banned posts being visible to Members.
Bug: /posts.atom only hid loli/shota, not banned posts and not unsafe
posts when safe mode was on.
2019-08-25 20:29:32 -05:00
evazion
0101b5f5f4 danbooru default config: remove unused config settings. 2019-08-25 20:29:32 -05:00
evazion
1a964f7a10 app controller: move safe mode from app controller to SessionLoader. 2019-08-24 22:55:36 -05:00
evazion
06ff249530 dmails: factor out spam detector service. 2019-08-23 22:38:03 -05:00
evazion
0b78485227 dotenv: load .env.local before initializers. 2019-08-23 22:30:23 -05:00
evazion
dfe2b831a3 cache: replace memcache with redis.
Drop memcache. Use redis for all caching instead.
2019-08-22 23:15:34 -05:00
evazion
2e407fa476 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-22 22:09:05 -05:00
evazion
84f4e076cc whenever: log cronjob output to log/whenever.log. 2019-08-22 17:28:53 -05:00
evazion
804ccd4fcc capistrano: fix cronjobs not updating.
Bug: capistrano didn't update the crontab during deployment. As a result
the crontab still referenced an old deployment. Eventually that
deployment was deleted and cronjobs started silently failing.

Broken in 223e5f1e8. Turns out that `whenever` defaults to running on
servers with the `db` role. Removing kagamihara from the db role meant
that whenever was no longer configured to run anywhere.
2019-08-21 18:02:55 -05:00
evazion
82fbb19e0f users: drop unused code. 2019-08-18 11:24:42 -05:00
evazion
822dce20ed jobs: add base ApplicationJob. 2019-08-16 20:49:34 -05:00
evazion
2b236a7111 unicorn: bump worker count (12 -> 16). 2019-08-15 00:36:25 -05:00
evazion
13dbdd5cd9 unicorn: clear environment variables during hot restarts.
Fixes an issue with zero downtime deployments (#4123). Hot restarting
didn't clear out BUNDLER_GEMFILE, which mean that new workers still used
the old Gemfile from previous deployments. This led to mysterious errors
with autoloading libraries (#4138).
2019-08-15 00:36:25 -05:00
evazion
4833b8a63c Fix the circleci build. 2019-08-14 16:42:37 -05:00
evazion
e29e5fe984 Fix #4131: Upgrade to Ruby 2.6.
Upgrade procedure:

    $ echo 2.6.3 > .ruby-version

    # upgrade ruby-build to know about the latest ruby versions.
    # see also: github.com/rkh/rbenv-update
    $ cd ~/.rbenv/plugins/ruby-build && git pull

    # install the version of ruby specified in .ruby-version.
    # see also: github.com/capistrano/rbenv/issues/83
    $ rbenv install --skip-existing

    # update the shell to use the latest version of ruby by default.
    $ rbenv global 2.6.3

    # update rubygems and bundler
    $ gem update --system

    # update the lockfile to use the latest version of bundler
    $ bundle update --bundler
2019-08-14 12:25:50 -05:00
evazion
90fa67d4c1 Remove unused terms of service banner.
No longer used, inadvertently hidden in a6233f297e.
2019-08-14 01:46:44 -05:00
evazion
d0428da120 sessions: remove nonexistent GET /session route. 2019-08-14 01:46:43 -05:00
evazion
9b57631046 capistrano: fix newrelic deployment tagging.
Override the appname in config/newrelic.yml so that we don't
accidentally tag deployments under the wrong app.
2019-08-12 19:20:33 -05:00
evazion
f268293105 delayed jobs: log to stdout.
Log to stdout because we now run workers under systemd and we want
errors to go to the journal, not to log/production.log.
2019-08-12 13:38:45 -05:00
evazion
18a216c67a Fix #4130: Remove tag alias corrections. 2019-08-10 22:46:49 -05:00
evazion
853becbcfc circleci: try to fix the build. 2019-08-08 01:07:57 -05:00
evazion
c225d54de1 capistrano: add deploy:rolling task (fix #4123). 2019-08-07 22:11:07 -05:00
evazion
223e5f1e81 capistrano: enable conditional migrations. 2019-08-07 22:11:07 -05:00
evazion
9996dd40bb capistrano: only log newrelic deployment in production.
Fix local development deployments getting logged in New Relic.
2019-08-07 22:11:07 -05:00
evazion
2beb79166e capistrano: fix git deprecation warning. 2019-08-07 22:11:07 -05:00
evazion
ef68d42dbe Drop unused query tracer code + term-ansicolor gem. 2019-08-07 22:11:07 -05:00
evazion
b0da649b09 Remove obsolete scripts.
These are mostly old files mostly related to maintenance of Danbooru 1
or the upgrade to Danbooru 2.
2019-08-06 10:42:45 -05:00
evazion
2df6bf41f6 cron: move 'vacuum analyze' to daily maintenance. 2019-08-06 10:42:45 -05:00
nothink
72ceb484ce Update INSTALL.debian, for Debian 9(stretch) 2019-08-05 23:29:12 +09:00
evazion
b9bb5467b8 Fix #4117: Use memcache for fragment caching. 2019-08-04 21:10:57 -05:00
evazion
92504cb8f3 Fix #4075: Add non-web_source to default tags removed by replacement. 2019-07-31 20:17:32 -05:00
evazion
504f785edc Fix #4115: Upgrade to webpack 4.x.
https://github.com/rails/webpacker/blob/master/docs/v4-upgrade.md
2019-07-31 20:17:14 -05:00
r888888888
0999e7a71a increase unicorn process count 2019-06-01 14:19:52 -07:00
Albert Yi
33063a72de Add a listing page for post disapprovals (accessible to approvers only) 2019-01-24 16:14:57 -08:00
Albert Yi
d10b898dd6 add dependency for redis image on docker compose config 2019-01-24 13:25:40 -08:00